Fix ordering of overlays

Device overlays are passed to Soong in highest priority to lowest
priority order, but aapt2 keeps the last value provided on the
command line.  Reverse the order that overlayGlobResults are
collected.

Bug: 71595164
Test: app_test.go
Change-Id: Ibc6b8297f1548766c5c92f3be969b89736dc8dff
This commit is contained in:
Colin Cross 2018-01-04 14:50:13 -08:00
parent 3144dfc966
commit 68a7023436
2 changed files with 8 additions and 4 deletions

View File

@ -412,7 +412,11 @@ func (overlaySingleton) GenerateBuildActions(ctx android.SingletonContext) {
}
var overlayData []overlayGlobResult
for _, overlay := range ctx.Config().ResourceOverlays() {
overlayDirs := ctx.Config().ResourceOverlays()
for i := range overlayDirs {
// Iterate backwards through the list of overlay directories so that the later, lower-priority
// directories in the list show up earlier in the command line to aapt2.
overlay := overlayDirs[len(overlayDirs)-1-i]
var result overlayGlobResult
result.dir = overlay

View File

@ -111,13 +111,13 @@ var testEnforceRROTests = []struct {
enforceRROTargets: nil,
enforceRROExcludedOverlays: nil,
fooOverlayFiles: []string{
"device/vendor/blah/overlay/foo/res/values/strings.xml",
"device/vendor/blah/static_overlay/foo/res/values/strings.xml",
"device/vendor/blah/overlay/foo/res/values/strings.xml",
},
fooRRODirs: nil,
barOverlayFiles: []string{
"device/vendor/blah/overlay/bar/res/values/strings.xml",
"device/vendor/blah/static_overlay/bar/res/values/strings.xml",
"device/vendor/blah/overlay/bar/res/values/strings.xml",
},
barRRODirs: nil,
},
@ -132,8 +132,8 @@ var testEnforceRROTests = []struct {
"device/vendor/blah/overlay/foo/res",
},
barOverlayFiles: []string{
"device/vendor/blah/overlay/bar/res/values/strings.xml",
"device/vendor/blah/static_overlay/bar/res/values/strings.xml",
"device/vendor/blah/overlay/bar/res/values/strings.xml",
},
barRRODirs: nil,
},