]> git.saurik.com Git - android/aapt.git/commitdiff
Fix aapt to be able to add configs from overlays.
authorDianne Hackborn <hackbod@google.com>
Sat, 15 Aug 2009 07:00:33 +0000 (00:00 -0700)
committerDianne Hackborn <hackbod@google.com>
Sat, 15 Aug 2009 07:00:33 +0000 (00:00 -0700)
Fixes a bug where any new configurations introduced in an overlay
would be half-way ignored (enough to result in a broken .apk).

AaptAssets.h
Resource.cpp

index 57243496f12d8ec3494aea623b5295c9ebdb0f29..32efa4e9c52da8adc2ccef4a6153fe6af5217365 100644 (file)
@@ -482,6 +482,8 @@ public:
                      const sp<AaptFile>& file,
                      const String8& resType);
 
+    void addGroupEntry(const AaptGroupEntry& entry) { mGroupEntries.add(entry); }
+    
     ssize_t slurpFromArgs(Bundle* bundle);
 
     virtual ssize_t slurpFullTree(Bundle* bundle,
index 9d2ed1044b3eb30e4d57104dc165ee8aa9be342a..1fa7b18b11ab8986f6eb467174887ed6713b3ff5 100644 (file)
@@ -472,11 +472,22 @@ static bool applyFileOverlay(const sp<AaptAssets>& assets,
                             // didn't find a match fall through and add it..
                         }
                         baseGroup->addFile(overlayFiles.valueAt(overlayGroupIndex));
+                        assets->addGroupEntry(overlayFiles.keyAt(overlayGroupIndex));
                     }
                 } else {
                     // this group doesn't exist (a file that's only in the overlay)
                     baseSet->add(overlaySet->keyAt(overlayIndex),
                             overlaySet->valueAt(overlayIndex));
+                    // make sure all flavors are defined in the resources.
+                    sp<AaptGroup> overlayGroup = overlaySet->valueAt(overlayIndex);
+                    DefaultKeyedVector<AaptGroupEntry, sp<AaptFile> > overlayFiles = 
+                            overlayGroup->getFiles();
+                    size_t overlayGroupSize = overlayFiles.size();
+                    for (size_t overlayGroupIndex = 0; 
+                            overlayGroupIndex<overlayGroupSize; 
+                            overlayGroupIndex++) {
+                        assets->addGroupEntry(overlayFiles.keyAt(overlayGroupIndex));
+                    }
                 }
             }
             // this overlay didn't have resources for this type