问题
I made a filemanager that I want go be able to navegate/modify some system folders (say, /data/
). I copied my apk to /system/app, gave 644 permission to the apk file, and rebooted. Yet, my app is still run without root privileges (deny simple access to /data
). I'm using Cyanogenmod 11.
Any clue?
Thanks!
L.
回答1:
To clarify, the app being in the /system/app
folder does not run it as root
. Android is linux based, so having root access means that your app is able to run shell commands as the root user.
Generally speaking an app being in the /system/app
folder makes all declared permissions available to it, (for example, declaring WRITE_SECURE_SETTINGS
only does anything for system apps), and then the code that was only available to system apps is now available to yours as well.
For reliability, you should use shell commands where possible for anything that's normally unavailable. Do not use java.io.File
to access files that are normally restricted.
I would recommend using RootTools as it makes running shell commands as root much easier. The first 3 pages on this linux command cheat sheet will probably cover everything you need.
来源:https://stackoverflow.com/questions/25799038/failed-running-an-app-as-root