From: Dianne Hackborn Date: Sat, 15 Aug 2009 07:00:33 +0000 (-0700) Subject: Fix aapt to be able to add configs from overlays. X-Git-Url: https://git.saurik.com/android/aapt.git/commitdiff_plain/a76631e8a1142047b5671a7cb4e7c784cd8de423 Fix aapt to be able to add configs from overlays. Fixes a bug where any new configurations introduced in an overlay would be half-way ignored (enough to result in a broken .apk). --- diff --git a/AaptAssets.h b/AaptAssets.h index 5724349..32efa4e 100644 --- a/AaptAssets.h +++ b/AaptAssets.h @@ -482,6 +482,8 @@ public: const sp& file, const String8& resType); + void addGroupEntry(const AaptGroupEntry& entry) { mGroupEntries.add(entry); } + ssize_t slurpFromArgs(Bundle* bundle); virtual ssize_t slurpFullTree(Bundle* bundle, diff --git a/Resource.cpp b/Resource.cpp index 9d2ed10..1fa7b18 100644 --- a/Resource.cpp +++ b/Resource.cpp @@ -472,11 +472,22 @@ static bool applyFileOverlay(const sp& 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 overlayGroup = overlaySet->valueAt(overlayIndex); + DefaultKeyedVector > overlayFiles = + overlayGroup->getFiles(); + size_t overlayGroupSize = overlayFiles.size(); + for (size_t overlayGroupIndex = 0; + overlayGroupIndexaddGroupEntry(overlayFiles.keyAt(overlayGroupIndex)); + } } } // this overlay didn't have resources for this type