PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES is applicable to override_apex

apex { name: "foo" }
override_apex { name: "override_foo", base:"foo" }

PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES := foo:com.android.foo

Previously, the override was done only for the overridden package "foo",
but not for "override_foo". Fixing this issue by using ctx.ModuleName()
when finding the package name to use.

Bug: 150645663
Test: m
Change-Id: I2947e5c75369216a4bbce8749503236be86771c3
This commit is contained in:
Jiyong Park 2020-03-03 11:45:41 +09:00
parent af8998cba6
commit a519c54dd3
2 changed files with 5 additions and 2 deletions

View File

@ -3272,7 +3272,7 @@ func TestOverrideApex(t *testing.T) {
base: "app",
package_name: "bar",
}
`)
`, withManifestPackageNameOverrides([]string{"myapex:com.android.myapex"}))
originalVariant := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(android.OverridableModule)
overriddenVariant := ctx.ModuleForTests("myapex", "android_common_override_myapex_myapex_image").Module().(android.OverridableModule)
@ -3300,6 +3300,9 @@ func TestOverrideApex(t *testing.T) {
t.Errorf("override_myapex should have logging parent (com.foo.bar), but was %q.", apexBundle.overridableProperties.Logging_parent)
}
optFlags := apexRule.Args["opt_flags"]
ensureContains(t, optFlags, "--override_apk_package_name com.android.myapex")
data := android.AndroidMkDataForTest(t, config, "", apexBundle)
var builder strings.Builder
data.Custom(&builder, name, "TARGET_", "", data)

View File

@ -649,7 +649,7 @@ func (a *apexBundle) getOverrideManifestPackageName(ctx android.ModuleContext) s
}
return ""
}
manifestPackageName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(a.Name())
manifestPackageName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(ctx.ModuleName())
if overridden {
return manifestPackageName
}