What is the right way to turn an app into a system app under Android Oreo and above?

3.9k Views Asked by At

I have tried several methods to turn an app into a system app but even if in some case I managed to install the app inside /system/priv-app the app was not running as a system app as I could figure out by checking running the command "adb shell ps". So please could someone tell me if I missed something or if there is some limitation linked to Lineage or may be Magisk or TWRP to have an app runing as a system app ?

I have tried with Lineage 15.1 (Oreo) and magisk 21.2 the phone is a Samsung S5 using TWRP 3.5.0_9-0 as system Recovery First method was to

1 making a copy of the app folder to the internal storage

2 renaming that copied Folder with a short name without dot (like renaming com.example.myapp folder to Myapp Folder)

3 renaming the apk from base.apk to Myapp.apk

4 uninstalling the app

5 under TWRP recovery mode mount the system partiton and copying the Myapp folder to system/priv-app directory

6 chmod 755 Myapp Folder

7 chmod 644 Myapp.apk

8 wipe Dalvilk Cache and rebooting

Steps 2 and 3 might be useless it was just because I noticed the Priv-app directory used these naming Scheme for apps inside this folder I tried this method under Lineage 17.1 and Magisk 21.4 but then the phone was not able to reboot until I delete the newly created folder inside Priv-app

I also tried another method using Magisk Systemize (Terminal) module but the result was the same (the app was running but not as a system app)

I also tried to put the app into System/app folder but the result was the same

As I have never seen that it was mentionned in any posted method explaning how to turn an app into a system app, the installed app was not signed with the platform key and the manifest was not including android:sharedUserId="android.uid.system"

Thanks in advance to those that will try to help.

1

There are 1 best solutions below

1
On

I would try the following, after making sure I don't have a user copy of the installed app (somewhere in /data).

Get to root shell at first.

  • adb root && adb remount

Use /system/app path for system apps and /system/priv-app for privileged apps. (for priv-app path you also need to create a priv-app-whitelist.xml with the said permissions, https://source.android.com/devices/tech/config/perms-allowlist)

  • adb shell mkdir -p /system/app/AppName
  • adb push AppName.apk /system/app/AppName
  • adb reboot

Not sure how are u confirming if the app is running as a system app or not?