diff options
author | Adam Lesinski <adamlesinski@google.com> | 2014-05-13 10:56:25 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2014-05-13 10:57:53 -0700 |
commit | 3921e87e6e67a063caa1987937d7944b24aef489 (patch) | |
tree | 270ce25d67ef36d099483df96d65179fcba1d23b /tools | |
parent | da86f784b686ba00d9f797b8ee565629669080b9 (diff) | |
download | frameworks_base-3921e87e6e67a063caa1987937d7944b24aef489.zip frameworks_base-3921e87e6e67a063caa1987937d7944b24aef489.tar.gz frameworks_base-3921e87e6e67a063caa1987937d7944b24aef489.tar.bz2 |
Quick fix to ensure mipmap doesn't get stripped by AAPT
This is a quick fix. A refactoring is already underway to properly
solve this problem.
Bug:14857725
Change-Id: Ic0c475aa0b180803a687904ad9f71eb87e137a25
Diffstat (limited to 'tools')
-rw-r--r-- | tools/aapt/ApkBuilder.h | 4 | ||||
-rw-r--r-- | tools/aapt/Command.cpp | 17 |
2 files changed, 18 insertions, 3 deletions
diff --git a/tools/aapt/ApkBuilder.h b/tools/aapt/ApkBuilder.h index a4b7d4a..db23c84 100644 --- a/tools/aapt/ApkBuilder.h +++ b/tools/aapt/ApkBuilder.h @@ -55,6 +55,10 @@ public: return mSplits; } + android::sp<ApkSplit> getBaseSplit() { + return mSplits[0]; + } + void print() const; private: diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 0360200..dca25e5 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -2035,10 +2035,16 @@ bail: return (result != NO_ERROR); } -static status_t addResourcesToBuilder(const sp<AaptDir>& dir, const sp<ApkBuilder>& builder) { +static status_t addResourcesToBuilder(const sp<AaptDir>& dir, const sp<ApkBuilder>& builder, bool ignoreConfig=false) { const size_t numDirs = dir->getDirs().size(); for (size_t i = 0; i < numDirs; i++) { - status_t err = addResourcesToBuilder(dir->getDirs().valueAt(i), builder); + bool ignore = ignoreConfig; + const sp<AaptDir>& subDir = dir->getDirs().valueAt(i); + const char* dirStr = subDir->getLeaf().string(); + if (!ignore && strstr(dirStr, "mipmap") == dirStr) { + ignore = true; + } + status_t err = addResourcesToBuilder(subDir, builder, ignore); if (err != NO_ERROR) { return err; } @@ -2049,7 +2055,12 @@ static status_t addResourcesToBuilder(const sp<AaptDir>& dir, const sp<ApkBuilde sp<AaptGroup> gp = dir->getFiles().valueAt(i); const size_t numConfigs = gp->getFiles().size(); for (size_t j = 0; j < numConfigs; j++) { - status_t err = builder->addEntry(gp->getPath(), gp->getFiles().valueAt(j)); + status_t err = NO_ERROR; + if (ignoreConfig) { + err = builder->getBaseSplit()->addEntry(gp->getPath(), gp->getFiles().valueAt(j)); + } else { + err = builder->addEntry(gp->getPath(), gp->getFiles().valueAt(j)); + } if (err != NO_ERROR) { fprintf(stderr, "Failed to add %s (%s) to builder.\n", gp->getPath().string(), gp->getFiles()[j]->getPrintableSource().string()); |