Check updatable APKs compile against managed SDKs.
As a follow up, this property will be set to APKs participating in mainline program.
Bug: 153333044
Test: m
Change-Id: I6ea2f3c1d26992259e4e9e6a6d8cecf091d39c43
diff --git a/java/app.go b/java/app.go
index ae9cd5f..ac5121a 100755
--- a/java/app.go
+++ b/java/app.go
@@ -110,6 +110,10 @@
PreventInstall bool `blueprint:"mutated"`
HideFromMake bool `blueprint:"mutated"`
IsCoverageVariant bool `blueprint:"mutated"`
+
+ // Whether this app is considered mainline updatable or not. When set to true, this will enforce
+ // additional rules for making sure that the APK is truly updatable. Default is false.
+ Updatable *bool
}
// android_app properties that can be overridden by override_android_app
@@ -249,11 +253,21 @@
}
func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- a.checkPlatformAPI(ctx)
- a.checkSdkVersion(ctx)
+ a.checkAppSdkVersions(ctx)
a.generateAndroidBuildActions(ctx)
}
+func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) {
+ if Bool(a.appProperties.Updatable) {
+ if !a.sdkVersion().stable() {
+ ctx.PropertyErrorf("sdk_version", "Updatable apps must use stable SDKs, found %v", a.sdkVersion())
+ }
+ }
+
+ a.checkPlatformAPI(ctx)
+ a.checkSdkVersions(ctx)
+}
+
// Returns true if the native libraries should be stored in the APK uncompressed and the
// extractNativeLibs application flag should be set to false in the manifest.
func (a *AndroidApp) useEmbeddedNativeLibs(ctx android.ModuleContext) bool {