From 72e144cd18094c70769b344d2cbb15f6f5a68f03 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Tue, 28 Apr 2020 10:53:40 -0700 Subject: [PATCH] Allow pre-R apps to test compressed ARSC error This change removes the initial target SDK check which prevents apps that target pre-Q from testing that they fail to be install if the compatibility change is enabled for pre-Q packages. Bug: 132742131 Test: adb shell am compat enable 132742131 for app with compressed ARSC that targets pre-R Change-Id: I7e568a9e99045c09565bb372e454f573b954fea5 --- .../android/content/pm/parsing/ParsingPackageUtils.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/java/android/content/pm/parsing/ParsingPackageUtils.java b/core/java/android/content/pm/parsing/ParsingPackageUtils.java index c61362feaeaed..770d08d3b84d6 100644 --- a/core/java/android/content/pm/parsing/ParsingPackageUtils.java +++ b/core/java/android/content/pm/parsing/ParsingPackageUtils.java @@ -346,12 +346,11 @@ public class ParsingPackageUtils { } final ParsingPackage pkg = result.getResult(); - if (pkg.getTargetSdkVersion() >= Build.VERSION_CODES.R - && assets.containsAllocatedTable()) { + if (assets.containsAllocatedTable()) { final ParseResult deferResult = input.deferError( - "Targeting R+ (version" + Build.VERSION_CODES.R + " and above) requires the" - + " resources.arsc of installed APKs to be stored uncompressed and" - + " aligned on a 4-byte boundary", + "Targeting R+ (version " + Build.VERSION_CODES.R + " and above) requires" + + " the resources.arsc of installed APKs to be stored uncompressed" + + " and aligned on a 4-byte boundary", DeferredError.RESOURCES_ARSC_COMPRESSED); if (deferResult.isError()) { return input.error(INSTALL_PARSE_FAILED_RESOURCES_ARSC_COMPRESSED,