Fix aapt2 dump xmltree not escape text nodes

The text of CDATA in XML document should be escaped before the CDATA
text is printed.

Dump xmltree command use XmlPrinter inheriting from xml:ConstVisitor.
To fix issue, it only needs to modify
XmlPrinter::Visit(const xml::Text).

Bug: 140373430
Test: aapt2 dump xmltree --file res/xml/test.xml app_debug.apk

Change-Id: I4f43120b4fbc2ea7136fb51fdeb24e254b94c60f
diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp
index dfa2291..f9e52b4 100644
--- a/tools/aapt2/Debug.cpp
+++ b/tools/aapt2/Debug.cpp
@@ -33,6 +33,7 @@
 #include "ValueVisitor.h"
 #include "android-base/logging.h"
 #include "android-base/stringprintf.h"
+#include "androidfw/ResourceTypes.h"
 #include "idmap2/Policies.h"
 #include "text/Printer.h"
 #include "util/Util.h"
@@ -515,7 +516,8 @@
   }
 
   void Visit(const xml::Text* text) override {
-    printer_->Println(StringPrintf("T: '%s'", text->text.c_str()));
+    printer_->Println(
+        StringPrintf("T: '%s'", android::ResTable::normalizeForOutput(text->text.c_str()).c_str()));
   }
 
  private: