Allow for overriding container packagename for an Apex.

Test: go test ./... -test.v -run TestOverrideApex
BUG: 148198056
Change-Id: If49042a7acbf9f0dcb505664863d97805902e459
This commit is contained in:
Baligh Uddin 2020-03-15 13:01:05 -07:00
parent 8fed7d4057
commit 5b57dbad86
3 changed files with 9 additions and 1 deletions

View file

@ -1359,6 +1359,10 @@ type overridableProperties struct {
// Logging Parent value
Logging_parent string
// Apex Container Package Name.
// Override value for attribute package:name in AndroidManifest.xml
Package_name string
}
type apexPackaging int

View file

@ -3664,6 +3664,7 @@ func TestOverrideApex(t *testing.T) {
apps: ["override_app"],
overrides: ["unknownapex"],
logging_parent: "com.foo.bar",
package_name: "test.overridden.package",
}
apex_key {
@ -3715,7 +3716,7 @@ func TestOverrideApex(t *testing.T) {
}
optFlags := apexRule.Args["opt_flags"]
ensureContains(t, optFlags, "--override_apk_package_name com.android.myapex")
ensureContains(t, optFlags, "--override_apk_package_name test.overridden.package")
data := android.AndroidMkDataForTest(t, config, "", apexBundle)
var builder strings.Builder

View file

@ -657,6 +657,9 @@ func (a *apexBundle) getOverrideManifestPackageName(ctx android.ModuleContext) s
}
return ""
}
if a.overridableProperties.Package_name != "" {
return a.overridableProperties.Package_name
}
manifestPackageName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(ctx.ModuleName())
if overridden {
return manifestPackageName