android新的版本,packagemanager對(duì)app安裝有一定的限制,就是除了shell和root用戶外,其他用戶的進(jìn)程不允許安裝除了系統(tǒng)用戶(system ui)以外的app。也就是例如system用戶不允許安裝uid為7000的app。
創(chuàng)新互聯(lián)建站是專業(yè)的金昌網(wǎng)站建設(shè)公司,金昌接單;提供成都做網(wǎng)站、網(wǎng)站建設(shè),網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行金昌網(wǎng)站開發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!
所以,如果你想通過(guò)一個(gè)appupgrade(一個(gè)system用戶的進(jìn)程)專門去進(jìn)行多個(gè)不用用戶的應(yīng)用進(jìn)行差分升級(jí),那么需要去掉此限制。
修改如下:
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");
歡迎觀看我發(fā)布的各個(gè)課程: https://edu.51cto.com/lecturer/8896847.html
或者
我的3折優(yōu)惠的專題組合課程:
https://edu.51cto.com/topic/2362.html