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
Merged-In: I6ea2f3c1d26992259e4e9e6a6d8cecf091d39c43
(cherry picked from commit 2db1c3f1c4)
Exempt-From-Owner-Approval: clean cherry-pick
This commit is contained in:
Artur Satayev
2020-04-08 19:09:30 +01:00
parent ee42b2079d
commit e5ac15a1b7
4 changed files with 154 additions and 13 deletions

View File

@@ -110,6 +110,10 @@ type appProperties struct {
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
@@ -242,11 +246,21 @@ func (a *AndroidTestHelperApp) GenerateAndroidBuildActions(ctx android.ModuleCon
}
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 {