diff options
author | Donald Chai <dchai@google.com> | 2017-10-12 21:00:45 -0700 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-10-27 14:44:14 +0000 |
commit | b9474a64b317d4fb36a6fa78f96137cc68db1a96 (patch) | |
tree | b55a8028605b273b0df33d0ca1ee1f1be7ba95cf | |
parent | 0a3a474e46e41803fb7dd18d5653ce052916e5ca (diff) | |
download | base-b9474a64b317d4fb36a6fa78f96137cc68db1a96.tar.gz |
AAPT: treat "-I" with lower precedence than main APK for dumping.
This is the desired behavior if resource IDs may overlap, and also happens to
improve the behavior of:
aapt dump -I base.apk badging feature.apk
when both APKs use the same package name with different package IDs
(base=0x7F, feature=0x80). Previously, the final call to
DynamicRefTable::addMapping was for base.apk, and all references to 0x80 were
rewritten in DynamicRefTable::lookupResourceId to 0x7F. After this
change resources defined in both APKs are resolved correctly.
Note that this is a bit of kludge, and APKs should use different names
to avoid conflating the package IDs.
Fixes: 67070085
Bug: 64058531
Test: manual with sample in b/67070085#comment2
Change-Id: I285adb6f44a297440b08fc7a1f9ad73c700eb9bc
(cherry picked from commit d1ac6e1f9ea3a4d6c0d6d4a118c61526b8234a5f)
(cherry picked from commit 94251fac62b12f030c404132a395fdef73e7ab29)
-rw-r--r-- | tools/aapt/Command.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index ba731801e507..63f1802fdf2e 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -757,12 +757,8 @@ int doDump(Bundle* bundle) AssetManager assets; int32_t assetsCookie; - if (!assets.addAssetPath(String8(filename), &assetsCookie)) { - fprintf(stderr, "ERROR: dump failed because assets could not be loaded\n"); - return 1; - } - // Now add any dependencies passed in. + // Add any dependencies passed in. for (size_t i = 0; i < bundle->getPackageIncludes().size(); i++) { const String8& assetPath = bundle->getPackageIncludes()[i]; if (!assets.addAssetPath(assetPath, NULL)) { @@ -771,6 +767,11 @@ int doDump(Bundle* bundle) } } + if (!assets.addAssetPath(String8(filename), &assetsCookie)) { + fprintf(stderr, "ERROR: dump failed because assets could not be loaded\n"); + return 1; + } + // Make a dummy config for retrieving resources... we need to supply // non-default values for some configs so that we can retrieve resources // in the app that don't have a default. The most important of these is |