Use Config/DeviceConfig functions to access ProductVariables
An upcoming change will stop exporting ProductVariables from Config, so
switch to using existing accessor functions, and add more when they're
missing.
Bug: 76168832
Test: out/soong/build.ninja is identical
Change-Id: Ie0135bdbd2df3258ef3ddb53e5f8fc00aa9b97f7
diff --git a/java/app.go b/java/app.go
index ac88df7..c94d22f 100644
--- a/java/app.go
+++ b/java/app.go
@@ -362,15 +362,7 @@
overlayData := ctx.Config().Get(overlayDataKey).([]overlayGlobResult)
// Runtime resource overlays (RRO) may be turned on by the product config for some modules
- rroEnabled := false
- enforceRROTargets := ctx.Config().ProductVariables.EnforceRROTargets
- if enforceRROTargets != nil {
- if len(*enforceRROTargets) == 1 && (*enforceRROTargets)[0] == "*" {
- rroEnabled = true
- } else if inList(ctx.ModuleName(), *enforceRROTargets) {
- rroEnabled = true
- }
- }
+ rroEnabled := ctx.Config().EnforceRROForModule(ctx.ModuleName())
for _, data := range overlayData {
files := data.paths.PathsInDirectory(filepath.Join(data.dir, dir.String()))
@@ -400,13 +392,6 @@
type overlaySingleton struct{}
func (overlaySingleton) GenerateBuildActions(ctx android.SingletonContext) {
-
- // Specific overlays may be excluded from Runtime Resource Overlays by the product config
- var rroExcludedOverlays []string
- if ctx.Config().ProductVariables.EnforceRROExcludedOverlays != nil {
- rroExcludedOverlays = *ctx.Config().ProductVariables.EnforceRROExcludedOverlays
- }
-
var overlayData []overlayGlobResult
overlayDirs := ctx.Config().ResourceOverlays()
for i := range overlayDirs {
@@ -417,11 +402,8 @@
result.dir = overlay
// Mark overlays that will not have Runtime Resource Overlays enforced on them
- for _, exclude := range rroExcludedOverlays {
- if strings.HasPrefix(overlay, exclude) {
- result.excludeFromRRO = true
- }
- }
+ // based on the product config
+ result.excludeFromRRO = ctx.Config().EnforceRROExcludedOverlay(overlay)
files, err := ctx.GlobWithDeps(filepath.Join(overlay, "**/*"), aaptIgnoreFilenames)
if err != nil {