Permission Elevation method:
One way:
1, add android:shareduserid= "Android.uid.system" in the Manifest node in Androidmanifest.xml.
2, add the program on the virtual machine can not be used directly. But you can compile it into apk with Eclipse.
3, (This step is not executed) compiled into APK after the use of compression tools to open APK, the Meta-inf directory cert.sf, CERT. RSA two files deleted.
4, the use of Android with the signature tool Signapk.jar and the source code in the Platform.x509.pem,platform.pk8 to apk to re-sign.
Execution: Java-jar signapk.jar platform.x509.pem platform.pk8 old.apk new.apk after execution new.apk is the signed file.
(Note: When executing a command, all files are placed in the same directory, and if not in the same directory, modify the path).
File Platform.x509.pem and Platform.pk8 we can find in the build/target/product/security of the source code. Signapk.jar can be compiled build/tools/signapk/get.
5, after the signature can be installed using the
The second method:
1, add android:shareduserid= "Android.uid.system" in the Manifest node in Androidmanifest.xml.
2, directly in the source code compiled, Android add local_certificate: = Platform
The two method signatures may result in the inability to manipulate files in the SDcard directory.
Actions that require elevated privileges:
1. System reboot:
Copy Code code as follows:
PowerManager pmanager= (PowerManager) Mcontext.getsystemservice (Context.power_service);
Pmanager.reboot ("");
2. write files to cache partition/cache
3, modify the system time
......