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

Commit f502fb32 authored by Nick Kovacs's avatar Nick Kovacs Committed by Android (Google) Code Review
Browse files

Merge "Only allow low target sdk bypass when system, root or shell"

parents 66e53d5a 074b547a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1092,6 +1092,7 @@ final class InstallPackageHelper {

            // Determine if enforcement is in strict mode
            boolean strictMode = false;

            if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PACKAGE_MANAGER_SERVICE,
                    "MinInstallableTargetSdk__install_block_strict_mode_enabled",
                    false)) {
+8 −0
Original line number Diff line number Diff line
@@ -769,6 +769,14 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
            }
        }

        if ((params.installFlags & PackageManager.INSTALL_BYPASS_LOW_TARGET_SDK_BLOCK) != 0
                && !PackageManagerServiceUtils.isSystemOrRootOrShell(callingUid)
                && !Build.IS_DEBUGGABLE) {
            // If the bypass flag is set, but not running as system root or shell then remove
            // the flag
            params.installFlags &= ~PackageManager.INSTALL_BYPASS_LOW_TARGET_SDK_BLOCK;
        }

        if ((params.installFlags & PackageManager.INSTALL_INSTANT_APP) != 0
                && !PackageManagerServiceUtils.isSystemOrRootOrShell(callingUid)
                && (snapshot.getFlagsForUid(callingUid) & ApplicationInfo.FLAG_SYSTEM)