Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporate ADB lib to work around devices with gesture api disabled #24

Open
virresh opened this issue Oct 30, 2021 · 6 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@virresh
Copy link
Owner

virresh commented Oct 30, 2021

ADB lib - https://github.com/tananaev/adblib

This would send shell input commands directly to the input jar on devices with wireless adb enabled.

@virresh virresh added the enhancement New feature or request label Oct 30, 2021
@sweenwolf
Copy link
Contributor

@virresh
Copy link
Owner Author

virresh commented Nov 13, 2021

Oh damn, I thought it'd be fast enough on localhost. Thanks for the PoC though.

Seems like the input.jar itself introduces some delay and combined with network it lags a lot.

Some more poking around yields this - https://android.googlesource.com/platform/frameworks/base/+/android-4.4.2_r1/cmds/input/src/com/android/commands/input/Input.java#247

We can use those private methods and call the input API directly to remove any lag at all without root, however, SELinux policies will block us on the INJECT_EVENT permission. I can't think of a way without root to achieve this 😞

@ybtag
Copy link

ybtag commented Feb 28, 2022

This method only works for me (on the Sonim XP3plus flip phone) after connecting to the phone with USB adb and sending adb tcpip 5555. Until then the adb daemon on the phone only listens on USB, not TCPIP, and MATVT can't connect to it.

The way around it would seem to be with Wireless ADB, but on Android 11 there are two problems with this: The daemon listens on random ports, and the client needs to provide a pairing code in order to connect. The tananaev library doesn't provide this functionality, and in fact seems to be outdated and a dead project.

This is really more of an issue with tananaev'a adblib. Thank you again @virresh for your creative solution to use this library to get around the Android 11 issues.

@virresh
Copy link
Owner Author

virresh commented Mar 1, 2022

Oh I see. Randomized ports are definitely painful :(

There might yet be another work-around for that by re-implementing the whole ADB protocol in a java library (I saw some libraries that do this), write a usb emulation driver and then invoke adb tcpip <fixed_port> command via the Java interface.

But all that is kinda tedious to maintain. It has several loop holes and too much dependency which might break easily which is very hard to maintain. Mentioning this possibility here just in case someone is interested in hacking around on this idea further.

@ybtag
Copy link

ybtag commented Aug 14, 2022

Just noticed a solution to the port problem here. I will try to implement it in my branch

@virresh
Copy link
Owner Author

virresh commented Aug 31, 2022

Oh, interesting.
Let me know what results you get with the workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants