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

Commit 1a7b160c authored by Ricky Wai's avatar Ricky Wai
Browse files

Do not allow to disable package "android"

Bug: 25337001
Change-Id: I837d70898f00d3c97c8ae1f5eadd0791ba045df6
parent 695a1c50
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -11704,12 +11704,18 @@ public class PackageManagerService extends IPackageManager.Stub {
                if (pkgSetting == null) {
                    return false;
                }
                // Do not allow "android" is being disabled
                if ("android".equals(packageName)) {
                    Slog.w(TAG, "Cannot hide package: android");
                    return false;
                }
                // Only allow protected packages to hide themselves.
                if (hidden && !UserHandle.isSameApp(uid, pkgSetting.appId)
                        && mProtectedPackages.isPackageStateProtected(userId, packageName)) {
                    Slog.w(TAG, "Not hiding protected package: " + packageName);
                    return false;
                }
                if (pkgSetting.getHidden(userId) != hidden) {
                    pkgSetting.setHidden(hidden, userId);
                    mSettings.writePackageRestrictionsLPr(userId);