您好,登录后才能下订单哦!
android新的版本,packagemanager对app安装有一定的限制,就是除了shell和root用户外,其他用户的进程不允许安装除了系统用户(system ui)以外的app。也就是例如system用户不允许安装uid为7000的app。
所以,如果你想通过一个appupgrade(一个system用户的进程)专门去进行多个不用用户的应用进行差分升级,那么需要去掉此限制。
修改如下:
diff --git a/frameworks/base/services/core/java/com/android/server/pm/PackageInstallerService.java b/frameworks/base/services/core/java/com/android/server/pm/PackageInstallerService.java
index 94f7577..53eea02 100644
--- a/frameworks/base/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/frameworks/base/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -438,7 +438,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
throw new SecurityException("User restriction prevents installing");
}
if ((callingUid == Process.SHELL_UID) || (callingUid == Process.ROOT_UID) || (callingUid == Process.SYSTEM_UID)) {
params.installFlags |= PackageManager.INSTALL_FROM_ADB;
} else {
@@ -737,7 +737,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
IntentSender statusReceiver, int userId) throws RemoteException {
final int callingUid = Binder.getCallingUid();
mPm.enforceCrossUserPermission(callingUid, userId, true, true, "uninstall");
欢迎观看我发布的各个课程: https://edu.51cto.com/lecturer/8896847.html
或者
我的3折优惠的专题组合课程:
https://edu.51cto.com/topic/2362.html
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。