From 2ec8e1b71fae1417e7d4df09600956b2c67a4936 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Tue, 11 May 2021 08:28:00 -0700 Subject: [PATCH] Add to aapt2 (2/2) Fixes BinaryResourceParser loading of alias chunk and makes changes that did not get committed in 2fedba9a32d9e92344eaf6e9faf5b43e1bc2ae70. Bug: 183411356 Test: aapt2_test Change-Id: Ieff9166100019f38ddcfe900014709b15db24e43 --- libs/androidfw/AssetManager2.cpp | 4 ++-- tools/aapt2/format/binary/BinaryResourceParser.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp index 7d061fb27ff4c..320106a20b698 100644 --- a/libs/androidfw/AssetManager2.cpp +++ b/libs/androidfw/AssetManager2.cpp @@ -226,9 +226,9 @@ void AssetManager2::BuildDynamicRefTable() { // staging aliases can only be defined by the framework package (which is not a shared // library), the compile-time package id of the framework is the same across all packages // that compile against the framework. - for (const auto& package : iter2->packages_) { + for (const auto& package : iter->packages_) { for (const auto& entry : package.loaded_package_->GetAliasResourceIdMap()) { - iter->dynamic_ref_table->addAlias(entry.first, entry.second); + iter2->dynamic_ref_table->addAlias(entry.first, entry.second); } } } diff --git a/tools/aapt2/format/binary/BinaryResourceParser.cpp b/tools/aapt2/format/binary/BinaryResourceParser.cpp index 2ec01cd1f4b81..72eaa3561a023 100644 --- a/tools/aapt2/format/binary/BinaryResourceParser.cpp +++ b/tools/aapt2/format/binary/BinaryResourceParser.cpp @@ -255,7 +255,7 @@ bool BinaryResourceParser::ParsePackage(const ResChunk_header* chunk) { break; case android::RES_TABLE_STAGED_ALIAS_TYPE: - if (!ParseOverlayable(parser.chunk())) { + if (!ParseStagedAliases(parser.chunk())) { return false; } break; @@ -518,7 +518,7 @@ bool BinaryResourceParser::ParseStagedAliases(const ResChunk_header* chunk) { return false; } - // Set the staged if of the finalized resource. + // Set the staged id of the finalized resource. const auto& resource_name = iter->second; const StagedId staged_id_def{.id = staged_id}; if (!table_->AddResource(NewResourceBuilder(resource_name)