Loading tools/aapt2/optimize/ResourcePathShortener.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "ResourceTable.h" #include "ValueVisitor.h" #include "util/Util.h" static const std::string base64_chars = Loading Loading @@ -95,8 +96,8 @@ bool ResourcePathShortener::Consume(IAaptContext* context, ResourceTable* table) android::StringPiece res_subdir, actual_filename, extension; util::ExtractResFilePathParts(*file_ref->path, &res_subdir, &actual_filename, &extension); // Android detects ColorStateLists via pathname, skip res/color/* if (res_subdir == android::StringPiece("res/color/")) // Android detects ColorStateLists via pathname, skip res/color* if (util::StartsWith(res_subdir, "res/color")) continue; std::string shortened_filename = ShortenFileName(*file_ref->path, num_chars); Loading tools/aapt2/optimize/ResourcePathShortener_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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) { Loading Loading
tools/aapt2/optimize/ResourcePathShortener.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include "ResourceTable.h" #include "ValueVisitor.h" #include "util/Util.h" static const std::string base64_chars = Loading Loading @@ -95,8 +96,8 @@ bool ResourcePathShortener::Consume(IAaptContext* context, ResourceTable* table) android::StringPiece res_subdir, actual_filename, extension; util::ExtractResFilePathParts(*file_ref->path, &res_subdir, &actual_filename, &extension); // Android detects ColorStateLists via pathname, skip res/color/* if (res_subdir == android::StringPiece("res/color/")) // Android detects ColorStateLists via pathname, skip res/color* if (util::StartsWith(res_subdir, "res/color")) continue; std::string shortened_filename = ShortenFileName(*file_ref->path, num_chars); Loading
tools/aapt2/optimize/ResourcePathShortener_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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) { Loading