[英]android updated system app is not granted new permission
i have an app that is installed into our custom ROM in /system/app
我有一个安装在
/system/app
自定义ROM中的/system/app
when i add a system permission, such as android.permission.REBOOT
, and install an update to the system app, the updated app does not get the new permission added in the update. 当我添加系统权限(例如
android.permission.REBOOT
)并将更新安装到系统应用程序时,更新后的应用程序不会获得更新中添加的新权限。
when i add a non-system permission, such as android.permission.INTERNET
, the app does see the new permission. 当我添加非系统权限(例如
android.permission.INTERNET
,应用程序会看到新的权限。
we are trying to understand if there is a way to get around this without OTA'ing the system app. 我们正在尝试了解是否有一种方法可以解决此问题,而无需OTA处理系统应用。
EDIT: here is how we are installing the package, 编辑:这是我们如何安装软件包,
Class<?>[] installTypes = new Class[]{Uri.class, IPackageInstallObserver.class, int.class, String.class};
installMethod = pm.getClass().getMethod("installPackage", installTypes);
...
installMethod.invoke(pm, new Object[]{apkFile, observer, INSTALL_REPLACE_EXISTING, null});
answering my own question ... 回答我自己的问题...
system apps cannot be granted new permissions through an upgrade. 无法通过升级为系统应用授予新权限。 the reason, i assume, is that if you ever compromised a system app, you could upgrade it and add any permission you want, including all of the dangerous permissions that can only be granted to system apps.
我认为,原因是,如果您曾经入侵过系统应用程序,则可以对其进行升级并添加所需的任何权限,包括只能授予系统应用程序的所有危险权限。
if you want your system app to have a new permission, you need to perform a OTA, or otherwise get the new bits of the APK into /system/app
. 如果您希望系统应用程序具有新的权限,则需要执行OTA,或者将APK的新内容放入
/system/app
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.