Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86ea8f00 authored by Andrei Stingaceanu's avatar Andrei Stingaceanu
Browse files

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
parent f72ecded
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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;
    }