Loading tools/aapt2/cmd/Link.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -251,10 +251,11 @@ class FeatureSplitSymbolTableDelegate : public DefaultSymbolTableDelegate { }; static bool FlattenXml(IAaptContext* context, xml::XmlResource* xml_res, const StringPiece& path, bool keep_raw_values, IArchiveWriter* writer) { bool keep_raw_values, bool utf16, IArchiveWriter* writer) { BigBuffer buffer(1024); XmlFlattenerOptions options = {}; options.keep_raw_values = keep_raw_values; options.use_utf16 = utf16; XmlFlattener flattener(&buffer, options); if (!flattener.Consume(context, xml_res)) { return false; Loading Loading @@ -599,7 +600,7 @@ bool ResourceFileFlattener::Flatten(ResourceTable* table, IArchiveWriter* archiv } } error |= !FlattenXml(context_, doc.get(), dst_path, options_.keep_raw_values, archive_writer); false /*utf16*/, archive_writer); } } else { error |= !io::CopyFileToArchive(context_, file_op.file_to_copy, file_op.dst_path, Loading Loading @@ -1383,7 +1384,8 @@ class LinkCommand { bool WriteApk(IArchiveWriter* writer, proguard::KeepSet* keep_set, xml::XmlResource* manifest, ResourceTable* table) { const bool keep_raw_values = context_->GetPackageType() == PackageType::kStaticLib; bool result = FlattenXml(context_, manifest, "AndroidManifest.xml", keep_raw_values, writer); bool result = FlattenXml(context_, manifest, "AndroidManifest.xml", keep_raw_values, true /*utf16*/, writer); if (!result) { return false; } Loading tools/aapt2/flatten/XmlFlattener.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -314,7 +314,11 @@ bool XmlFlattener::Flatten(IAaptContext* context, xml::Node* node) { xml_header_writer.StartChunk<ResXMLTree_header>(RES_XML_TYPE); // Flatten the StringPool. if (options_.use_utf16) { StringPool::FlattenUtf16(buffer_, visitor.pool); } else { StringPool::FlattenUtf8(buffer_, visitor.pool); } { // Write the array of resource IDs, indexed by StringPool order. Loading tools/aapt2/flatten/XmlFlattener.h +4 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,10 @@ struct XmlFlattenerOptions { * Keep attribute raw string values along with typed values. */ bool keep_raw_values = false; // Encode the strings in UTF-16. Only needed for AndroidManifest.xml to avoid a bug in // certain non-AOSP platforms: https://issuetracker.google.com/64434571 bool use_utf16 = false; }; class XmlFlattener : public IXmlResourceConsumer { Loading Loading
tools/aapt2/cmd/Link.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -251,10 +251,11 @@ class FeatureSplitSymbolTableDelegate : public DefaultSymbolTableDelegate { }; static bool FlattenXml(IAaptContext* context, xml::XmlResource* xml_res, const StringPiece& path, bool keep_raw_values, IArchiveWriter* writer) { bool keep_raw_values, bool utf16, IArchiveWriter* writer) { BigBuffer buffer(1024); XmlFlattenerOptions options = {}; options.keep_raw_values = keep_raw_values; options.use_utf16 = utf16; XmlFlattener flattener(&buffer, options); if (!flattener.Consume(context, xml_res)) { return false; Loading Loading @@ -599,7 +600,7 @@ bool ResourceFileFlattener::Flatten(ResourceTable* table, IArchiveWriter* archiv } } error |= !FlattenXml(context_, doc.get(), dst_path, options_.keep_raw_values, archive_writer); false /*utf16*/, archive_writer); } } else { error |= !io::CopyFileToArchive(context_, file_op.file_to_copy, file_op.dst_path, Loading Loading @@ -1383,7 +1384,8 @@ class LinkCommand { bool WriteApk(IArchiveWriter* writer, proguard::KeepSet* keep_set, xml::XmlResource* manifest, ResourceTable* table) { const bool keep_raw_values = context_->GetPackageType() == PackageType::kStaticLib; bool result = FlattenXml(context_, manifest, "AndroidManifest.xml", keep_raw_values, writer); bool result = FlattenXml(context_, manifest, "AndroidManifest.xml", keep_raw_values, true /*utf16*/, writer); if (!result) { return false; } Loading
tools/aapt2/flatten/XmlFlattener.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -314,7 +314,11 @@ bool XmlFlattener::Flatten(IAaptContext* context, xml::Node* node) { xml_header_writer.StartChunk<ResXMLTree_header>(RES_XML_TYPE); // Flatten the StringPool. if (options_.use_utf16) { StringPool::FlattenUtf16(buffer_, visitor.pool); } else { StringPool::FlattenUtf8(buffer_, visitor.pool); } { // Write the array of resource IDs, indexed by StringPool order. Loading
tools/aapt2/flatten/XmlFlattener.h +4 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,10 @@ struct XmlFlattenerOptions { * Keep attribute raw string values along with typed values. */ bool keep_raw_values = false; // Encode the strings in UTF-16. Only needed for AndroidManifest.xml to avoid a bug in // certain non-AOSP platforms: https://issuetracker.google.com/64434571 bool use_utf16 = false; }; class XmlFlattener : public IXmlResourceConsumer { Loading