Set usesNonSdkApi in manifest when Platform_apis=true
The Platform_apis field in CompilerDeviceProperties currently has no
effect. Unify the behaviour with make and run manifest_fixer.py to
encode the information in the manifest. This is used to exempt
bundled apps and platform tests from hidden API access checks without
having a fixed whitelist of packages.
Bug: 113315999
Bug: 124671117
Test: m UbSystemUiJankTests && \
aapt d xmltree \
target/product/taimen/data/app/UbSystemUiJankTests/UbSystemUiJankTests.apk \
AndroidManifest.xml | grep usesNonSdkApi
Change-Id: I20c392d91ee6275ef8139fbeb5b9700385abbc80
diff --git a/java/android_manifest.go b/java/android_manifest.go
index e63fb80..3cca4f7 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -44,7 +44,7 @@
"libs")
func manifestMerger(ctx android.ModuleContext, manifest android.Path, sdkContext sdkContext,
- staticLibManifests android.Paths, isLibrary bool, uncompressedJNI, useEmbeddedDex bool) android.Path {
+ staticLibManifests android.Paths, isLibrary, uncompressedJNI, useEmbeddedDex, usesNonSdkApis bool) android.Path {
var args []string
if isLibrary {
@@ -62,6 +62,10 @@
}
}
+ if usesNonSdkApis {
+ args = append(args, "--uses-non-sdk-api")
+ }
+
if useEmbeddedDex {
args = append(args, "--use-embedded-dex=true")
}