Add support for auto-generated characteristics RRO

Setting Generate_product_characteristics_rro will automatically generate
an RRO package which contains resources with
'product="{PRODUCT_CHARACTERISTICS}"'. The RRO package will be installed
to /product partition. The app will be compiled with '--product
default', making the app identical to all targets.

Motivation for this change is to minimize divergence of system.img.

Bug: 294799593
Test: boot and idmap2 dump
Change-Id: I1371f7410a1ecf337e1f73214b024af39aa6d57a
This commit is contained in:
Inseob Kim
2023-11-07 13:37:14 +09:00
parent 5876a78543
commit 34dc4cd738
4 changed files with 111 additions and 7 deletions

View File

@@ -102,6 +102,9 @@ type aaptProperties struct {
// true if RRO is enforced for any of the dependent modules
RROEnforcedForDependent bool `blueprint:"mutated"`
// Filter only specified product and ignore other products
Filter_product *string `blueprint:"mutated"`
}
type aapt struct {
@@ -162,6 +165,10 @@ func (a *aapt) useResourceProcessorBusyBox() bool {
return BoolDefault(a.aaptProperties.Use_resource_processor, false)
}
func (a *aapt) filterProduct() string {
return String(a.aaptProperties.Filter_product)
}
func (a *aapt) ExportPackage() android.Path {
return a.exportPackage
}
@@ -432,7 +439,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, opts aaptBuildActionOptio
var compiledResDirs []android.Paths
for _, dir := range resDirs {
a.resourceFiles = append(a.resourceFiles, dir.files...)
compiledResDirs = append(compiledResDirs, aapt2Compile(ctx, dir.dir, dir.files, compileFlags).Paths())
compiledResDirs = append(compiledResDirs, aapt2Compile(ctx, dir.dir, dir.files, compileFlags, a.filterProduct()).Paths())
}
for i, zip := range resZips {
@@ -491,7 +498,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, opts aaptBuildActionOptio
}
for _, dir := range overlayDirs {
compiledOverlay = append(compiledOverlay, aapt2Compile(ctx, dir.dir, dir.files, compileFlags).Paths()...)
compiledOverlay = append(compiledOverlay, aapt2Compile(ctx, dir.dir, dir.files, compileFlags, a.filterProduct()).Paths()...)
}
var splitPackages android.WritablePaths