termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
2.14k stars 314 forks source link

InterceptorKey not working in most cases #418

Closed IntinteDAO closed 1 year ago

IntinteDAO commented 1 year ago

I do not know what data is needed. Well, on the Moto G100 it seems that InterceptorKey works very infrequently and is easily disabled. I don't know what realistically depends on whether it works properly or not.

In my opinion, this function should work when the mouse is "captured" by Termux X11 and disable when the mouse is "released" to Android.

Unfortunately, I had quite a problem with the operation, which I put in the video. Maybe I misunderstand the operation of this function.

Log (very big ... sorry) https://notebin.de/?45deb54a519fd342#G6dfkwaxYhbe4bSiPoeasBsk7mWtsQpBHypXn4P8WT4M

Movie: https://tube.midov.pl/w/vb8camrqsPNsUdwx13kYsL

twaik commented 1 year ago

Check the latest build.

IntinteDAO commented 1 year ago

Maybe partially fixed, but not fully

https://cpaste.org/?90051cf7b3ab1367#4fKxbLtZ3DKCLid2dscaZHrDHhsmKa1czDj8HLSPJBYD

1) Auto Interceptor doesn't work, you have to manually launch on my phone. 2) It works usually nice, but some tasks can disable Interceptor, like notifications, sometimes minimize etc

Movie: https://tube.midov.pl/w/xbGqLyhZsdbdkNaXscKh1i

twaik commented 1 year ago

KeyInterceptor should work only when Termux:X11 activity is focused. So it should not work while you are opening notifications or minimize the activity. I did it intentially to avoid situations where someone switches activity to, lets say, browser or messenger and can not type there.

twaik commented 1 year ago

Why are you going to settings through package settings? You have a shortcut. image

IntinteDAO commented 1 year ago

Why are you going to settings through package settings? You have a shortcut. image

Yep, I should report it. Doesn't work with Adaway (or just doesn't work). If I choose Preferences, I received Adaway Preferences instead Termux X11 (but only on Desktop Mode)

twaik commented 1 year ago

Yep, I should report it. Doesn't work with Adaway (or just doesn't work). If I choose Preferences, I received Adaway Preferences instead Termux X11 (but only on Desktop Mode)

It is pretty weird, I did not found any information about it. Maybe it is some kind of firmware-related bug.

Ok, now it should send intercepted events only when activity is really focused. app-arm64-v8a-debug.zip

twaik commented 1 year ago

Fixed sending events that should not be intercepted... app-arm64-v8a-debug.zip

twaik commented 1 year ago

@IntinteDAO ?

IntinteDAO commented 1 year ago

@IntinteDAO ?

Sorry, I think the USB-C cable is dead and I can't check it now ;( Give me ~1h

IntinteDAO commented 1 year ago

@twaik Sadly it's even worse I think? https://pastebin.linqhost.nl/?1649915eda4c0fef#DrF7seRqq1AWZYLcT74gGZbUp3GjA5XmcebMXXXpvtEF

Do you need movies or just log?

twaik commented 1 year ago

A video will be better.

twaik commented 1 year ago

Ok, I see an exception.

twaik commented 1 year ago

app-arm64-v8a-debug.zip Try this one.

twaik commented 1 year ago

app-arm64-v8a-debug.zip

IntinteDAO commented 1 year ago

The InterceptorKey works, yay But I think the Interceptor (automatic) doesn't work propertly and crash Termux X11. In short it's even crash on Termux without Termux X11.

Not sure if full logcat can help you

https://tube.midov.pl/w/6N37RSftGzXwEAprhCzoKX

Log: https://p.darklab.sh/?8174dfef9fee59a6#mvizTVAdsp2NcM3mHL5zWuV4T7QyVo5gLiHCciSpuyh

twaik commented 1 year ago

image

IntinteDAO commented 1 year ago

@twaik Sorry, but maybe this file was too big (7MB), it's logcat https://paste.tildeverse.org/?2ee4fc9941040e91#947oRQGmx8zupQGXwymBrgoWrBuGgJWqrMxj5HKd6ugi

twaik commented 1 year ago

app-arm64-v8a-debug.zip

IntinteDAO commented 1 year ago

Ok, no crashing, but only manual InterceptorKey enable works. Auto doesn't work. It's enabled in accessibility menu, but with status "Not working. Click to get info", but there is no info

I don't think there is something in the log about it, but maybe you will find something in logcat.

But the manual works flawlessly

