summaryrefslogtreecommitdiff
path: root/tools/aapt2/Debug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/Debug.cpp')
-rw-r--r--tools/aapt2/Debug.cpp67
1 files changed, 30 insertions, 37 deletions
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp
index 82da24959521..ef3a62f4efcc 100644
--- a/tools/aapt2/Debug.cpp
+++ b/tools/aapt2/Debug.cpp
@@ -256,57 +256,41 @@ class ValueBodyPrinter : public ConstValueVisitor {
void Debug::PrintTable(const ResourceTable& table, const DebugPrintTableOptions& options,
Printer* printer) {
- for (const auto& package : table.packages) {
- ValueHeadlinePrinter headline_printer(package->name, printer);
- ValueBodyPrinter body_printer(package->name, printer);
+ const auto table_view = table.GetPartitionedView();
+ for (const auto& package : table_view.packages) {
+ ValueHeadlinePrinter headline_printer(package.name, printer);
+ ValueBodyPrinter body_printer(package.name, printer);
printer->Print("Package name=");
- printer->Print(package->name);
- if (package->id) {
- printer->Print(StringPrintf(" id=%02x", package->id.value()));
+ printer->Print(package.name);
+ if (package.id) {
+ printer->Print(StringPrintf(" id=%02x", package.id.value()));
}
printer->Println();
printer->Indent();
- for (const auto& type : package->types) {
+ for (const auto& type : package.types) {
printer->Print("type ");
- printer->Print(to_string(type->type));
- if (type->id) {
- printer->Print(StringPrintf(" id=%02x", type->id.value()));
- }
- printer->Println(StringPrintf(" entryCount=%zd", type->entries.size()));
-
- std::vector<const ResourceEntry*> sorted_entries;
- for (const auto& entry : type->entries) {
- auto iter = std::lower_bound(
- sorted_entries.begin(), sorted_entries.end(), entry.get(),
- [](const ResourceEntry* a, const ResourceEntry* b) -> bool {
- if (a->id && b->id) {
- return a->id.value() < b->id.value();
- } else if (a->id) {
- return true;
- } else {
- return false;
- }
- });
- sorted_entries.insert(iter, entry.get());
+ printer->Print(to_string(type.type));
+ if (type.id) {
+ printer->Print(StringPrintf(" id=%02x", type.id.value()));
}
+ printer->Println(StringPrintf(" entryCount=%zd", type.entries.size()));
printer->Indent();
- for (const ResourceEntry* entry : sorted_entries) {
- const ResourceId id(package->id.value_or_default(0), type->id.value_or_default(0),
- entry->id.value_or_default(0));
-
+ for (const ResourceTableEntryView& entry : type.entries) {
printer->Print("resource ");
- printer->Print(id.to_string());
+ printer->Print(ResourceId(package.id.value_or_default(0), type.id.value_or_default(0),
+ entry.id.value_or_default(0))
+ .to_string());
printer->Print(" ");
// Write the name without the package (this is obvious and too verbose).
- printer->Print(to_string(type->type));
+ printer->Print(to_string(type.type));
printer->Print("/");
- printer->Print(entry->name);
+ printer->Print(entry.name);
- switch (entry->visibility.level) {
+ switch (entry.visibility.level) {
case Visibility::Level::kPublic:
printer->Print(" PUBLIC");
break;
@@ -318,15 +302,24 @@ void Debug::PrintTable(const ResourceTable& table, const DebugPrintTableOptions&
break;
}
- if (entry->overlayable_item) {
+ if (entry.visibility.staged_api) {
+ printer->Print(" STAGED");
+ }
+
+ if (entry.overlayable_item) {
printer->Print(" OVERLAYABLE");
}
+ if (entry.staged_id) {
+ printer->Print(" STAGED_ID=");
+ printer->Print(entry.staged_id.value().id.to_string());
+ }
+
printer->Println();
if (options.show_values) {
printer->Indent();
- for (const auto& value : entry->values) {
+ for (const auto& value : entry.values) {
printer->Print("(");
printer->Print(value->config.to_string());
printer->Print(") ");