diff options
| author | 2016-03-14 18:22:47 +0000 | |
|---|---|---|
| committer | 2016-03-14 18:22:49 +0000 | |
| commit | 5a032c33e4f585b482a9bb36005ebcd337fcd2cb (patch) | |
| tree | ca1e8e125d05c51846f1c372e6551ec80456230e | |
| parent | 848727cd66f838d427cf3aa315589864635a9da6 (diff) | |
| parent | ab5ba2ef2a08440193d76cf2eb1fa8537394e44d (diff) | |
Merge "Specifically block suspending the package verifier." into nyc-dev
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index debe072b7b98..f8221b351976 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -10822,25 +10822,41 @@ public class PackageManagerService extends IPackageManager.Stub { } } - // TODO: investigate and add more restrictions for suspending crucial packages. + /** + * TODO: cache and disallow blocking the active dialer. + * + * @see also DefaultPermissionGrantPolicy#grantDefaultSystemHandlerPermissions + */ private boolean canSuspendPackageForUserLocked(String packageName, int userId) { if (isPackageDeviceAdmin(packageName, userId)) { - Slog.w(TAG, "Not suspending/un-suspending package \"" + packageName - + "\": has active device admin"); + Slog.w(TAG, "Cannot suspend/un-suspend package \"" + packageName + + "\": has an active device admin"); return false; } String activeLauncherPackageName = getActiveLauncherPackageName(userId); if (packageName.equals(activeLauncherPackageName)) { - Slog.w(TAG, "Not suspending/un-suspending package \"" + packageName - + "\" because it is set as the active launcher"); + Slog.w(TAG, "Cannot suspend/un-suspend package \"" + packageName + + "\": contains the active launcher"); + return false; + } + + if (packageName.equals(mRequiredInstallerPackage)) { + Slog.w(TAG, "Cannot suspend/un-suspend package \"" + packageName + + "\": required for package installation"); + return false; + } + + if (packageName.equals(mRequiredVerifierPackage)) { + Slog.w(TAG, "Cannot suspend/un-suspend package \"" + packageName + + "\": required for package verification"); 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"); + Slog.w(TAG, "Cannot suspend/un-suspend package \"" + packageName + + "\": is a privileged app"); return false; } |