summaryrefslogtreecommitdiff
path: root/tools/aapt2/Debug.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2024-11-13 13:57:20 -0800
committer Xin Li <delphij@google.com> 2024-11-13 14:01:00 -0800
commitde53d9657cd5e352984697fc130159c474e819a9 (patch)
tree79b7d2c74d20c83b9adaddfde7862240e4d3725e /tools/aapt2/Debug.cpp
parent70a1e5dcf316f8ddf6d1b3b00341c7a35a8dcc58 (diff)
parent8eecb1a1afe454e3233f27b06f9e5d41b5bec011 (diff)
Merge 24Q4 (ab/12406339) into aosp-main-future
Bug: 370570306 Merged-In: Ic2ffd5a1f4420121b958cadb726c3e805cda1434 Change-Id: If0f7008f8e699bf1fca8d20ee5e05877a61ea002
Diffstat (limited to 'tools/aapt2/Debug.cpp')
-rw-r--r--tools/aapt2/Debug.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp
index 6a17ef85a755..df1d51e37660 100644
--- a/tools/aapt2/Debug.cpp
+++ b/tools/aapt2/Debug.cpp
@@ -763,10 +763,35 @@ class ChunkPrinter {
pool->setTo(chunk, android::util::DeviceToHost32(
(reinterpret_cast<const ResChunk_header*>(chunk))->size));
- printer_->Print("\n");
+ printer_->Print(StringPrintf(" strings: %zd styles %zd flags: %s|%s\n", pool->size(),
+ pool->styleCount(), pool->isUTF8() ? "UTF-8" : "UTF-16",
+ pool->isSorted() ? "SORTED" : "NON-SORTED"));
for (size_t i = 0; i < pool->size(); i++) {
printer_->Print(StringPrintf("#%zd : %s\n", i, android::util::GetString(*pool, i).c_str()));
+ if (i < pool->styleCount()) {
+ printer_->Print(" [Style] ");
+ auto maybe_style = pool->styleAt(i);
+ if (!maybe_style) {
+ printer_->Print("??? missing\n");
+ } else {
+ std::vector<const ResStringPool_span*> spans;
+ for (auto style = maybe_style.value().unsafe_ptr();
+ style->name.index != android::ResStringPool_span::END; ++style) {
+ spans.push_back(style);
+ }
+ printer_->Print(StringPrintf("(%zd)", spans.size()));
+ if (!spans.empty()) {
+ printer_->Print(" :");
+ for (const auto& span : spans) {
+ printer_->Print(StringPrintf(
+ " %s:%u,%u", android::util::GetString(*pool, span->name.index).c_str(),
+ span->firstChar, span->lastChar));
+ }
+ printer_->Print("\n");
+ }
+ }
+ }
}
}