https://privatebin.arch-linux.cz/?91db457aded2e1c1#6bpUYPvXDhWgqVv2K6Jhb2k21ZGdBs18Y9oRneD5uEYS

twaik commented 1 year ago

Unfortunately I did not find the cause of this in logcat. Sad. So I am merging this.

twaik commented 1 year ago

@zanfix @xaverm can you please test if the binary has correct German layout handling?

IntinteDAO commented 1 year ago

Unfortunately I did not find the cause of this in logcat. Sad. So I am merging this.

Can this only be managed at the phone's autostart? Can Termux itself turn on the Interceptor? Because maybe this way can be bypassed somehow.

If not, too bad :P

twaik commented 1 year ago

@IntinteDAO Maybe we can do something else. Can you please do the following?

  1. Enter LoriePreferences and disable automatic enabling of accessibility service.
  2. Make system-wide logcat -c to clear logcat buffers.
  3. Enable automatic enabling of accessibility service.
  4. Get logcat.

Clearing logcat buffers should let you get shorter log. Reading 4.1 MB of logs is not the funniest thing in the world, searching there keywords like KeyInterceptor and Accessibility also did not work.

twaik commented 1 year ago

Actually I have an idea. app-arm64-v8a-debug.zip Check it out.

IntinteDAO commented 1 year ago

Not working ;( I reduced a little of logcat, but not sure if it has something https://paste.hostux.net/?6fb221b962770f8f#26YK5NS3EQMZV5EUHNJgtTDtadTfidQDfF2GmsXE5QKP

Or wait 5 minutes

twaik commented 1 year ago

No data related to the cause of issue in this log.

Try the following thing.

  1. Disable KeyInterceptor in Accessibility Settings.
  2. Do settings list secure in adb shell and save to a file.
  3. Enable KeyInterceptor in Accessibility Settings.
  4. Do settings list secure in adb shell again and save to a second file.
  5. Post here both files.

Maybe I simply can enable something else to fix this, but I will not know what exactly without these two files.

IntinteDAO commented 1 year ago

Ok. Maybe it's useful, maybe not, but if I disable and enable button for automatical, I received an error in Termux X11 log. Maybe it should be there.

https://pastebin.linqhost.nl/?73c03dc0d9060b08#GSxdajVUQpXPcpgXzgfgQNc8FKzt6n2P28Bs6N5jo1EW

Anyway, now in Accessibility I have that Termux X11 KeyInterceptor works (but it isn't in Termux X11).


Settings List Secure: Disable: https://bin.0xfc.de/?aebdb062d59d0e66#24P5YhHwxidbio4juheUDd7a6FiYBWu1s8o39nafoDen Enable: https://bin.0xfc.de/?353bfc82f4331534#BH7nTHkwC1c2gGTddvmXuNhZY6mZmzpD269RH5knJhZr

twaik commented 1 year ago

I received an error in Termux X11 log. Maybe it should be there.

It is pretty harmless.

Settings List Secure: Disable: https://bin.0xfc.de/?aebdb062d59d0e66#24P5YhHwxidbio4juheUDd7a6FiYBWu1s8o39nafoDen Enable: https://bin.0xfc.de/?353bfc82f4331534#BH7nTHkwC1c2gGTddvmXuNhZY6mZmzpD269RH5knJhZr

Ok, nothing except accessibility_enabled and enabled_accessibility_services changed, as expected. But it still does not work. It looks like a vendor-specific bug.

IntinteDAO commented 1 year ago

@twaik Found a probably solution In short (as I understand) auto InterceptorKey runs now (after your upgrades):

If the phone starts, it run InterceptorKey, it's on, but it doesn't work. But when I disable it, run Termux, and Termux X11 run then InterceptorKey, it works.

twaik commented 1 year ago

As far as I know it should not start at device boot. I did not write such a behaviour. It should only be started when Termux:X11 activity starts...

IntinteDAO commented 1 year ago

@twaik

Yes, you are right. It looks like it's Android (Motorola?) that turns on all the features in recently used items. So if the KeyInterceptor was used by Termux X11 and not disabled, Android will run it at startup.

If this can be fixed, then presumably at startup Termux X11 would have to turn off the interceptor if auto start is enabled and turn it on.

twaik commented 1 year ago

Actually I can do something that like. Check it out.

app-arm64-v8a-debug.zip

IntinteDAO commented 1 year ago

@twaik Works!!

twaik commented 1 year ago

I'll close the issue with commit...