diff options
author | Mohamed Heikal <mheikal@google.com> | 2019-07-08 15:06:39 -0400 |
---|---|---|
committer | Mohamed Heikal <mheikal@google.com> | 2019-07-08 16:28:42 -0400 |
commit | 61d528f49d7d5d17159a9c87813fa061854e39f6 (patch) | |
tree | 6d82fe66681c5064e49f31d28c2b1ddebc4013e9 /tools/aapt2/optimize/ResourcePathShortener_test.cpp | |
parent | 59dc6124c842503d57d279b1f0139ae1302675f2 (diff) |
Fix bug where aapt2 optimize obfuscated color-* resources
aapt2 optimize --enable-resource-path-shortening should ignore res/color
resources since android uses the path while loading them. This cl fixes
a bug where res/color-* (eg: res/color-v21) resource paths are shortened
when they should not be.
Test: make aapt2_tests
Bug: b/75965637
Change-Id: Ibbc3fe4d2e6bd4f31765a5aa85980907dc013ecd
Diffstat (limited to 'tools/aapt2/optimize/ResourcePathShortener_test.cpp')
-rw-r--r-- | tools/aapt2/optimize/ResourcePathShortener_test.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/aapt2/optimize/ResourcePathShortener_test.cpp b/tools/aapt2/optimize/ResourcePathShortener_test.cpp index efbef8f40722..1f4569495186 100644 --- a/tools/aapt2/optimize/ResourcePathShortener_test.cpp +++ b/tools/aapt2/optimize/ResourcePathShortener_test.cpp @@ -75,6 +75,9 @@ TEST(ResourcePathShortenerTest, SkipColorFileRefPaths) { std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder() .AddFileReference("android:color/colorlist", "res/color/colorlist.xml") + .AddFileReference("android:color/colorlist", + "res/color-mdp-v21/colorlist.xml", + test::ParseConfigOrDie("mdp-v21")) .Build(); std::map<std::string, std::string> path_map; @@ -82,6 +85,7 @@ TEST(ResourcePathShortenerTest, SkipColorFileRefPaths) { // Expect that the path map to not contain the ColorStateList ASSERT_THAT(path_map.find("res/color/colorlist.xml"), Eq(path_map.end())); + ASSERT_THAT(path_map.find("res/color-mdp-v21/colorlist.xml"), Eq(path_map.end())); } TEST(ResourcePathShortenerTest, KeepExtensions) { |