In my application, I need to start a native binary that opens and read from some /sys/kernel files
. If I launch the native binary by connecting using adb shell (launching manually from /data/local/tmp
), then everything works fine.
I would like the App to programmatically do two things,
Copy the binary to
/data/local/tmp/
. Again this wont work as the normal android app doesnt have enough privileges.Start the binary as a shell user so I can have the necessary privileges. I have tried using
android:sharedUserId="android.uid.shell
, but that doesnt seem to work.
Please note that I don't need root to open the /sys
files.
All I need is to be shell user.
Any thoughts will be greatly appreciated.
Thanks
The
shell
UID is reserved for development and testing. Running an app withshell
privileges is circumventing Google's security model. So you will not be able do it on a secured commercial device without rooting it.A possible temporary (non-persistent between reboots) workaround would be:
Use
adb shell
to start a background service process, running as shell UIDIn your application, using IPC to ask the service to perform special task for you