Revert "Revert "Revert "Enable low target sdk install block by default"""

This reverts commit 08d73f2f36.

Reason for revert: DroidMonitor: Culprit for b/278113755, verified through ABTD before revert submission.

Change-Id: I055ea8937368206a9e29362a0d711429c8fd94f8
This commit is contained in:
Alexander Roederer
2023-04-14 23:00:46 +00:00
parent 08d73f2f36
commit 9308df1772
2 changed files with 4 additions and 12 deletions

View File

@@ -1134,22 +1134,22 @@ final class InstallPackageHelper {
// behavior.
if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PACKAGE_MANAGER_SERVICE,
"MinInstallableTargetSdk__install_block_enabled",
true)) {
false)) {
int minInstallableTargetSdk =
DeviceConfig.getInt(DeviceConfig.NAMESPACE_PACKAGE_MANAGER_SERVICE,
"MinInstallableTargetSdk__min_installable_target_sdk",
PackageManagerService.MIN_INSTALLABLE_TARGET_SDK);
0);
// Determine if enforcement is in strict mode
boolean strictMode = false;
if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PACKAGE_MANAGER_SERVICE,
"MinInstallableTargetSdk__install_block_strict_mode_enabled",
true)) {
false)) {
if (parsedPackage.getTargetSdkVersion()
< DeviceConfig.getInt(DeviceConfig.NAMESPACE_PACKAGE_MANAGER_SERVICE,
"MinInstallableTargetSdk__strict_mode_target_sdk",
PackageManagerService.MIN_INSTALLABLE_TARGET_SDK)) {
0)) {
strictMode = true;
}
}

View File

@@ -557,14 +557,6 @@ public class PackageManagerService implements PackageSender, TestUtilityService
// How many required verifiers can be on the system.
private static final int REQUIRED_VERIFIERS_MAX_COUNT = 2;
/**
* Specifies the minimum target SDK version an apk must specify in order to be installed
* on the system. This improves security and privacy by blocking low
* target sdk apps as malware can target older sdk versions to avoid
* the enforcement of new API behavior.
*/
public static final int MIN_INSTALLABLE_TARGET_SDK = Build.VERSION_CODES.M;
// Compilation reasons.
// TODO(b/260124949): Clean this up with the legacy dexopt code.
public static final int REASON_FIRST_BOOT = 0;