Suspend packages - decline suspending privileged apps

Because there is a high risk of making the system instable.

Bug: 22776761
Bug: 26949256
Bug: 26949428
Bug: 26683041
Change-Id: I73b3f05c13b5023db5176e709320ca6e2e5f6354
This commit is contained in:
Andrei Stingaceanu
2016-02-23 13:20:33 +00:00
parent f72ecded69
commit 86ea8f002c

View File

@@ -10726,7 +10726,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
appId = pkgSetting.appId;
if (pkgSetting.getSuspended(userId) != suspended) {
if (!canSuspendPackageForUser(packageName, userId)) {
if (!canSuspendPackageForUserLocked(packageName, userId)) {
unactionedPackages.add(packageName);
continue;
}
@@ -10765,7 +10765,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
// TODO: investigate and add more restrictions for suspending crucial packages.
private boolean canSuspendPackageForUser(String packageName, int userId) {
private boolean canSuspendPackageForUserLocked(String packageName, int userId) {
if (isPackageDeviceAdmin(packageName, userId)) {
Slog.w(TAG, "Not suspending/un-suspending package \"" + packageName
+ "\": has active device admin");
@@ -10779,6 +10779,13 @@ public class PackageManagerService extends IPackageManager.Stub {
return false;
}
final PackageParser.Package pkg = mPackages.get(packageName);
if (pkg != null && isPrivilegedApp(pkg)) {
Slog.w(TAG, "Not suspending/un-suspending package \"" + packageName
+ "\" because it is a privileged app");
return false;
}
return true;
}