gujjwal00 / avnc

VNC Client for Android
GNU General Public License v3.0
680 stars 60 forks source link

v2.6.1: Android -> remote Clipboard sync does not work #256

Closed gothka404 closed 1 month ago

gothka404 commented 1 month ago

Hi, first I'd like to thank you for this awesome app. Came to conclusion this is the best available FOSS android app!

Everything worked smoothly except pasting clipboard from Android client to remote device. Clipboard sync from remote -> client works though.

Client environment:

Server environment:

Reproduction/observations:

Current workaround:

Let me know, if I can be of any assistance.

Related: https://github.com/gujjwal00/avnc/issues/231

gujjwal00 commented 1 month ago

Thanks for the detailed write-up and testing. Let me see if I can reproduce the issue.

In the meantime, can you please copy the logs from Settings -> Tools -> Logs, and paste here. You don't have to copy something in other app, if you type something in "Send text to server" box and copy it, AVNC should try to send it to server.

gothka404 commented 1 month ago

Sure:

Logs

```python --------- beginning of main 10-02 13:05:36.108 28412 28412 W logcat : type=1400 audit(0.0:11216): avc: denied { read } for name="u:object_r:userdebug_or_eng_prop:s0" dev="tmpfs" ino=374 scontext=u:r:untrusted_app:s0:c218,c256,c512,c768 tcontext=u:object_r:userdebug_or_eng_prop:s0 tclass=file permissive=0 app=com.gaurav.avnc 10-02 13:05:39.696 28349 28349 D VRI[PrefsActivity]: visibilityChanged oldVisibility=true newVisibility=false 10-02 13:05:39.708 28349 28349 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda11@feafa23 10-02 13:05:43.095 28349 28349 D nativeloader: Load /data/app/~~...==/com.gaurav.avnc-...==/lib/arm64/libnative-vnc.so using ns clns-1 from class loader (caller=): ok 10-02 13:05:43.120 28349 28420 D TrafficStats: tagSocket(90) with statsTag=0xffffffff, statsUid=-1 10-02 13:05:43.562 28349 28420 D TrafficStats: tagSocket(118) with statsTag=0xffffffff, statsUid=-1 10-02 13:05:43.563 28349 28420 D TrafficStats: tagSocket(118) with statsTag=0xffffffff, statsUid=-1 10-02 13:05:43.565 28349 28423 D TrafficStats: tagSocket(135) with statsTag=0xffffffff, statsUid=-1 10-02 13:05:43.587 28349 28370 W com.gaurav.avnc: Cleared Reference was only reachable from finalizer (only reported once) 10-02 13:05:43.667 28349 28349 D VRI[StartupActivity]: visibilityChanged oldVisibility=true newVisibility=false 10-02 13:05:43.673 28349 28379 D HWUI : endAllActiveAnimators on 0xb400c5f09e1cb400 (MaterialCardView) with handle 0xb400c4bf6d883c30 10-02 13:05:43.766 28349 28420 I NativeVnc: Received protocol version 3.8 10-02 13:05:43.766 28349 28420 I NativeVnc: VNC server supports protocol version 3.8 (viewer 3.8) 10-02 13:05:43.772 28349 28420 I NativeVnc: We have 1 security types to read 10-02 13:05:43.772 28349 28420 I NativeVnc: 0) Received security type 18 10-02 13:05:43.772 28349 28420 I NativeVnc: Selecting security type 18 (0/1 in the list) 10-02 13:05:43.772 28349 28420 I NativeVnc: Selected Security Scheme 18 10-02 13:05:43.773 28349 28420 I NativeVnc: OpenSSL version wolfSSL 5.7.2 initialized. 10-02 13:05:43.806 28349 28420 I NativeVnc: TLS session initialized. 10-02 13:05:43.806 28349 28420 I NativeVnc: We have 1 security types to read 10-02 13:05:43.806 28349 28420 I NativeVnc: 0) Received security type 2 10-02 13:05:43.806 28349 28420 I NativeVnc: Selecting security type 2 (0/1 in the list) 10-02 13:05:43.824 28349 28420 I NativeVnc: VNC authentication succeeded 10-02 13:05:43.867 28349 28420 I NativeVnc: Desktop name "GNOME" 10-02 13:05:43.867 28349 28420 I NativeVnc: Connected to VNC server, using protocol version 3.8 10-02 13:05:43.867 28349 28420 I NativeVnc: VNC server default format: 10-02 13:05:43.867 28349 28420 I NativeVnc: 32 bits per pixel. 10-02 13:05:43.867 28349 28420 I NativeVnc: Least significant byte first in each pixel. 10-02 13:05:43.867 28349 28420 I NativeVnc: TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0 10-02 13:05:43.895 28349 28426 W InteractionJankMonitor: Initializing without READ_DEVICE_CONFIG permission. enabled=false, interval=1, missedFrameThreshold=3, frameTimeThreshold=64, package=com.gaurav.avnc 10-02 13:05:43.900 28349 28420 I NativeVnc: rfbClientProcessExtServerCutText. default cap. 10-02 13:05:43.905 28349 28349 D CompatibilityChangeReporter: Compat change id reported: ...; UID 10218; state: DISABLED 10-02 13:05:43.954 28349 28420 I NativeVnc: Updated desktop size: ... 10-02 13:05:43.997 28349 28420 I NativeVnc: client2server supported messages (bit flags) 10-02 13:05:43.997 28349 28420 I NativeVnc: 00: 00ff 0081 0000 0000 - 0000 0000 0000 0000 10-02 13:05:43.997 28349 28420 I NativeVnc: 08: 0000 0000 0000 0000 - 0000 0000 0000 0000 10-02 13:05:43.997 28349 28420 I NativeVnc: 10: 0000 0000 0000 0000 - 0000 0000 0000 0000 10-02 13:05:43.997 28349 28420 I NativeVnc: 18: 0000 0000 0000 0000 - 0000 0000 0000 0008 10-02 13:05:43.997 28349 28420 I NativeVnc: server2client supported messages (bit flags) 10-02 13:05:43.997 28349 28420 I NativeVnc: 00: 001f 0080 0000 0000 - 0000 0000 0000 0000 10-02 13:05:43.997 28349 28420 I NativeVnc: 08: 0000 0000 0000 0000 - 0000 0000 0000 0000 10-02 13:05:43.997 28349 28420 I NativeVnc: 10: 0000 0000 0000 0000 - 0000 0000 0000 0000 10-02 13:05:43.997 28349 28420 I NativeVnc: 18: 0000 0000 0000 0000 - 0000 0000 0000 0000 10-02 13:05:43.997 28349 28420 I NativeVnc: Connected to Server "GNOME Remote Desktop (VNC) (LibVNCServer 0.9.14)" 10-02 13:05:44.000 28349 28421 D ShaderCompiler: 10-02 13:05:44.000 28349 28421 D ShaderCompiler: 10-02 13:05:44.001 28349 28421 D ShaderCompiler: 10-02 13:05:52.430 28349 28349 W Choreographer: Frame time is 0.064705 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase. 10-02 13:05:53.995 28349 28349 D VRI[VncActivity]: visibilityChanged oldVisibility=true newVisibility=false 10-02 13:05:54.003 28349 28379 D HWUI : endAllActiveAnimators on 0xb400c5f09e2ddc00 (StateListDrawable) with handle 0xb400c4bf6d989960 10-02 13:06:08.009 28349 28421 D ShaderCompiler: 10-02 13:06:08.009 28349 28421 D ShaderCompiler: 10-02 13:06:08.010 28349 28421 D ShaderCompiler: 10-02 13:06:13.794 28349 28349 I ImeTracker: com.gaurav.avnc:4a00275c: onRequestShow at ORIGIN_CLIENT reason SHOW_TOGGLE_SOFT_INPUT fromUser false 10-02 13:06:13.795 28349 28349 D InputMethodManager: showSoftInput() view=com.android.internal.policy.DecorView{7041cab V.E...... R......D 0,0-1080,2264 aid=2}[VncActivity] flags=0 reason=SHOW_TOGGLE_SOFT_INPUT 10-02 13:06:13.853 28349 28349 D InsetsController: show(ime(), fromIme=true) 10-02 13:06:14.059 28349 28349 I ImeTracker: com.gaurav.avnc:4a00275c: onShown 10-02 13:06:24.036 28349 28349 D InsetsController: hide(ime(), fromIme=true) 10-02 13:06:24.038 28349 28349 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=ImeCallback=ImeOnBackInvokedCallback@255931769 Callback=android.window.IOnBackInvokedCallback$Stub$Proxy@a51629e 10-02 13:06:24.251 28349 28349 I ImeTracker: com.gaurav.avnc:ee701f10: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT_ON_ANIMATION_STATE_CHANGED fromUser false 10-02 13:06:24.252 28349 28349 I ImeTracker: com.android.inputmethod.latin:3aaa3027: onHidden 10-02 13:06:25.987 28349 28349 D VRI[VncActivity]: visibilityChanged oldVisibility=true newVisibility=false 10-02 13:06:26.028 28349 28349 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda11@b942198 10-02 13:06:29.066 28349 28349 D VRI[StartupActivity]: visibilityChanged oldVisibility=true newVisibility=false 10-02 13:06:29.078 28349 28379 D HWUI : endAllActiveAnimators on 0xb400c5f09e1a5000 (RippleDrawable) with handle 0xb400c4bf6d893fc0 10-02 13:06:31.016 28349 28349 W WindowOnBackDispatcher: OnBackInvokedCallback is not enabled for the application. 10-02 13:06:31.016 28349 28349 W WindowOnBackDispatcher: Set 'android:enableOnBackInvokedCallback="true"' in the application manifest. 10-02 13:06:32.325 28689 28689 W libc : Access denied finding property "ro.debuggable" 10-02 13:06:32.320 28689 28689 W logcat : type=1400 audit(0.0:11340): avc: denied { read } for name="u:object_r:userdebug_or_eng_prop:s0" dev="tmpfs" ino=374 scontext=u:r:untrusted_app:s0:c218,c256,c512,c768 tcontext=u:object_r:userdebug_or_eng_prop:s0 tclass=file permissive=0 app=com.gaurav.avnc ```

