[aapt2] Add --non-updatable-system flag
This adds `updatableSystem="false"` to the root <manifest> tag if no
versionCode is specified (either explicitly or through --version-code).
This attribute makes the APK not updatable (see b/266131956).
Bug: 328302305
Test: atest aapt2_tests
Test: Manually ran `aapt2 link --non-updatable-system` and verified the
resulting APK.
Change-Id: I51cdbcdac7c03de10aac9bc22f5081e12fa142ab
diff --git a/tools/aapt2/link/ManifestFixer.h b/tools/aapt2/link/ManifestFixer.h
index 42938a4..df0ece6 100644
--- a/tools/aapt2/link/ManifestFixer.h
+++ b/tools/aapt2/link/ManifestFixer.h
@@ -91,6 +91,11 @@
// Whether to suppress `android:compileSdkVersion*` and `platformBuildVersion*` attributes.
bool no_compile_sdk_metadata = false;
+
+ // Whether to mark the app as a non-updatable system app. This adds `updatableSystem="false"` to
+ // the <manifest> tag. Not used if a version code is set either explicitly in the manifest or
+ // through version_code_default.
+ bool non_updatable_system = false;
};
// Verifies that the manifest is correctly formed and inserts defaults where specified with