Arian04 / android-hid-client

Android app that allows you to use your phone as a keyboard and mouse WITHOUT any software on the other end (Requires root)
GNU General Public License v3.0
109 stars 4 forks source link

Which is the minimum supported android version? #26

Closed wokawoka closed 2 months ago

wokawoka commented 2 months ago

Hello, last week I tried to install this apk to an old rooted phone that I had on hand which is running android 8 Oreo and I couldn't install the apk. As the title suggests, which is the minimum supported version of android? Thank you very much for this very useful piece of software!

Arian04 commented 2 months ago

android 10 is the minimum version, but that was an arbitrary choice from back when I first started making the app. I'll try to see the ramifications of lowering it. if it's not a problem I'll lower it to at least 8, but maybe further too.

if you want to get it running right now rather than waiting for me to get to it (and you know how to use android studio), you can lower the minSDK yourself and build the app. or if you're fine with basically being a beta tester, I could quickly build the app with a lower minSDK, send it here, and you could see if it works well.

wokawoka commented 2 months ago

android 10 is the minimum version, but that was an arbitrary choice from back when I first started making the app. I'll try to see the ramifications of lowering it. if it's not a problem I'll lower it to at least 8, but maybe further too.

if you want to get it running right now rather than waiting for me to get to it (and you know how to use android studio), you can lower the minSDK yourself and build the app. or if you're fine with basically being a beta tester, I could quickly build the app with a lower minSDK, send it here, and you could see if it works well.

Thank you very much for your reply! Lowering the support to android 8 would be great and totally enough for my case. Unfortunately the only rooted phone that I have on hand run a system that is so old, but I'm planning to root my main phone as well, as soon as I'll have time

Unfortunately, I don't have any experience with android studio, but I can wait as much time as you need, obviously. The I'll gladly test it and report back. Thank you very much again

Arian04 commented 2 months ago

I just built a debug APK with a minSDK of 27 (Android 8). Github doesn't let me attach APK files to issues, so the link below points to my web server, where I'm temporarily gonna make the file available.

APK file

edit: by the way, that's not signed with my main signing key, which just means that if you ever install this app from the Github release page, you'll have to uninstall this debug version beforehand.

Thanks for testing this!

wokawoka commented 2 months ago

Thank you very much for the superquick feedback. I tried to install the apk and it refused to install since the beginning throwing a "There was a problem parsing the package" error. On a rooted stock Motorola Android 8.0.0 system.

Arian04 commented 2 months ago

thats weird, I usually only see that when downloads get corrupted. I also just downloaded and tested the file and it worked fine. however, i did just realize that you specifically said Android 8.0.0, and I believe API level 27 is Android 8.1, so that's my bad.

new link: https://files.arianb.me/android-usb-hid-client-debug.apk

edit: apparently that error is known to also happen when your android version is too low. guess i learned something.

wokawoka commented 2 months ago

Thank you. Now I was able to install the APK, but the app crashes as soon as I launch it. Unfortunately I'm not able to send any log about that, but in case I'm available to try to look into it if you have the time to guide me

Arian04 commented 2 months ago

hmm. I was hoping it would be easy. since there are actual problems, I'll have to do some testing. if it's an application crash on start, it shouldn't have anything to do with root, so I'll try it out in an emulator later.

it gives me a good reason to set up automated testing tho, which is probably a bit overdue tbh.

thanks for the details, and I'll ping you on this issue when I get a chance to test it!

wokawoka commented 2 months ago

Thank you and don't worry. I plan to root my main android 13 phone soon anyway. But if you are interested in backward compatibility I am always ready to test as soon as you get the chance

Arian04 commented 2 months ago

i think i found a bug in v2.0.0 and up of my app that impacted all android versions below Android 12. So in a bit when I can push the fix, i'll give you a link to the Github Actions artifact download link so you can test it. once I get a chance to push and send you the link, my earlier note about this being a debug version of the app still applies by the way.

... if you ever install this app from the Github release page, you'll have to uninstall this debug version beforehand.

Arian04 commented 2 months ago

got sidetracked but here it is: https://github.com/Arian04/android-hid-client/actions/runs/8587437156/artifacts/1391735684

edit: also if it doesn't work, we can reopen this issue

wokawoka commented 2 months ago

I took a while to reply because at the moment I'm travelling. Unfortunately I'll not be able to test the apk until I'll be back in about a week. But I'll report back as soon as I'll be able to. Thank you again for your work

Arian04 commented 2 months ago

no problem! it might even be in the next release by then since I tested it through the emulator and it seems to work fine

wokawoka commented 2 months ago

