Loading java/app.go +6 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,9 @@ type appProperties struct { 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. // additional rules to make sure an app can safely be updated. Default is false. // Prefer using other specific properties if build behaviour must be changed; avoid using this // flag for anything but neverallow rules (unless the behaviour change is invisible to owners). Updatable *bool } Loading Loading @@ -262,6 +264,9 @@ func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) { if !a.sdkVersion().stable() { ctx.PropertyErrorf("sdk_version", "Updatable apps must use stable SDKs, found %v", a.sdkVersion()) } if String(a.deviceProperties.Min_sdk_version) == "" { ctx.PropertyErrorf("updatable", "updatable apps must set min_sdk_version.") } } a.checkPlatformAPI(ctx) Loading java/app_test.go +19 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "29", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -285,6 +286,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "system_29", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -294,6 +296,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "current", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -303,6 +306,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "system_current", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -312,6 +316,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "module_current", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -321,6 +326,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "core_current", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -330,6 +336,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], platform_apis: true, min_sdk_version: "29", updatable: true, }`, expectedError: "Updatable apps must use stable SDKs", Loading @@ -340,6 +347,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "core_platform", min_sdk_version: "29", updatable: true, }`, expectedError: "Updatable apps must use stable SDKs", Loading @@ -350,9 +358,20 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], updatable: true, min_sdk_version: "29", }`, expectedError: "Updatable apps must use stable SDK", }, { name: "Must specify min_sdk_version", bp: `android_app { name: "app_without_min_sdk_version", srcs: ["a.java"], sdk_version: "29", updatable: true, }`, expectedError: "updatable apps must set min_sdk_version.", }, } for _, test := range testCases { Loading Loading
java/app.go +6 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,9 @@ type appProperties struct { 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. // additional rules to make sure an app can safely be updated. Default is false. // Prefer using other specific properties if build behaviour must be changed; avoid using this // flag for anything but neverallow rules (unless the behaviour change is invisible to owners). Updatable *bool } Loading Loading @@ -262,6 +264,9 @@ func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) { if !a.sdkVersion().stable() { ctx.PropertyErrorf("sdk_version", "Updatable apps must use stable SDKs, found %v", a.sdkVersion()) } if String(a.deviceProperties.Min_sdk_version) == "" { ctx.PropertyErrorf("updatable", "updatable apps must set min_sdk_version.") } } a.checkPlatformAPI(ctx) Loading
java/app_test.go +19 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "29", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -285,6 +286,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "system_29", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -294,6 +296,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "current", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -303,6 +306,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "system_current", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -312,6 +316,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "module_current", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -321,6 +326,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "core_current", min_sdk_version: "29", updatable: true, }`, }, Loading @@ -330,6 +336,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], platform_apis: true, min_sdk_version: "29", updatable: true, }`, expectedError: "Updatable apps must use stable SDKs", Loading @@ -340,6 +347,7 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], sdk_version: "core_platform", min_sdk_version: "29", updatable: true, }`, expectedError: "Updatable apps must use stable SDKs", Loading @@ -350,9 +358,20 @@ func TestUpdatableApps(t *testing.T) { name: "foo", srcs: ["a.java"], updatable: true, min_sdk_version: "29", }`, expectedError: "Updatable apps must use stable SDK", }, { name: "Must specify min_sdk_version", bp: `android_app { name: "app_without_min_sdk_version", srcs: ["a.java"], sdk_version: "29", updatable: true, }`, expectedError: "updatable apps must set min_sdk_version.", }, } for _, test := range testCases { Loading