Installing an APK on /system/priv-app

Denis Isidoro picture Denis Isidoro · Apr 27, 2018 · Viewed 9.2k times · Source

I have a rooted TV Box with Android 7.1.2 which didn't come with the Files app (com.android.documentsui), so I can't give write access to external drives.

I tried the following steps to install DocumentsUI.apk:

  • move DocumentsUI.apk to /system/priv-app/DocumentsUI/DocumentsUI.apk
  • chmod 744 /system/priv-app/DocumentsUI
  • chmod 644 /system/priv-app/DocumentsUI/DocumentsUI.apk
  • chown 0.0 /system/priv-app/DocumentsUI
  • chown 0.0 /system/priv-app/DocumentsUI/DocumentsUI.apk
  • chcon u:object_r:system_file:s0 /system/priv-app/DocumentsUI
  • chcon u:object_r:system_file:s0 /system/priv-app/DocumentsUI/DocumentsUI.apk
  • reboot

Even so, when I try to launch the app, it always force closes with the following error message on logcat: Neither user 10072 nor current process has android.permission.CACHE_CONTENT

Any idea if I'm missing something?

Please note I'm not on Android 8+ so as far as I know I don't have to add an XML on /system/etc/permissions.

Answer

Chris picture Chris · Jan 30, 2019

Just found this thread on the Kodi site that might help. https://forum.kodi.tv/showthread.php?tid=308040&page=2

Short version: Since you are rooted find /data/system/packages.xml and /data/system/packages.list

Now you should find your package name in packages.list and then edit packages.xml

Find the apps section you want (e.g. com.ghisler.android.TotalCommander),

locate its <perms> section and add the following line:
<item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />

Have a look at the Kodi thread if something I've type is unclear. Hope this helps,

Chris.