diff options
Diffstat (limited to 'tools/aapt2/ResourceUtils.cpp')
-rw-r--r-- | tools/aapt2/ResourceUtils.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp index f193fe0c6593..02ac86c94b46 100644 --- a/tools/aapt2/ResourceUtils.cpp +++ b/tools/aapt2/ResourceUtils.cpp @@ -23,12 +23,12 @@ #include "NameMangler.h" #include "SdkConstants.h" -#include "flatten/ResourceTypeExtensions.h" +#include "format/binary/ResourceTypeExtensions.h" #include "util/Files.h" #include "util/Util.h" -using android::StringPiece; -using android::StringPiece16; +using ::android::StringPiece; +using ::android::StringPiece16; namespace aapt { namespace ResourceUtils { @@ -704,8 +704,17 @@ 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 (type == ResourceType::kRaw) { + file_ref->type = ResourceFile::Type::kUnknown; + } else 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. |