Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0af925c authored by Alexandria Cornwall's avatar Alexandria Cornwall
Browse files

AAPT2: Convert StringPool flattening to UTF-8

Convert StringPools in resources.arsc and binary XML files to use UTF-8
instead of UTF-16 to save lots of bytes.

Bug: 30053277
Change-Id: I8eb6c78644e51b15f89edadab71cc86f5a851a45
parent fd1ba564
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -244,7 +244,7 @@ public:
        StringPool::flattenUtf16(pkgWriter.getBuffer(), mTypePool);
        StringPool::flattenUtf16(pkgWriter.getBuffer(), mTypePool);


        pkgHeader->keyStrings = util::hostToDevice32(pkgWriter.size());
        pkgHeader->keyStrings = util::hostToDevice32(pkgWriter.size());
        StringPool::flattenUtf16(pkgWriter.getBuffer(), mKeyPool);
        StringPool::flattenUtf8(pkgWriter.getBuffer(), mKeyPool);


        // Append the types.
        // Append the types.
        buffer->appendBuffer(std::move(typeBuffer));
        buffer->appendBuffer(std::move(typeBuffer));
+1 −1
Original line number Original line Diff line number Diff line
@@ -289,7 +289,7 @@ bool XmlFlattener::flatten(IAaptContext* context, xml::Node* node) {
    xmlHeaderWriter.startChunk<ResXMLTree_header>(RES_XML_TYPE);
    xmlHeaderWriter.startChunk<ResXMLTree_header>(RES_XML_TYPE);


    // Flatten the StringPool.
    // Flatten the StringPool.
    StringPool::flattenUtf16(mBuffer, visitor.mPool);
    StringPool::flattenUtf8(mBuffer, visitor.mPool);


    {
    {
        // Write the array of resource IDs, indexed by StringPool order.
        // Write the array of resource IDs, indexed by StringPool order.