aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-01 04:13:31 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-01 04:13:31 +0000
commit5589e84b343d4fe68ef9ab18ae0195bbdfc66812 (patch)
tree81e95e4af1e7bad7f94aac6c4e4ee6c00641e589
parent36fdd0ccaac3fbdda5b731da01096b94921d59f1 (diff)
parent640380699f0eab0c445a59a757bb670954d8f1ed (diff)
downloadsoong-android14-mainline-resolv-release.tar.gz
Snap for 11164065 from 640380699f0eab0c445a59a757bb670954d8f1ed to mainline-resolv-releaseaml_res_341410010android14-mainline-resolv-release
Change-Id: Ib94cd23264d81bff730479b898ea18eb2963d563
-rw-r--r--android/apex.go13
-rw-r--r--apex/apex.go19
-rwxr-xr-xjava/app.go11
-rw-r--r--java/app_test.go46
-rw-r--r--java/sdk_library.go20
-rw-r--r--remoteexec/remoteexec.go2
6 files changed, 93 insertions, 18 deletions
diff --git a/android/apex.go b/android/apex.go
index 35e1d025a..5a2529734 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -918,6 +918,19 @@ func CheckMinSdkVersion(ctx ModuleContext, minSdkVersion ApiLevel, walk WalkPayl
})
}
+// Construct ApiLevel object from min_sdk_version string value
+func MinSdkVersionFromValue(ctx EarlyModuleContext, value string) ApiLevel {
+ if value == "" {
+ return NoneApiLevel
+ }
+ apiLevel, err := ApiLevelFromUser(ctx, value)
+ if err != nil {
+ ctx.PropertyErrorf("min_sdk_version", "%s", err.Error())
+ return NoneApiLevel
+ }
+ return apiLevel
+}
+
// Implemented by apexBundle.
type ApexTestInterface interface {
// Return true if the apex bundle is an apex_test
diff --git a/apex/apex.go b/apex/apex.go
index f7c74440c..fca09440f 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2943,13 +2943,13 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string {
// Only override the minSdkVersion value on Apexes which already specify
// a min_sdk_version (it's optional for non-updatable apexes), and that its
// min_sdk_version value is lower than the one to override with.
- minApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.properties.Min_sdk_version))
+ minApiLevel := android.MinSdkVersionFromValue(ctx, proptools.String(a.properties.Min_sdk_version))
if minApiLevel.IsNone() {
return ""
}
overrideMinSdkValue := ctx.DeviceConfig().ApexGlobalMinSdkVersionOverride()
- overrideApiLevel := minSdkVersionFromValue(ctx, overrideMinSdkValue)
+ overrideApiLevel := android.MinSdkVersionFromValue(ctx, overrideMinSdkValue)
if !overrideApiLevel.IsNone() && overrideApiLevel.CompareTo(minApiLevel) > 0 {
minApiLevel = overrideApiLevel
}
@@ -2964,20 +2964,7 @@ func (a *apexBundle) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLe
// Returns apex's min_sdk_version ApiLevel, honoring overrides
func (a *apexBundle) minSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
- return minSdkVersionFromValue(ctx, a.minSdkVersionValue(ctx))
-}
-
-// Construct ApiLevel object from min_sdk_version string value
-func minSdkVersionFromValue(ctx android.EarlyModuleContext, value string) android.ApiLevel {
- if value == "" {
- return android.NoneApiLevel
- }
- apiLevel, err := android.ApiLevelFromUser(ctx, value)
- if err != nil {
- ctx.PropertyErrorf("min_sdk_version", "%s", err.Error())
- return android.NoneApiLevel
- }
- return apiLevel
+ return android.MinSdkVersionFromValue(ctx, a.minSdkVersionValue(ctx))
}
// Ensures that a lib providing stub isn't statically linked
diff --git a/java/app.go b/java/app.go
index 8d965571e..254906d2e 100755
--- a/java/app.go
+++ b/java/app.go
@@ -318,6 +318,17 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.generateJavaUsedByApex(ctx)
}
+func (a *AndroidApp) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
+ defaultMinSdkVersion := a.Module.MinSdkVersion(ctx)
+ if proptools.Bool(a.appProperties.Updatable) {
+ overrideApiLevel := android.MinSdkVersionFromValue(ctx, ctx.DeviceConfig().ApexGlobalMinSdkVersionOverride())
+ if !overrideApiLevel.IsNone() && overrideApiLevel.CompareTo(defaultMinSdkVersion) > 0 {
+ return overrideApiLevel
+ }
+ }
+ return defaultMinSdkVersion
+}
+
func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) {
if a.Updatable() {
if !a.SdkVersion(ctx).Stable() {
diff --git a/java/app_test.go b/java/app_test.go
index 746ab75e7..f078021aa 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -3668,3 +3668,49 @@ func TestPrivappAllowlistAndroidMk(t *testing.T) {
"\\S+soong/.intermediates/foo/android_common_bar/privapp_allowlist_com.google.android.foo.xml:\\S+/target/product/test_device/system/etc/permissions/bar.xml",
)
}
+
+func TestApexGlobalMinSdkVersionOverride(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.ApexGlobalMinSdkVersionOverride = proptools.StringPtr("Tiramisu")
+ }),
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.bar",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ }
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "S",
+ updatable: true,
+ }
+ override_android_app {
+ name: "com.android.go.foo",
+ base: "com.android.foo",
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ fooOverride := result.ModuleForTests("com.android.foo", "android_common_com.android.go.foo").Rule("manifestFixer")
+ bar := result.ModuleForTests("com.android.bar", "android_common").Rule("manifestFixer")
+
+ android.AssertStringDoesContain(t,
+ "expected manifest fixer to set com.android.bar minSdkVersion to S",
+ bar.BuildParams.Args["args"],
+ "--minSdkVersion S",
+ )
+ android.AssertStringDoesContain(t,
+ "com.android.foo: expected manifest fixer to set minSdkVersion to T",
+ foo.BuildParams.Args["args"],
+ "--minSdkVersion T",
+ )
+ android.AssertStringDoesContain(t,
+ "com.android.go.foo: expected manifest fixer to set minSdkVersion to T",
+ fooOverride.BuildParams.Args["args"],
+ "--minSdkVersion T",
+ )
+
+}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 76f050b73..853792d20 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1682,6 +1682,24 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
}
droidstubsArgs = append(droidstubsArgs, android.JoinWithPrefix(disabledWarnings, "--hide "))
+ droidstubsFiles := append([]string{}, module.sdkLibraryProperties.Droiddoc_option_files...)
+
+ // If requested hide the flagged APIs from the output of metalava. This
+ // should be implemented in the module SDK snapshot code by depending on
+ // special metalava rules that hide the flagged APIs but that will take
+ // lots of work. In the meantime, this is a temporary workaround that
+ // can and will only be used when building module SDK snapshots. This
+ // delegates the decision as to what options are passed to metalava to
+ // the "sdkext-released-flagged-apis" module by using metalava's support
+ // for expanding an argument of the form "@<file>" to the list of
+ // arguments found in <file>.
+ if mctx.Config().GetenvWithDefault("SOONG_SDK_SNAPSHOT_HIDE_FLAGGED_APIS", "false") == "true" {
+ metalavaHideFlaggedApisSource := ":sdkext-released-flagged-apis"
+ droidstubsArgs = append(droidstubsArgs,
+ fmt.Sprintf("@$(location %s)", metalavaHideFlaggedApisSource))
+ droidstubsFiles = append(droidstubsFiles, metalavaHideFlaggedApisSource)
+ }
+
// Output Javadoc comments for public scope.
if apiScope == apiScopePublic {
props.Output_javadoc_comments = proptools.BoolPtr(true)
@@ -1689,7 +1707,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
// Add in scope specific arguments.
droidstubsArgs = append(droidstubsArgs, scopeSpecificDroidstubsArgs...)
- props.Arg_files = module.sdkLibraryProperties.Droiddoc_option_files
+ props.Arg_files = droidstubsFiles
props.Args = proptools.StringPtr(strings.Join(droidstubsArgs, " "))
// List of APIs identified from the provided source files are created. They are later
diff --git a/remoteexec/remoteexec.go b/remoteexec/remoteexec.go
index 9e7a0f1e3..6076c747c 100644
--- a/remoteexec/remoteexec.go
+++ b/remoteexec/remoteexec.go
@@ -29,7 +29,7 @@ const (
// DefaultImage is the default container image used for Android remote execution. The
// image was built with the Dockerfile at
// https://android.googlesource.com/platform/prebuilts/remoteexecution-client/+/refs/heads/master/docker/Dockerfile
- DefaultImage = "docker://gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:582efb38f0c229ea39952fff9e132ccbe183e14869b39888010dacf56b360d62"
+ DefaultImage = "docker://gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:953fed4a6b2501256a0d17f055dc17884ff71b024e50ade773e0b348a6c303e6"
// DefaultWrapperPath is the default path to the remote execution wrapper.
DefaultWrapperPath = "prebuilts/remoteexecution-client/live/rewrapper"