The first method is simple, but it needs to be compiled with make in the context of the Android system source code:
1. 在应用程序的AndroidManifest.xml中的manifest节点中加入android:sharedUserId="android.uid.system"这个属性。 2. 修改Android.mk文件,加入LOCAL_CERTIFICATE := platform这一行 3. 使用mm命令来编译,生成的apk就有修改系统时间的权限了。
The second method is troublesome, but do not need to open the virtual machine to the source environment with make to compile:
1. 同上,加android:sharedUserId="android.uid.system"这个属性。 2. 使用eclipse编译出apk文件,但是这个apk文件是不能用的。 3. 使用目标系统的platform密钥来重新给apk文件签名。这步比较麻烦,首先找到密钥文件,在我的Android源码目录中的位置是"build\target\product\security",下面的platform.pk8和platform.x509.pem两个文件。然后用Android提供的Signapk工具来签名,signapk的源代码是在"build\tools\signapk"下,用法为"signapk platform.x509.pem platform.pk8 input.apk output.apk",文件名最好使用绝对路径防止找不到,也可以修改源代码直接使用。
1 Creating a Directory
2 organize the necessary files:
Key file: Enter Build/target/product/security to find the key used by default for "Platform.pk8" and "Platform.x509.pem" system.
signapk tool: Enter build\tools\signapk to find Signapk.java, run Javac or direct mm compile.
Signapk.jar Source Location build/tools/signapk, the file path generated after compilation: Out/host/linux-x86/framework/signapk.jar
3. Execution command: Java-jar signapk.jar platform.x509.pem platform.pk8 your.apk your_signed.apk
The meaning of this command is: by Signapk.jar this executable jar package, "PLATFORM.X509.PEM" This public key file and "Platform.pk8" This private key file to the "your.apk" signature, the signed file is saved as "your_ signed.apk ".
Finally explain the principle, first add android:shareduserid= "Android.uid.system" this attribute. With the shared user ID, multiple apk with the same user ID can be configured to run in the same process. Then the UID of the program into a android.uid.system, that is, to let the program run in the system process, so that there is permission to modify the system time.
Android to System sign apk