diff options
-rw-r--r-- | tools/aapt2/Debug.cpp | 10 | ||||
-rw-r--r-- | tools/aapt2/ResourceTable.h | 7 | ||||
-rw-r--r-- | tools/aapt2/format/binary/TableFlattener.cpp | 7 |
3 files changed, 19 insertions, 5 deletions
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp index df878899fa28..cac4edd8db21 100644 --- a/tools/aapt2/Debug.cpp +++ b/tools/aapt2/Debug.cpp @@ -265,6 +265,16 @@ void Debug::PrintTable(const ResourceTable& table, const DebugPrintTableOptions& ValueHeadlinePrinter headline_printer(package.name, printer); ValueBodyPrinter body_printer(package.name, printer); + auto& dynamicRefTable = table.GetReferencedPackages(); + if (!dynamicRefTable.empty()) { + printer->Println(StringPrintf("DynamicRefTable entryCount=%d", int(dynamicRefTable.size()))); + printer->Indent(); + for (auto&& [id, name] : dynamicRefTable) { + printer->Println(StringPrintf("0x%02x -> %s", id, name.c_str())); + } + printer->Undent(); + } + printer->Print("Package name="); printer->Print(package.name); if (package.id) { diff --git a/tools/aapt2/ResourceTable.h b/tools/aapt2/ResourceTable.h index bb286a8abdaa..61e399c7ab68 100644 --- a/tools/aapt2/ResourceTable.h +++ b/tools/aapt2/ResourceTable.h @@ -307,6 +307,11 @@ class ResourceTable { // order. ResourceTableView GetPartitionedView(const ResourceTableViewOptions& options = {}) const; + using ReferencedPackages = std::map<uint8_t, std::string>; + const ReferencedPackages& GetReferencedPackages() const { + return included_packages_; + } + struct SearchResult { ResourceTablePackage* package; ResourceTableType* type; @@ -342,7 +347,7 @@ class ResourceTable { // Set of dynamic packages that this table may reference. Their package names get encoded // into the resources.arsc along with their compile-time assigned IDs. - std::map<size_t, std::string> included_packages_; + ReferencedPackages included_packages_; private: DISALLOW_COPY_AND_ASSIGN(ResourceTable); diff --git a/tools/aapt2/format/binary/TableFlattener.cpp b/tools/aapt2/format/binary/TableFlattener.cpp index 8c594ba553a0..a1953c6966af 100644 --- a/tools/aapt2/format/binary/TableFlattener.cpp +++ b/tools/aapt2/format/binary/TableFlattener.cpp @@ -68,9 +68,8 @@ struct OverlayableChunk { class PackageFlattener { public: PackageFlattener(IAaptContext* context, const ResourceTablePackageView& package, - const std::map<size_t, std::string>* shared_libs, - SparseEntriesMode sparse_entries, - bool compact_entries, + const ResourceTable::ReferencedPackages* shared_libs, + SparseEntriesMode sparse_entries, bool compact_entries, bool collapse_key_stringpool, const std::set<ResourceName>& name_collapse_exemptions, bool deduplicate_entry_values) @@ -548,7 +547,7 @@ class PackageFlattener { IAaptContext* context_; android::IDiagnostics* diag_; const ResourceTablePackageView package_; - const std::map<size_t, std::string>* shared_libs_; + const ResourceTable::ReferencedPackages* shared_libs_; SparseEntriesMode sparse_entries_; bool compact_entries_; android::StringPool type_pool_; |