Allow overriding rro category in override_runtime_resource_overlay

Bug: 240322840
Test: unit tests
Change-Id: I6b07cf57dc113e3805346e50ef9896471df9f53c
This commit is contained in:
Jeremy Meyer 2022-10-07 18:21:34 +00:00
parent 3a56f5e0e0
commit 7e671297c7
2 changed files with 11 additions and 0 deletions

View file

@ -142,6 +142,10 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC
aaptLinkFlags = append(aaptLinkFlags,
"--rename-overlay-target-package "+*r.overridableProperties.Target_package_name)
}
if r.overridableProperties.Category != nil {
aaptLinkFlags = append(aaptLinkFlags,
"--rename-overlay-category "+*r.overridableProperties.Category)
}
r.aapt.buildActions(ctx, r, nil, nil, false, aaptLinkFlags...)
// Sign the built package
@ -220,6 +224,9 @@ type OverridableRuntimeResourceOverlayProperties struct {
// the target package name of this overlay app. The target package name in the manifest file is used if one was not given.
Target_package_name *string
// the rro category of this overlay. The category in the manifest file is used if one was not given.
Category *string
}
type OverrideRuntimeResourceOverlay struct {

View file

@ -201,6 +201,7 @@ func TestOverrideRuntimeResourceOverlay(t *testing.T) {
base: "foo_overlay",
package_name: "com.android.bar.overlay",
target_package_name: "com.android.bar",
category: "mycategory",
}
`)
@ -212,6 +213,7 @@ func TestOverrideRuntimeResourceOverlay(t *testing.T) {
targetVariant string
packageFlag string
targetPackageFlag string
categoryFlag string
}{
{
variantName: "android_common",
@ -228,6 +230,7 @@ func TestOverrideRuntimeResourceOverlay(t *testing.T) {
targetVariant: "android_common_bar",
packageFlag: "com.android.bar.overlay",
targetPackageFlag: "com.android.bar",
categoryFlag: "mycategory",
},
}
for _, expected := range expectedVariants {
@ -249,6 +252,7 @@ func TestOverrideRuntimeResourceOverlay(t *testing.T) {
checkAapt2LinkFlag(t, aapt2Flags, "rename-manifest-package", expected.packageFlag)
checkAapt2LinkFlag(t, aapt2Flags, "rename-resources-package", "")
checkAapt2LinkFlag(t, aapt2Flags, "rename-overlay-target-package", expected.targetPackageFlag)
checkAapt2LinkFlag(t, aapt2Flags, "rename-overlay-category", expected.categoryFlag)
}
}