关于android8.1实现多个app升级时的注意事项
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于android8.1实现多个app升级时的注意事项相关的知识,希望对你有一定的参考价值。
关于android8.1实现多个app升级时的注意事项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)) {
-
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"); - if ((callingUid != Process.SHELL_UID) && (callingUid != Process.ROOT_UID)) {
- if ((callingUid != Process.SHELL_UID) && (callingUid != Process.ROOT_UID) && (callingUid != Process.SYSTEM_UID)) {
mAppOps.checkPackage(callingUid, callerPackageName);
}
欢迎观看我发布的各个课程: https://edu.51cto.com/lecturer/8896847.html
或者
我的3折优惠的专题组合课程:
https://edu.51cto.com/topic/2362.html
以上是关于关于android8.1实现多个app升级时的注意事项的主要内容,如果未能解决你的问题,请参考以下文章
升级到 Android 8.1 后 startForeground 失败