2

The project that I am working on in our company makes use of some system permissions. This is achieved by:

  • Adding the following line to the manifest: android:sharedUserId="android.uid.system".
  • Signing the app with our platform key.
  • Placing the app in the /system/app/ folder during our ROM creation process.

The device we use is not rooted by default so to update the APK we have to recreate the ROM with the new APK in place which is a very time consuming process. From what I understand, this is because, without root privileges, I can't write to /system/app.

As a proof of concept, I created an app that restarts the device when you press a button which makes use of the "android.permission.REBOOT" system level permission. I achieved this by:

  • Adding the following line to the manifest: android:sharedUserId="android.uid.system"
  • Signing the app with our platform key.

Then I simply loaded the proof of concept app using ADB which places the app in the user apps folder, /data/app, and it worked just fine. I did not need to place it in /system/app for it to work. In addition, if I created a ROM without our app in it, and tried to load our app with ADB, it worked just fine in the /data/app folder.

So my question is: Is it necessary to place the app in /system/app if you're using system permissions or is the user app folder, /data/app, sufficient? If the /data/app folder is sufficient, then what do you accomplish by putting your app in the /system/app folder? Other than preventing users from deleting the app for instance.

The answers I found were somewhat contradictory, this does not mention the /system/app folder. This says it's part of the process.

Community
  • 1
  • 1
Daniel
  • 2,355
  • 9
  • 23
  • 30

1 Answers1

0

I don't have an official source, but on a custom Android 10 system I was able to do this and it worked.

  • Had the vendor sign my app with the root cert
  • My manifest had the android:sharedUserId="android.uid.system
  • Installed the signed .apk using adb to the regular /data directory
  • This worked and gave me the system level permission I needed (BLUETOOTH_PRIVILEGED)