Add --no-compile-sdk-metadata switch to AAPT2
This switch suppresses output of compile SDK-related attributes
in AndroidManifest.xml, including android:compileSdkVersion and
platformBuildVersion.
Fixes: 278115511
Test: ManifestFixer_test
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2ada8ffbe1a62f50fe5e966e8e9ec1f417cea179)
Merged-In: I552e50802a328c2318c9f261e30beadcbca5fd29
Change-Id: I552e50802a328c2318c9f261e30beadcbca5fd29
diff --git a/tools/aapt2/link/ManifestFixer.h b/tools/aapt2/link/ManifestFixer.h
index 175ab6f..42938a4 100644
--- a/tools/aapt2/link/ManifestFixer.h
+++ b/tools/aapt2/link/ManifestFixer.h
@@ -67,11 +67,12 @@
std::optional<std::string> revision_code_default;
// The version of the framework being compiled against to set for 'android:compileSdkVersion' in
- // the <manifest> tag.
+ // the <manifest> tag. Not used if no_compile_sdk_metadata is set.
std::optional<std::string> compile_sdk_version;
// The version codename of the framework being compiled against to set for
- // 'android:compileSdkVersionCodename' in the <manifest> tag.
+ // 'android:compileSdkVersionCodename' in the <manifest> tag. Not used if no_compile_sdk_metadata
+ // is set.
std::optional<std::string> compile_sdk_version_codename;
// The fingerprint prefixes to be added to the <install-constraints> tag.
@@ -87,6 +88,9 @@
// Whether to replace the manifest version with the the command line version
bool replace_version = false;
+
+ // Whether to suppress `android:compileSdkVersion*` and `platformBuildVersion*` attributes.
+ bool no_compile_sdk_metadata = false;
};
// Verifies that the manifest is correctly formed and inserts defaults where specified with