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

Commit e9e9f300 authored by Ricky Wai's avatar Ricky Wai Committed by android-build-merger
Browse files

Merge \"Do not allow to disable package \"android\"\" into nyc-mr1-dev

am: a5111bfd

Change-Id: Ia983198d1c41848d78ef18ed189d6f68cbc39350
parents 1ae7b3e1 a5111bfd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -11511,12 +11511,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);