summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceUtils.cpp
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2017-10-20 19:15:54 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-10-20 19:15:54 +0000
commit7fd74b5ad1df53b92f08a9aa2f3d445bf7b786fe (patch)
tree03bbf941ec0fead1ad64ba2acd06113486a612c1 /tools/aapt2/ResourceUtils.cpp
parent4bf7416a062af25574f548846e60e88df332cc55 (diff)
parente59f0d80ec19249f72c07ae191ad673d040443e3 (diff)
Merge changes I1a4b3ce5,Id7216e5b
* changes: AAPT2: Enable building proto artifacts AAPT2: Define and Implement AAPT Container Format
Diffstat (limited to 'tools/aapt2/ResourceUtils.cpp')
-rw-r--r--tools/aapt2/ResourceUtils.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp
index 6fac6e9dfefe..24187d96fec5 100644
--- a/tools/aapt2/ResourceUtils.cpp
+++ b/tools/aapt2/ResourceUtils.cpp
@@ -704,8 +704,15 @@ std::unique_ptr<Item> ParseBinaryResValue(const ResourceType& type, const Config
} else {
if (type != ResourceType::kString && util::StartsWith(str, "res/")) {
// This must be a FileReference.
- return util::make_unique<FileReference>(dst_pool->MakeRef(
- str, StringPool::Context(StringPool::Context::kHighPriority, config)));
+ std::unique_ptr<FileReference> file_ref =
+ util::make_unique<FileReference>(dst_pool->MakeRef(
+ str, StringPool::Context(StringPool::Context::kHighPriority, config)));
+ if (util::EndsWith(*file_ref->path, ".xml")) {
+ file_ref->type = ResourceFile::Type::kBinaryXml;
+ } else if (util::EndsWith(*file_ref->path, ".png")) {
+ file_ref->type = ResourceFile::Type::kPng;
+ }
+ return std::move(file_ref);
}
// There are no styles associated with this string, so treat it as a simple string.