gujjwal00 / avnc

VNC Client for Android
GNU General Public License v3.0
660 stars 59 forks source link

Mouse input doesnt work in some program #119

Closed xDoge26 closed 1 year ago

xDoge26 commented 1 year ago

I have some problem with avnc . with some program, mouse input cant be sent although it recognize the mouse . Alt tab ctrl key is working fine

Logs

```python --------- beginning of system 01-01 15:56:12.236 3284 3284 I Timeline: Timeline: Activity_launch_request time:187618843 01-01 15:57:31.871 3284 3284 I Timeline: Timeline: Activity_launch_request time:187698477 01-01 15:57:31.960 3284 3284 I Timeline: Timeline: Activity_launch_request time:187698567 01-01 15:57:43.499 3284 3284 I Timeline: Timeline: Activity_launch_request time:187710106 01-01 15:58:00.482 3284 3284 I Timeline: Timeline: Activity_launch_request time:187727089 01-01 15:58:07.664 3284 3284 I Timeline: Timeline: Activity_launch_request time:187734270 01-01 15:58:53.103 3284 3284 I Timeline: Timeline: Activity_launch_request time:187779710 --------- beginning of main 01-01 15:59:46.566 4100 4100 E com.gaurav.avn: Not starting debugger since process cannot load the jdwp agent. 01-01 15:59:46.588 4100 4100 W ActivityThread: registerApplicationScoutThread result:true 01-01 15:59:46.595 4100 4142 D AnrScout: AppScoutStateMachine created 01-01 15:59:46.617 4100 4100 I Perf : Connecting to perf service. 01-01 15:59:46.626 4100 4100 I ForceDarkHelper: mForceDarkOrigin true 01-01 15:59:46.628 4100 4100 I MiuiForceDarkConfig: MiuiForceDarkConfig setConfig density:2.750000, mainRule:0, secondaryRule:0, tertiaryRule:0 01-01 15:59:46.629 4100 4100 D NetworkSecurityConfig: No Network Security Config specified, using platform default 01-01 15:59:46.629 4100 4100 D NetworkSecurityConfig: No Network Security Config specified, using platform default 01-01 15:59:46.633 4100 4100 I ContentProviderMonitor: PerfMonitor installContentProviders : before publish content providers 01-01 15:59:46.657 4100 4100 I Timeline: Timeline: Activity_launch_request time:187833264 01-01 15:59:46.671 4100 4100 D View : com.gaurav.avnc initForcedUseForceDark: 1 01-01 15:59:46.676 4100 4100 D DecorView[]: getWindowModeFromSystem windowmode is 1 01-01 15:59:46.709 4100 4100 D DecorView[]: getWindowModeFromSystem windowmode is 1 01-01 15:59:46.807 4100 4100 D FrameIndicator: support status: 1 0x74a8ecc018 0x74a8ecc4c4 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: QUALCOMM build : 5eaa426211, I07ee46fc66 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: Build Date : 10/08/21 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: OpenGL ES Shader Compiler Version: EV031.32.02.16 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: Local Branch : 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: Remote Branch : 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: Remote Branch : 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: Reconstruct Branch : 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: Build Config : S P 10.0.7 AArch64 01-01 15:59:46.808 4100 4147 I AdrenoGLES-0: Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so 01-01 15:59:46.812 4100 4147 I AdrenoGLES-0: PFP: 0x016ee197, ME: 0x00000000 01-01 15:59:46.864 4100 4147 E LB : fail to open file: No such file or directory 01-01 15:59:48.767 4100 4100 W MirrorManager: this model don't Support 01-01 15:59:48.837 4100 4100 I Timeline: Timeline: Activity_launch_request time:187835444 01-01 15:59:48.868 4100 4100 D DecorView[]: getWindowModeFromSystem windowmode is 1 01-01 15:59:48.868 4100 4169 I NativeVnc: VNC server supports protocol version 3.8 (viewer 3.8) 01-01 15:59:48.869 4100 4169 I NativeVnc: We have 2 security types to read 01-01 15:59:48.869 4100 4169 I NativeVnc: 0) Received security type 19 01-01 15:59:48.869 4100 4169 I NativeVnc: Selecting security type 19 (0/2 in the list) 01-01 15:59:48.869 4100 4169 I NativeVnc: 1) Received security type 2 01-01 15:59:48.869 4100 4169 I NativeVnc: Selected Security Scheme 19 01-01 15:59:48.870 4100 4169 I NativeVnc: Got VeNCrypt version 0.2 from server. 01-01 15:59:48.878 4100 4169 I NativeVnc: We have 2 security types to read 01-01 15:59:48.878 4100 4169 I NativeVnc: 0) Received security type 2 01-01 15:59:48.878 4100 4169 I NativeVnc: 1) Received security type 258 01-01 15:59:48.879 4100 4169 I NativeVnc: Selecting security type 258 01-01 15:59:48.880 4100 4169 I NativeVnc: OpenSSL version wolfSSL 5.5.3 initialized. 01-01 15:59:48.923 4100 4169 I NativeVnc: TLS session initialized. 01-01 15:59:48.925 4100 4169 I NativeVnc: VNC authentication succeeded 01-01 15:59:48.925 4100 4169 I NativeVnc: Desktop name "remote-desktop" 01-01 15:59:48.925 4100 4169 I NativeVnc: Connected to VNC server, using protocol version 3.8 01-01 15:59:48.925 4100 4169 I NativeVnc: VNC server default format: 01-01 15:59:48.925 4100 4169 I NativeVnc: 32 bits per pixel. 01-01 15:59:48.925 4100 4169 I NativeVnc: Least significant byte first in each pixel. 01-01 15:59:48.925 4100 4169 I NativeVnc: TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0 01-01 15:59:49.046 4100 4100 D FrameIndicator: support status: 1 0x74a8ecc018 0x74a8ecc4c4 01-01 15:59:49.071 4100 4100 D DecorView[]: getWindowModeFromSystem windowmode is 1 01-01 15:59:49.114 4100 4100 D DecorView[]: getWindowModeFromSystem windowmode is 1 01-01 15:59:49.131 4100 4100 D SurfaceView: UPDATE null, mIsCastMode = false 01-01 15:59:49.134 4100 4100 D FrameIndicator: support status: 1 0x74a8ecc018 0x74a8ecc4c4 01-01 15:59:49.179 4100 4147 D OpenGLRenderer: endAllActiveAnimators on 0xb4000074a7860e00 (MaterialCardView) with handle 0xb4000074ff624080 01-01 15:59:49.199 4100 4208 D ShaderCompiler: 01-01 15:59:49.200 4100 4208 D ShaderCompiler: 01-01 15:59:49.204 4100 4208 D ShaderCompiler: 01-01 16:00:03.324 4100 4100 D MIUIInput: [KeyEvent] ViewRootImpl KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BACK, scanCode=0, metaState=0, flags=0x48, repeatCount=0, eventTime=187849927, downTime=187849927, deviceId=-1, source=0x101, displayId=0 } 01-01 16:00:03.389 4100 4100 D MIUIInput: [KeyEvent] ViewRootImpl KeyEvent { action=ACTION_UP, keyCode=KEYCODE_BACK, scanCode=0, metaState=0, flags=0x48, repeatCount=0, eventTime=187849993, downTime=187849927, deviceId=-1, source=0x101, displayId=0 } 01-01 16:00:03.448 4100 4100 D FrameIndicator: support status: 1 0x74a8ecc018 0x74a8ecc4c4 01-01 16:00:04.384 4100 4100 I Timeline: Timeline: Activity_launch_request time:187850991 01-01 16:00:04.413 4100 4100 D DecorView[]: getWindowModeFromSystem windowmode is 1 01-01 16:00:04.450 4100 4100 D FrameIndicator: support status: 1 0x74a8ecc018 0x74a8ecc4c4

xDoge26 commented 1 year ago

it only send mouse input something if i click it multipletime

gujjwal00 commented 1 year ago

I am out of town for couple of weeks, so can't help you much right now. Few questions though:

  1. Are you using an external mouse?
  2. Which OS are you using on your remote host?
  3. Any apps where AVNC is working correctly?
  4. AVNC version?

Thanks

xDoge26 commented 1 year ago

Im sure its avnc problem as this problem doesnt exist when i use realvnc viewer

  1. Not sure what are you talking about ?
  2. Tested on both mint 21.1 and termux proot distro
  3. Xfce gui work fine except some program like this game
  4. 2.0.4
gujjwal00 commented 1 year ago

Im sure its avnc problem as this problem doesnt exist when i use realvnc viewer

Sure, I believe you, but root cause still needs to identified before it can be fixed.

Not sure what are you talking about ?

Are you using an external mouse connected with USB to your Android device, or are you simply tapping on the touchscreen to send clicks?

Xfce gui work fine except some program like this game

Is this game freely available? If I can reproduce the issue locally that would greatly help in debugging the issue.

As you are running Linux, you can also use the xev utility to check that AVNC is generating events correctly.

xDoge26 commented 1 year ago

Are you using an external mouse connected with USB to your Android device, or are you simply tapping on the touchscreen to send clicks?

just simply tapping on the touch screen

xDoge26 commented 1 year ago

Also it doesnt work with this one too
https://store.steampowered.com/app/1418180/MUSICUS/

gujjwal00 commented 1 year ago

Is any of these games freely available? Does the problem happens only on Steam?

gujjwal00 commented 1 year ago

Can i help you debug .

Please run these two tests:

  1. Run xev in Mint/proot. Click on the white window couple of times, just like you would in a game. Now copy event logs generated by xev from terminal window.
  2. Go to Settings => Tools => Touch test in AVNC. Similar to previous test, just tap couple of times, and copy logs.

Attach these logs here. I am not 100% sure it will identify the issue, but it can help if something is peculiar about your device.

gujjwal00 commented 1 year ago

One more question, do these games have any sort of 'anti-cheat' mechanism?

xDoge26 commented 1 year ago

xev avnc.txt xev realvnc .txt avnc touch.txt

xDoge26 commented 1 year ago

One more question, do these games have any sort of 'anti-cheat' mechanism?

Its offline game

gujjwal00 commented 1 year ago

Can you please try the following APK: app-debug.zip

xDoge26 commented 1 year ago

Ok it works now. Thanks

gujjwal00 commented 1 year ago

So it looks like these programs can't (or deliberately don't) handle button-up event being generated immediately after button-down event. In the APK linked above, I added an artificial delay between events.

If you don't mind, I would like to do one more test to confirm my theory. You will need xdotool utility for this, which can be installed using apt in Mint. You should do this directly on your laptop/desktop, no need to use AVNC.

  1. Open a terminal window, and the game where input doesn't work.
  2. Run sleep 10 && xdotool mousedown 1 mouseup 1 in terminal, focus the game window, and keep the pointer positioned over the button which should be clicked. First sleep command should give you 10 seconds to focus the game window and position the pointer.
  3. Test again, but this time run sleep 10 && xdotool mousedown 1 sleep 0.2 mouseup 1. This will generate mouse-up event with 200ms delay.

If my theory is correct, no click should be detected in step 2.

xDoge26 commented 1 year ago

Is the problem fixed ?

gujjwal00 commented 1 year ago

Fixed in https://github.com/gujjwal00/avnc/commit/bb9dc41f50642ec6bb2aa890d2395b7b17885a12, Test APK. You will need to enable Send delayed click events in advanced server options.

So, this turned out to be 'interesting' 😀, and FWIW, this is not an issue in AVNC. The apps you mentioned are deliberately ignoring click events received before a certain timeout. The intention seems to be to stop people from fast forwarding through the story. I have added a optional workaround for now. It will not be enabled by default because it adds a 200ms delay between key events.

gujjwal00 commented 1 year ago

v2.1.0 is now available.