Thank you very much for the quick support.

gujjwal00 commented 1 month ago

It looks like a bug in extended clipboard implementation of LibVNCClient (VNC library used by AVNC), but it will take some time to find the root cause.

gothka404 commented 1 month ago

Interesting, thanks for the status update! Take your time, I (probably) won't be of any help debugging this lib.

gujjwal00 commented 1 month ago

So this is actually a bug in Gnome Remote Desktop. GRD doesn't handle UTF8 clipboard text, but still advertises support for it. When AVNC sends UTF8 clipboard text, GRD silently discards it. Remmina works because it is not sending UTF8 text ( try to copy some emojis ).

You can open a issue in GRD repo if you want. It's a relatively easy fix because internally GRD already uses UTF8. I will try to send a patch if I can find some time.

gothka404 commented 1 month ago

@gujjwal00 Awesome!

Unfortunately I needed to wipe my testing machine. When having time, I will reinstall it, test out UTF-8 clipboard text handling with my environment, create an issue in https://gitlab.gnome.org/GNOME/gnome-remote-desktop and report that back to you, so you might add technical details beyond bare user story and possibly link a patch to it.

Alternatively feel free to create the issue yourself, if it makes sense for you to directly add technical details.

Having sorted this error out, AVNC definitely is the way to go for me with GRD >= 47 (with VNC support), as best mobile client from all RDP + VNC apps available.

Thanks again very much for having gone this debugging route!

gothka404 commented 1 month ago

@gujjwal00 Created issue

gujjwal00 commented 1 month ago

Thanks @gothka404