Override modules should always override source modules

Since overrides are implemented as variants of the source module, the
override module should not be replaced with prebuilts of the source
module even when the prebuilt is preferred.

Test: go test ./apex
Change-Id: I26e97f700276e7beaf6d1bd61b164f11d57a5e09
This commit is contained in:
Spandan Das
2024-05-28 23:40:17 +00:00
parent 1705676dd0
commit 0b28fa0b84
2 changed files with 44 additions and 0 deletions

View File

@@ -11671,3 +11671,38 @@ func TestApexMinSdkVersionOverride(t *testing.T) {
checkMinSdkVersion(t, overridingModuleDifferentMinSdkVersion, "31")
checkHasDep(t, ctx, overridingModuleDifferentMinSdkVersion.Module(), javalibApex31Variant.Module())
}
func TestOverrideApexWithPrebuiltApexPreferred(t *testing.T) {
context := android.GroupFixturePreparers(
android.PrepareForIntegrationTestWithAndroid,
PrepareForTestWithApexBuildComponents,
android.FixtureMergeMockFs(android.MockFS{
"system/sepolicy/apex/foo-file_contexts": nil,
}),
)
res := context.RunTestWithBp(t, `
apex {
name: "foo",
key: "myapex.key",
apex_available_name: "com.android.foo",
variant_version: "0",
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
prebuilt_apex {
name: "foo",
src: "foo.apex",
prefer: true,
}
override_apex {
name: "myoverrideapex",
base: "foo",
}
`)
java.CheckModuleHasDependency(t, res.TestContext, "myoverrideapex", "android_common_myoverrideapex_myoverrideapex", "foo")
}