I came back from my trip and I was able to install the actual version (2.2.1) on my old Android 8 phone (rooted with magisk 27.0). The app starts up correctly now, it correctly requests superuser rights and is included in the magisk list of the apps that has superuser rights but, as soon as I try to type something with the keyboard (unexpected keyboard, as suggested), I receive an "ERROR: failed to create character device". I guess that this issue might be limited to my specific configuration (the app itself seems to work fine now), but do you by chance have some suggestions on how I could fix the error and have the app working correctly? Thank you very much again

Arian04 commented 2 months ago

I would probably manually mess with the character device in termux or via ADB in a root shell, but that's not a super straightforward thing to do. You could also install USB Gadget tool (another open source app) and take a screenshot of the main page it shows you when you open it. I've been meaning to improve the debugging experience for people facing issues with actual character device creation, but the problem is I have two devices that don't have any issue with that and emulators don't simulate the quirks between devices kernels. I haven't been able to find a way to fully virtualize android device kernels for testing purposes either.

really what I need to do is improve my logging debugging/logging settings code but I've been busy and didn't get to mess with it as much as I wanted to. I can ping you once I make progress on that if you want.

wokawoka commented 2 months ago

I would probably manually mess with the character device in termux or via ADB in a root shell, but that's not a super straightforward thing to do. You could also install USB Gadget tool (another open source app) and take a screenshot of the main page it shows you when you open it. I've been meaning to improve the debugging experience for people facing issues with actual character device creation, but the problem is I have two devices that don't have any issue with that and emulators don't simulate the quirks between devices kernels. I haven't been able to find a way to fully virtualize android device kernels for testing purposes either.

I installed USB gadget tool and took the screenshot I also copied the log, in case it can help

image

log: ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONSACTIVE=$(basename $(readlink "$@"))' {} \;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget// CONFIG_PATH=/config/usb_gadget///configs/acct/ Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory : [1]: cd: /config/usb_gadget/: No such file or directory root - length=1; index=1 ROOT - Execute command: echo KERNEL_VERSION=(uname -r |cut -d '-' -f1 ) && (gunzip -c /proc/config.gz | grep -i configfs | sed 's/# //; s/ is not set/=NOT_SET/')

ROOT (stdout) - KERNEL_VERSION=3.18.71

ROOT (stderr) - : [1]: gunzip: not found ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONSACTIVE=$(basename $(readlink "$@"))' {} \;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget// CONFIG_PATH=/config/usb_gadget///configs/acct/ Error - not able to change dir to /config/usb_gadget/*/... exit

ROOT (stderr) - : [1]: cd: /config/usb_gadget//configs: No such file or directory : [1]: cd: /config/usb_gadget/: No such file or directory root - length=1; index=1 ROOT - Execute command: for dir in /config/usb_gadget//; do echo GADGET_PATH=$dir; cd $dir/configs/; echo CONFIG_PATH="$dir/configs/ls -1 | head -1/"; cd $dir; if [ "$?" -ne "0" ]; then echo "Error - not able to change dir to $dir... exit"; exit 1; fi; echo UDC=$(cat UDC); find ./configs/ -type l -exec sh -c 'echo FUNCTIONSACTIVE=$(basename $(readlink "$@"))' {} \;; for f in ./functions//; do echo FUNCTIONS=$(basename $f); done; cd ./strings/0x409/; for vars in *; do echo ${vars}=$(cat $vars); done; echo "============="; done;

ROOT (stdout) - GADGET_PATH=/config/usb_gadget/g2/ CONFIG_PATH=/config/usb_gadget/g2//configs// UDC= FUNCTIONS=* UDC= bDeviceClass=0x00 bDeviceProtocol=0x00 bDeviceSubClass=0x00 bMaxPacketSize0=0x00 bcdDevice=0x0318 bcdUSB=0x0000 configs= functions= idProduct=0x0000 idVendor=0x0000 os_desc= strings=

=============

ROOT (stderr) - : [1]: cd: /config/usb_gadget/g2/strings/0x409: No such file or directory cat: configs: Is a directory cat: functions: Is a directory cat: os_desc: Is a directory cat: strings: Is a directory

wokawoka commented 2 months ago

really what I need to do is improve my logging debugging/logging settings code but I've been busy and didn't get to mess with it as much as I wanted to. I can ping you once I make progress on that if you want.

Of course, I would be glad to help you out whenever you will have the time to improve the logging features of the app. Thank you again

Arian04 commented 2 months ago

just wanted to let you know I moved this to another issue so it can be open and I can keep track of things easier (and not forget about it)

wokawoka commented 2 months ago

just wanted to let you know I moved this to another issue so it can be open and I can keep track of things easier (and not forget about it)

sure, thank you very much