[RPBB+aapt2] Re-escape XML characters when converting protobuf format back to XML.
RELNOTES: Fixed treatment of AndroidManifest.xml attributes which contained XML escaping
@@ -40,6 +40,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.ByteStreams;
+import com.google.common.xml.XmlEscapers;
import com.google.devtools.build.android.AndroidResourceOutputs.UniqueZipBuilder;
import com.google.protobuf.ByteString;
import java.io.Closeable;
@@ -321,7 +322,10 @@ public class ProtoApk implements Closeable {
private void quote(ByteString bytes) throws IOException {
QUOTE.writeTo(out);
- bytes.writeTo(out);
+ out.write(
+ XmlEscapers.xmlAttributeEscaper()
+ .escape(bytes.toStringUtf8())
+ .getBytes(StandardCharsets.UTF_8));
QUOTE.writeTo(out);
}
