App USB permission
Hello! I use a DAB receiver with an app on Rpi. After each restart of the system Android asks me for permission to access the USB stick. If I have agreed, then it will not ask, until the restart of Android. The checkbox „as default“ shows no effect. The app rights are enabled in the settings. This Problem is also with other devices. Iam not an Android expert, but is there any solution for it? Thank you very much
Tagged:
0
Comments
Yeah, it is Android's special security feature. I don't know if it would be a good idea to remove it.
See also:
Hi! This instruction https://stackoverflow.com/questions/13726583/bypass-android-usb-host-permission-confirmation-dialog/30563253#30563253 tells to disassemble the classes.dex file from SystemUI.apk, but Emteria's SystemUI.apk don't have classes.dex inside... Where UsbPermissionActivity can be, other than in SystemUI.apk? I took SystemUI.apk from Emteria's /system/priv-app/SystemUI/SystemUI.apk
Could someone please describe the full process we can use to reproduce this issue in our lab?
Here how I done it in Cyanogenmod 13:
Download smali and backsmali: https://bitbucket.org/JesusFreke/smali/downloads/
Disassemble classes.dex to smali:
/home/user/Desktop/test2/com/android/systemui/usb/UsbPermissionActivity.smali
with text editor and find the line that says:
change this by commenting it out and adding two new lines:
And Android permission to access the USB stick are granted forever.
Now for doing that on Emteria:
There is no classes.dex in SystemUI.apk
If I try to disassemble whole SystemUI.apk:
backsmali gives me error:
Telling me that classes.dex is needed to disassemble SystemUI.apk and I need classes.dex to find UsbPermissionActivity.smali inside.
Where can I find UsbPermissionActivity other than in SystemUI.apk?
System apps are shipped preoptimized in ODEX format in /system/priv-app/SystemUI/oat/arm/SystemUI.odex.
We can disable this permission window globally, but first I'd need an application and an USB device to test it here.
I'll try to deodex SystemUI.odex. Maybe it is possible to add a new option in Emteria to a select disable/enable USB permissions globally?
@mr666acdc, yes maybe this would work. I'll check it.
I gave up deodexing and I set up app called "Automate" to automatically click "OK" button after reboot and every time SystemUI permission window appear. If someone need example I can post instruction.
We performed several tests and there seem to be two different solutions:
1) We modify the OS to disable the permission dialog completely. This may introduce an important security issue, since all apps will be able to access all USB devices.
2) The used application is made direct boot aware. This seems to be the correct approach. With this flag, our test application was saved by default and Android never asked for the permission again (after reboot or not).