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

This commit is contained in:
Ricky Wai
2016-07-18 14:22:26 +00:00
committed by Android (Google) Code Review

View File

@@ -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);