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

Commit b5d26f69 authored by Peter Li's avatar Peter Li Committed by Android (Google) Code Review
Browse files

Merge "Disallow device admin package and protected packages to be reinstalled...

Merge "Disallow device admin package and protected packages to be reinstalled as instant." into sc-dev
parents e3d46f40 b0bed466
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -16174,6 +16174,9 @@ public class PackageManagerService extends IPackageManager.Stub
                    (installFlags & PackageManager.INSTALL_INSTANT_APP) != 0;
            final boolean fullApp =
                    (installFlags & PackageManager.INSTALL_FULL_APP) != 0;
            final boolean isPackageDeviceAdmin = isPackageDeviceAdmin(packageName, userId);
            final boolean isProtectedPackage = mProtectedPackages != null
                    && mProtectedPackages.isPackageStateProtected(userId, packageName);
            // writer
            synchronized (mLock) {
@@ -16181,7 +16184,8 @@ public class PackageManagerService extends IPackageManager.Stub
                if (pkgSetting == null) {
                    return PackageManager.INSTALL_FAILED_INVALID_URI;
                }
                if (instantApp && (pkgSetting.isSystem() || isUpdatedSystemApp(pkgSetting))) {
                if (instantApp && (pkgSetting.isSystem() || isUpdatedSystemApp(pkgSetting)
                        || isPackageDeviceAdmin || isProtectedPackage)) {
                    return PackageManager.INSTALL_FAILED_INVALID_URI;
                }
                if (!canViewInstantApps(callingUid, UserHandle.getUserId(callingUid))) {