Loading libs/androidfw/LoadedArsc.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -416,7 +416,9 @@ std::unique_ptr<LoadedPackage> LoadedPackage::Load(const Chunk& chunk) { ATRACE_CALL(); std::unique_ptr<LoadedPackage> loaded_package{new LoadedPackage()}; const ResTable_package* header = chunk.header<ResTable_package>(); constexpr size_t kMinPackageSize = sizeof(ResTable_package) - sizeof(ResTable_package::typeIdOffset); const ResTable_package* header = chunk.header<ResTable_package, kMinPackageSize>(); if (header == nullptr) { LOG(ERROR) << "Chunk RES_TABLE_PACKAGE_TYPE is too small."; return {}; Loading tools/aapt2/Main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ namespace aapt { static const char* sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. static const char* sMinorVersion = "11"; static const char* sMinorVersion = "12"; int PrintVersion() { std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "." Loading tools/aapt2/readme.md +8 −0 Original line number Diff line number Diff line # Android Asset Packaging Tool 2.0 (AAPT2) release notes ## Version 2.12 ### `aapt2 optimize ...` - aapt2 optimize now understands map (complex) values under the type `id`. It ignores their contents and interprets them as a sentinel `id` type. This was added to support existing apps that build with their `id` types as map values. AAPT and AAPT2 always generate a simple value for the type `ID`, so it is unclear how some these apps are encoded. ## Version 2.11 ### `aapt2 link ...` - Adds the ability to specify assets directories with the -A parameter. Assets work just like Loading tools/aapt2/unflatten/BinaryResourceParser.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -168,10 +168,11 @@ bool BinaryResourceParser::ParseTable(const ResChunk_header* chunk) { } bool BinaryResourceParser::ParsePackage(const ResChunk_header* chunk) { const ResTable_package* package_header = ConvertTo<ResTable_package>(chunk); constexpr size_t kMinPackageSize = sizeof(ResTable_package) - sizeof(ResTable_package::typeIdOffset); const ResTable_package* package_header = ConvertTo<ResTable_package, kMinPackageSize>(chunk); if (!package_header) { context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt ResTable_package chunk"); context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt ResTable_package chunk"); return false; } Loading Loading @@ -498,8 +499,14 @@ std::unique_ptr<Value> BinaryResourceParser::ParseMapEntry( return ParseArray(name, config, map); case ResourceType::kPlurals: return ParsePlural(name, config, map); case ResourceType::kId: // Special case: An ID is not a bag, but some apps have defined the auto-generated // IDs that come from declaring an enum value in an attribute as an empty map... // We can ignore the value here. return util::make_unique<Id>(); default: LOG(FATAL) << "unknown map type"; context_->GetDiagnostics()->Error(DiagMessage() << "illegal map type '" << ToString(name.type) << "' (" << (int)name.type << ")"); break; } return {}; Loading Loading
libs/androidfw/LoadedArsc.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -416,7 +416,9 @@ std::unique_ptr<LoadedPackage> LoadedPackage::Load(const Chunk& chunk) { ATRACE_CALL(); std::unique_ptr<LoadedPackage> loaded_package{new LoadedPackage()}; const ResTable_package* header = chunk.header<ResTable_package>(); constexpr size_t kMinPackageSize = sizeof(ResTable_package) - sizeof(ResTable_package::typeIdOffset); const ResTable_package* header = chunk.header<ResTable_package, kMinPackageSize>(); if (header == nullptr) { LOG(ERROR) << "Chunk RES_TABLE_PACKAGE_TYPE is too small."; return {}; Loading
tools/aapt2/Main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ namespace aapt { static const char* sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. static const char* sMinorVersion = "11"; static const char* sMinorVersion = "12"; int PrintVersion() { std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "." Loading
tools/aapt2/readme.md +8 −0 Original line number Diff line number Diff line # Android Asset Packaging Tool 2.0 (AAPT2) release notes ## Version 2.12 ### `aapt2 optimize ...` - aapt2 optimize now understands map (complex) values under the type `id`. It ignores their contents and interprets them as a sentinel `id` type. This was added to support existing apps that build with their `id` types as map values. AAPT and AAPT2 always generate a simple value for the type `ID`, so it is unclear how some these apps are encoded. ## Version 2.11 ### `aapt2 link ...` - Adds the ability to specify assets directories with the -A parameter. Assets work just like Loading
tools/aapt2/unflatten/BinaryResourceParser.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -168,10 +168,11 @@ bool BinaryResourceParser::ParseTable(const ResChunk_header* chunk) { } bool BinaryResourceParser::ParsePackage(const ResChunk_header* chunk) { const ResTable_package* package_header = ConvertTo<ResTable_package>(chunk); constexpr size_t kMinPackageSize = sizeof(ResTable_package) - sizeof(ResTable_package::typeIdOffset); const ResTable_package* package_header = ConvertTo<ResTable_package, kMinPackageSize>(chunk); if (!package_header) { context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt ResTable_package chunk"); context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt ResTable_package chunk"); return false; } Loading Loading @@ -498,8 +499,14 @@ std::unique_ptr<Value> BinaryResourceParser::ParseMapEntry( return ParseArray(name, config, map); case ResourceType::kPlurals: return ParsePlural(name, config, map); case ResourceType::kId: // Special case: An ID is not a bag, but some apps have defined the auto-generated // IDs that come from declaring an enum value in an attribute as an empty map... // We can ignore the value here. return util::make_unique<Id>(); default: LOG(FATAL) << "unknown map type"; context_->GetDiagnostics()->Error(DiagMessage() << "illegal map type '" << ToString(name.type) << "' (" << (int)name.type << ")"); break; } return {}; Loading