Troubles installing programmatically an app with INSTALL_PACKAGES permission from /system/app

故事扮演 提交于 2019-11-29 03:42:50
weidongxu

Refer to signatureOrSystem permissions on custom ROM

Basically,

  1. add the required <uses-permission>
  2. push apk to /system/priv-app

Done (well, at least works for me).

You do not need to add android:protectionLevel="signatureOrSystem" or android:sharedUserId="android.uid.system". You could sign with any certification.

I assume that putting it in the /system/app folder is not equivalent to it being loaded in the firmware.

About the error:

SecurityException: Neither user 10057 nor current process has android.permission.INSTALL_PACKAGES

To get INSTALL_PACKAGES permission:

  1. Put your app in /system/app
  2. Sign the app with the system's key
  3. In the manifest.xml file, put this attribute inside the tag manifest:

    <manifest android:sharedUserId="android.uid.system" ...
    

Running these two lines fixes the issue with PackageManager permission error: "Couldn't create temp file for downloaded package file."

adb shell chown system.shell /data/app
adb shell chown system.shell /data/local
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!