AAPT2: Fix processing of quotes in XML
When processing attributes in XML, quotes can't be used to mark a
section as whitespace preserving, so the assumption should be that the
entire string is whitespace preserving, which makes quote characters
literals.
Bug: 62840718
Bug: 62840406
Test: make aapt2_tests
Change-Id: I4afff02148b5b8e78833abf1f323c2f5325d6155
diff --git a/tools/aapt2/util/Util.h b/tools/aapt2/util/Util.h
index 8bca9dd..410258c 100644
--- a/tools/aapt2/util/Util.h
+++ b/tools/aapt2/util/Util.h
@@ -171,6 +171,8 @@
class StringBuilder {
public:
+ explicit StringBuilder(bool preserve_spaces = false);
+
StringBuilder& Append(const android::StringPiece& str);
const std::string& ToString() const;
const std::string& Error() const;
@@ -184,6 +186,7 @@
explicit operator bool() const;
private:
+ bool preserve_spaces_;
std::string str_;
size_t utf16_len_ = 0;
bool quote_ = false;