From 727da64be5c2553753c768d4b309174016968010 Mon Sep 17 00:00:00 2001 From: Winson Date: Tue, 10 Mar 2020 15:25:32 -0700 Subject: Gate stricter manifest enforcement on targetSdk R Two package parsing issues have been promoted to failures in R: a missing / tag, and an empty "android:name" attribute. The latter due to a bug in the parsing code. These need to be gated by targetSdkVersion so that APKs built for previous versions can still scan/install properly. This change introduces support for this through a framework that leverages @ChangeId to introduce individually toggle-able errors, in case a developer needs to install an app that isn't completely migrated for a new SDK version yet. The ignoreError method was removed from ParseResult as the errors it was used for were manually compared to PackageParser and it's likely they can be hard errors without breaking anything. This also adds tests for general ParseInput/Result behavior. Exempt-From-Owner-Approval: AppIntegrity already approved in older PS. Bug: 150776642 Test: atest android.content.pm.parsing.result.ParseInputAndResultTest Test: atest com.android.server.pm.parsing.PackageParsingDeferErrorTest Test: atest com.android.server.integrity.AppIntegrityManagerServiceImplTest Test: atest com.android.server.pm.parsing Change-Id: Id53a2e65f6e5e4dee9a41cc77007275b3a220ac3 --- apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apct-tests') diff --git a/apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt b/apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt index 9e463652d0b6..29721c593646 100644 --- a/apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt +++ b/apct-tests/perftests/core/src/android/os/PackageParsingPerfTest.kt @@ -22,6 +22,7 @@ import android.content.pm.PackageParserCacheHelper.WriteHelper import android.content.pm.parsing.ParsingPackageImpl import android.content.pm.parsing.ParsingPackageRead import android.content.pm.parsing.ParsingPackageUtils +import android.content.pm.parsing.result.ParseInput import android.content.pm.parsing.result.ParseTypeImpl import android.content.res.TypedArray import android.perftests.utils.BenchmarkState @@ -173,7 +174,10 @@ class PackageParsingPerfTest { class ParallelParser2(cacher: PackageCacher2? = null) : ParallelParser(cacher) { - val input = ThreadLocal.withInitial { ParseTypeImpl() } + val input = ThreadLocal.withInitial { + // For testing, just disable enforcement to avoid hooking up to compat framework + ParseTypeImpl(ParseInput.Callback { _, _, _ -> false }) + } val parser = ParsingPackageUtils(false, null, null, object : ParsingPackageUtils.Callback { override fun hasFeature(feature: String) = true -- cgit v1.2.3