关于android8.1实现多个app升级时的注意事项
关于android8.1实现多个app升级时的注意事项
android新的版本,packagemanager对app安装有一定的限制,就是除了shell和root用户外,其他用户的进程不允许安装除了系统用户(system ui)以外的app。也就是例如system用户不允许安装uid为7000的app。
创新互联建站是专业的金昌网站建设公司,金昌接单;提供成都做网站、网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行金昌网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
所以,如果你想通过一个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升级时的注意事项
文章URL:http://pwwzsj.com/article/jehhpj.html