Loading Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -324,6 +324,7 @@ java_defaults { "av-types-aidl-java", "tv_tuner_resource_manager_aidl_interface-java", "soundtrigger_middleware-aidl-java", "modules-utils-build", "modules-utils-preconditions", "modules-utils-synchronous-result-receiver", "modules-utils-os", Loading core/java/android/content/pm/parsing/ApkLiteParseUtils.java +2 −1 Original line number Diff line number Diff line Loading @@ -568,7 +568,8 @@ public class ApkLiteParseUtils { } ParseResult<Integer> targetResult = FrameworkParsingPackageUtils.computeTargetSdkVersion( targetVer, targetCode, SDK_CODENAMES, input); targetVer, targetCode, SDK_CODENAMES, input, /* allowUnknownCodenames= */ false); if (targetResult.isError()) { return input.error(targetResult); } Loading core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java +20 −8 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.util.Slog; import android.util.apk.ApkSignatureVerifier; import com.android.internal.util.ArrayUtils; import com.android.modules.utils.build.UnboundedSdkLevel; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; Loading Loading @@ -334,8 +335,9 @@ public class FrameworkParsingPackageUtils { * If {@code targetCode} is not specified, e.g. the value is {@code null}, then the {@code * targetVers} will be returned unmodified. * <p> * Otherwise, the behavior varies based on whether the current platform is a pre-release * version, e.g. the {@code platformSdkCodenames} array has length > 0: * When {@code allowUnknownCodenames} is false, the behavior varies based on whether the * current platform is a pre-release version, e.g. the {@code platformSdkCodenames} array has * length > 0: * <ul> * <li>If this is a pre-release platform and the value specified by * {@code targetCode} is contained within the array of allowed pre-release Loading @@ -343,22 +345,32 @@ public class FrameworkParsingPackageUtils { * <li>If this is a released platform, this method will return -1 to * indicate that the package is not compatible with this platform. * </ul> * <p> * When {@code allowUnknownCodenames} is true, any codename that is not known (presumed to be * a codename announced after the build of the current device) is allowed and this method will * return {@link Build.VERSION_CODES#CUR_DEVELOPMENT}. * * @param targetVers targetSdkVersion number, if specified in the application * manifest, or 0 otherwise * @param targetCode targetSdkVersion code, if specified in the application manifest, * or {@code null} otherwise * @param platformSdkCodenames array of allowed pre-release SDK codenames for this platform * @param allowUnknownCodenames allow unknown codenames, if true this method will accept unknown * (presumed to be future) codenames * @return the targetSdkVersion to use at runtime if successful */ public static ParseResult<Integer> computeTargetSdkVersion(@IntRange(from = 0) int targetVers, @Nullable String targetCode, @NonNull String[] platformSdkCodenames, @NonNull ParseInput input) { @NonNull ParseInput input, boolean allowUnknownCodenames) { // If it's a release SDK, return the version number unmodified. if (targetCode == null) { return input.success(targetVers); } if (allowUnknownCodenames && UnboundedSdkLevel.isAtMost(targetCode)) { return input.success(Build.VERSION_CODES.CUR_DEVELOPMENT); } // If it's a pre-release SDK and the codename matches this platform, it // definitely targets this SDK. if (matchTargetCode(platformSdkCodenames, targetCode)) { Loading framework-jarjar-rules.txt +3 −0 Original line number Diff line number Diff line Loading @@ -5,3 +5,6 @@ rule android.hidl.** android.internal.hidl.@1 # Framework-specific renames. rule android.net.wifi.WifiAnnotations* android.internal.wifi.WifiAnnotations@1 rule com.android.server.vcn.util.** com.android.server.vcn.repackaged.util.@1 # for modules-utils-build dependency rule com.android.modules.utils.build.** android.internal.modules.utils.build.@1 services/core/java/com/android/server/pm/InitAppsHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import static com.android.server.pm.PackageManagerService.SCAN_NO_DEX; import static com.android.server.pm.PackageManagerService.SCAN_REQUIRE_KNOWN; import static com.android.server.pm.PackageManagerService.SYSTEM_PARTITIONS; import static com.android.server.pm.PackageManagerService.TAG; import static com.android.server.pm.pkg.parsing.ParsingPackageUtils.PARSE_CHECK_MAX_SDK_VERSION; import static com.android.server.pm.pkg.parsing.ParsingPackageUtils.PARSE_APK_IN_APEX; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -359,7 +359,7 @@ final class InitAppsHelper { try { if ((scanFlags & SCAN_AS_APK_IN_APEX) != 0) { // when scanning apk in apexes, we want to check the maxSdkVersion parseFlags |= PARSE_CHECK_MAX_SDK_VERSION; parseFlags |= PARSE_APK_IN_APEX; } mInstallPackageHelper.installPackagesFromDir(scanDir, frameworkSplits, parseFlags, scanFlags, packageParser, executorService); Loading Loading
Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -324,6 +324,7 @@ java_defaults { "av-types-aidl-java", "tv_tuner_resource_manager_aidl_interface-java", "soundtrigger_middleware-aidl-java", "modules-utils-build", "modules-utils-preconditions", "modules-utils-synchronous-result-receiver", "modules-utils-os", Loading
core/java/android/content/pm/parsing/ApkLiteParseUtils.java +2 −1 Original line number Diff line number Diff line Loading @@ -568,7 +568,8 @@ public class ApkLiteParseUtils { } ParseResult<Integer> targetResult = FrameworkParsingPackageUtils.computeTargetSdkVersion( targetVer, targetCode, SDK_CODENAMES, input); targetVer, targetCode, SDK_CODENAMES, input, /* allowUnknownCodenames= */ false); if (targetResult.isError()) { return input.error(targetResult); } Loading
core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java +20 −8 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.util.Slog; import android.util.apk.ApkSignatureVerifier; import com.android.internal.util.ArrayUtils; import com.android.modules.utils.build.UnboundedSdkLevel; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; Loading Loading @@ -334,8 +335,9 @@ public class FrameworkParsingPackageUtils { * If {@code targetCode} is not specified, e.g. the value is {@code null}, then the {@code * targetVers} will be returned unmodified. * <p> * Otherwise, the behavior varies based on whether the current platform is a pre-release * version, e.g. the {@code platformSdkCodenames} array has length > 0: * When {@code allowUnknownCodenames} is false, the behavior varies based on whether the * current platform is a pre-release version, e.g. the {@code platformSdkCodenames} array has * length > 0: * <ul> * <li>If this is a pre-release platform and the value specified by * {@code targetCode} is contained within the array of allowed pre-release Loading @@ -343,22 +345,32 @@ public class FrameworkParsingPackageUtils { * <li>If this is a released platform, this method will return -1 to * indicate that the package is not compatible with this platform. * </ul> * <p> * When {@code allowUnknownCodenames} is true, any codename that is not known (presumed to be * a codename announced after the build of the current device) is allowed and this method will * return {@link Build.VERSION_CODES#CUR_DEVELOPMENT}. * * @param targetVers targetSdkVersion number, if specified in the application * manifest, or 0 otherwise * @param targetCode targetSdkVersion code, if specified in the application manifest, * or {@code null} otherwise * @param platformSdkCodenames array of allowed pre-release SDK codenames for this platform * @param allowUnknownCodenames allow unknown codenames, if true this method will accept unknown * (presumed to be future) codenames * @return the targetSdkVersion to use at runtime if successful */ public static ParseResult<Integer> computeTargetSdkVersion(@IntRange(from = 0) int targetVers, @Nullable String targetCode, @NonNull String[] platformSdkCodenames, @NonNull ParseInput input) { @NonNull ParseInput input, boolean allowUnknownCodenames) { // If it's a release SDK, return the version number unmodified. if (targetCode == null) { return input.success(targetVers); } if (allowUnknownCodenames && UnboundedSdkLevel.isAtMost(targetCode)) { return input.success(Build.VERSION_CODES.CUR_DEVELOPMENT); } // If it's a pre-release SDK and the codename matches this platform, it // definitely targets this SDK. if (matchTargetCode(platformSdkCodenames, targetCode)) { Loading
framework-jarjar-rules.txt +3 −0 Original line number Diff line number Diff line Loading @@ -5,3 +5,6 @@ rule android.hidl.** android.internal.hidl.@1 # Framework-specific renames. rule android.net.wifi.WifiAnnotations* android.internal.wifi.WifiAnnotations@1 rule com.android.server.vcn.util.** com.android.server.vcn.repackaged.util.@1 # for modules-utils-build dependency rule com.android.modules.utils.build.** android.internal.modules.utils.build.@1
services/core/java/com/android/server/pm/InitAppsHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import static com.android.server.pm.PackageManagerService.SCAN_NO_DEX; import static com.android.server.pm.PackageManagerService.SCAN_REQUIRE_KNOWN; import static com.android.server.pm.PackageManagerService.SYSTEM_PARTITIONS; import static com.android.server.pm.PackageManagerService.TAG; import static com.android.server.pm.pkg.parsing.ParsingPackageUtils.PARSE_CHECK_MAX_SDK_VERSION; import static com.android.server.pm.pkg.parsing.ParsingPackageUtils.PARSE_APK_IN_APEX; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -359,7 +359,7 @@ final class InitAppsHelper { try { if ((scanFlags & SCAN_AS_APK_IN_APEX) != 0) { // when scanning apk in apexes, we want to check the maxSdkVersion parseFlags |= PARSE_CHECK_MAX_SDK_VERSION; parseFlags |= PARSE_APK_IN_APEX; } mInstallPackageHelper.installPackagesFromDir(scanDir, frameworkSplits, parseFlags, scanFlags, packageParser, executorService); Loading