If a third-party application wants to obtain system permissions, it needs to declare its UID as a system process in the AndroidManifest.xml
file, and the application needs to be signed with the platform key (signature).
The third-party application's AndroidManifest.xml must include:
android:sharedUserid="android.uid.system"
1. Put the APK in the application directory, and create an Android.mk
file containing the following contents:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # module name should match the apk name LOCAL_MODULE := XXXX LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(LOCAL_MODULE).apk LOCAL_MODULE_CLASS := APPS LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) LOCAL_PRIVILEGED_MODULE := true # use the application's own signature # LOCAL_CERTIFICATE := PRESIGNED # sign with the platform key LOCAL_CERTIFICATE := platform include $(BUILD_PREBUILT)
2. Add the name of your APK XXXX
into the compile file.
PRODUCT_PACKAGES +=\ Bluetooth \ XXXX
3. Recompile the SDK, and the APK file will be generated in the out
directory, containing the platform key.
1. According to your SBC model and system version, download the two platform key files platform.x509.pem and platform.pk8.
2. Download the Java Signing Tool signapk.jar.
3. Download the library-dependency libconscrypt_openjdk_jni.so and put it in the signlib
directory.
4. Install the JDK Tool.
5. Execute the shell command:
java -Djava.library.path=signlib -jar signapk.jar platform.x509.pem platform.pk8 unsigned.apk signed.apk