Loading tools/aapt2/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ cc_library_host_static { "compile/Pseudolocalizer.cpp", "compile/XmlIdCollector.cpp", "configuration/ConfigurationParser.cpp", "dump/DumpManifest.cpp", "filter/AbiFilter.cpp", "filter/ConfigFilter.cpp", "format/Archive.cpp", Loading tools/aapt2/LoadedApk.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -255,7 +255,7 @@ bool LoadedApk::WriteToArchive(IAaptContext* context, ResourceTable* split_table } std::unique_ptr<xml::XmlResource> LoadedApk::LoadXml(const std::string& file_path, IDiagnostics* diag) { IDiagnostics* diag) const { io::IFile* file = apk_->FindFile(file_path); if (file == nullptr) { diag->Error(DiagMessage() << "failed to find file"); Loading tools/aapt2/LoadedApk.h +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ class LoadedApk { IArchiveWriter* writer, xml::XmlResource* manifest = nullptr); /** Loads the file as an xml document. */ std::unique_ptr<xml::XmlResource> LoadXml(const std::string& file_path, IDiagnostics* diag); std::unique_ptr<xml::XmlResource> LoadXml(const std::string& file_path, IDiagnostics* diag) const; private: DISALLOW_COPY_AND_ASSIGN(LoadedApk); Loading tools/aapt2/cmd/Dump.cpp +21 −4 Original line number Diff line number Diff line Loading @@ -223,6 +223,12 @@ int DumpConfigsCommand::Action(const std::vector<std::string>& args) { return 1; } ResourceTable* table = loaded_apk->GetResourceTable(); if (!table) { diag_->Error(DiagMessage() << "Failed to retrieve resource table."); return 1; } io::FileOutputStream fout(STDOUT_FILENO, kStdOutBufferSize); Printer printer(&fout); Loading @@ -233,7 +239,7 @@ int DumpConfigsCommand::Action(const std::vector<std::string>& args) { // Insert the configurations into a set in order to keep every configuarion seen std::set<ConfigDescription, decltype(compare)> configs(compare); for (auto& package : loaded_apk->GetResourceTable()->packages) { for (auto& package : table->packages) { for (auto& type : package->types) { for (auto& entry : type->entries) { for (auto& value : entry->values) { Loading Loading @@ -267,10 +273,15 @@ int DumpStringsCommand::Action(const std::vector<std::string>& args) { return 1; } ResourceTable* table = loaded_apk->GetResourceTable(); if (!table) { diag_->Error(DiagMessage() << "Failed to retrieve resource table."); return 1; } // Load the run-time xml string pool using the flattened data BigBuffer buffer(4096); StringPool::FlattenUtf8(&buffer, loaded_apk->GetResourceTable()->string_pool, context.GetDiagnostics()); StringPool::FlattenUtf8(&buffer, table->string_pool, context.GetDiagnostics()); auto data = buffer.to_string(); android::ResStringPool pool(data.data(), data.size(), false); Debug::DumpResStringPool(&pool, &printer); Loading Loading @@ -304,7 +315,13 @@ int DumpTableCommand::Action(const std::vector<std::string>& args) { printer.Println("Binary APK"); } Debug::PrintTable(*loaded_apk->GetResourceTable(), print_options, &printer); ResourceTable* table = loaded_apk->GetResourceTable(); if (!table) { diag_->Error(DiagMessage() << "Failed to retrieve resource table."); return 1; } Debug::PrintTable(*table, print_options, &printer); } return 0; Loading tools/aapt2/cmd/Dump.h +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "Command.h" #include "Debug.h" #include "dump/DumpManifest.h" namespace aapt { Loading Loading @@ -133,8 +134,10 @@ class DumpCommand : public Command { public: explicit DumpCommand(IDiagnostics* diag) : Command("dump", "d"), diag_(diag) { AddOptionalSubcommand(util::make_unique<DumpAPCCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpBadgingCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpConfigsCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpPackageNameCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpPermissionsCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpStringsCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpTableCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpXmlStringsCommand>(diag_)); Loading Loading
tools/aapt2/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ cc_library_host_static { "compile/Pseudolocalizer.cpp", "compile/XmlIdCollector.cpp", "configuration/ConfigurationParser.cpp", "dump/DumpManifest.cpp", "filter/AbiFilter.cpp", "filter/ConfigFilter.cpp", "format/Archive.cpp", Loading
tools/aapt2/LoadedApk.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -255,7 +255,7 @@ bool LoadedApk::WriteToArchive(IAaptContext* context, ResourceTable* split_table } std::unique_ptr<xml::XmlResource> LoadedApk::LoadXml(const std::string& file_path, IDiagnostics* diag) { IDiagnostics* diag) const { io::IFile* file = apk_->FindFile(file_path); if (file == nullptr) { diag->Error(DiagMessage() << "failed to find file"); Loading
tools/aapt2/LoadedApk.h +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ class LoadedApk { IArchiveWriter* writer, xml::XmlResource* manifest = nullptr); /** Loads the file as an xml document. */ std::unique_ptr<xml::XmlResource> LoadXml(const std::string& file_path, IDiagnostics* diag); std::unique_ptr<xml::XmlResource> LoadXml(const std::string& file_path, IDiagnostics* diag) const; private: DISALLOW_COPY_AND_ASSIGN(LoadedApk); Loading
tools/aapt2/cmd/Dump.cpp +21 −4 Original line number Diff line number Diff line Loading @@ -223,6 +223,12 @@ int DumpConfigsCommand::Action(const std::vector<std::string>& args) { return 1; } ResourceTable* table = loaded_apk->GetResourceTable(); if (!table) { diag_->Error(DiagMessage() << "Failed to retrieve resource table."); return 1; } io::FileOutputStream fout(STDOUT_FILENO, kStdOutBufferSize); Printer printer(&fout); Loading @@ -233,7 +239,7 @@ int DumpConfigsCommand::Action(const std::vector<std::string>& args) { // Insert the configurations into a set in order to keep every configuarion seen std::set<ConfigDescription, decltype(compare)> configs(compare); for (auto& package : loaded_apk->GetResourceTable()->packages) { for (auto& package : table->packages) { for (auto& type : package->types) { for (auto& entry : type->entries) { for (auto& value : entry->values) { Loading Loading @@ -267,10 +273,15 @@ int DumpStringsCommand::Action(const std::vector<std::string>& args) { return 1; } ResourceTable* table = loaded_apk->GetResourceTable(); if (!table) { diag_->Error(DiagMessage() << "Failed to retrieve resource table."); return 1; } // Load the run-time xml string pool using the flattened data BigBuffer buffer(4096); StringPool::FlattenUtf8(&buffer, loaded_apk->GetResourceTable()->string_pool, context.GetDiagnostics()); StringPool::FlattenUtf8(&buffer, table->string_pool, context.GetDiagnostics()); auto data = buffer.to_string(); android::ResStringPool pool(data.data(), data.size(), false); Debug::DumpResStringPool(&pool, &printer); Loading Loading @@ -304,7 +315,13 @@ int DumpTableCommand::Action(const std::vector<std::string>& args) { printer.Println("Binary APK"); } Debug::PrintTable(*loaded_apk->GetResourceTable(), print_options, &printer); ResourceTable* table = loaded_apk->GetResourceTable(); if (!table) { diag_->Error(DiagMessage() << "Failed to retrieve resource table."); return 1; } Debug::PrintTable(*table, print_options, &printer); } return 0; Loading
tools/aapt2/cmd/Dump.h +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include "Command.h" #include "Debug.h" #include "dump/DumpManifest.h" namespace aapt { Loading Loading @@ -133,8 +134,10 @@ class DumpCommand : public Command { public: explicit DumpCommand(IDiagnostics* diag) : Command("dump", "d"), diag_(diag) { AddOptionalSubcommand(util::make_unique<DumpAPCCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpBadgingCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpConfigsCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpPackageNameCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpPermissionsCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpStringsCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpTableCommand>(diag_)); AddOptionalSubcommand(util::make_unique<DumpXmlStringsCommand>(diag_)); Loading