Merge "Min_sdk_version check for updatable apexes" into main
This commit is contained in:
@@ -2663,12 +2663,20 @@ func (a *apexBundle) checkStaticLinkingToStubLibraries(ctx android.ModuleContext
|
||||
})
|
||||
}
|
||||
|
||||
// TODO (b/221087384): Remove this allowlist
|
||||
var (
|
||||
updatableApexesWithCurrentMinSdkVersionAllowlist = []string{"com.android.profiling"}
|
||||
)
|
||||
|
||||
// checkUpdatable enforces APEX and its transitive dep properties to have desired values for updatable APEXes.
|
||||
func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) {
|
||||
if a.Updatable() {
|
||||
if a.minSdkVersionValue(ctx) == "" {
|
||||
ctx.PropertyErrorf("updatable", "updatable APEXes should set min_sdk_version as well")
|
||||
}
|
||||
if a.minSdkVersion(ctx).IsCurrent() && !android.InList(ctx.ModuleName(), updatableApexesWithCurrentMinSdkVersionAllowlist) {
|
||||
ctx.PropertyErrorf("updatable", "updatable APEXes should not set min_sdk_version to current. Please use a finalized API level or a recognized in-development codename")
|
||||
}
|
||||
if a.UsePlatformApis() {
|
||||
ctx.PropertyErrorf("updatable", "updatable APEXes can't use platform APIs")
|
||||
}
|
||||
|
@@ -11721,3 +11721,20 @@ func TestOverrideApexWithPrebuiltApexPreferred(t *testing.T) {
|
||||
|
||||
java.CheckModuleHasDependency(t, res.TestContext, "myoverrideapex", "android_common_myoverrideapex_myoverrideapex", "foo")
|
||||
}
|
||||
|
||||
func TestUpdatableApexMinSdkVersionCurrent(t *testing.T) {
|
||||
testApexError(t, `"myapex" .*: updatable: updatable APEXes should not set min_sdk_version to current. Please use a finalized API level or a recognized in-development codename`, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
updatable: true,
|
||||
min_sdk_version: "current",
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user