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

Commit 5da79ad7 authored by wescande's avatar wescande
Browse files

Clean hidden api - FastXmlSerializer

Remove hidden api for mainline project.
This commit is for FastXmlSerializer,
android.util.Xml give a stable XmlSerializer interface.
FYI: Since 2015, the XmlSerializer has a buffer and is twice
as fast as before (aosp/147924). It should compare to the
FastXmlSerializer

Bug: 190443169
Test: atest BluetoothInstrumentationTests:BipImageDescriptorTest
Tag: #refactor
Change-Id: I9495bf8c8f942773f334d1e677f8d0a7ff5fe49f
parent 313e8806
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -17,8 +17,7 @@
package com.android.bluetooth.avrcpcontroller;

import android.util.Log;

import com.android.internal.util.FastXmlSerializer;
import android.util.Xml;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -290,7 +289,7 @@ public class BipImageDescriptor {
            return null;
        }
        StringWriter writer = new StringWriter();
        XmlSerializer xmlMsgElement = new FastXmlSerializer();
        XmlSerializer xmlMsgElement = Xml.newSerializer();
        try {
            xmlMsgElement.setOutput(writer);
            xmlMsgElement.startDocument("UTF-8", true);
+2 −3
Original line number Diff line number Diff line
@@ -17,8 +17,7 @@
package com.android.bluetooth.avrcpcontroller;

import android.util.Log;

import com.android.internal.util.FastXmlSerializer;
import android.util.Xml;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -305,7 +304,7 @@ public class BipImageProperties {
    @Override
    public String toString() {
        StringWriter writer = new StringWriter();
        XmlSerializer xmlMsgElement = new FastXmlSerializer();
        XmlSerializer xmlMsgElement = Xml.newSerializer();
        try {
            xmlMsgElement.setOutput(writer);
            xmlMsgElement.startDocument("UTF-8", true);
+1 −2
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ import android.util.Log;
import android.util.Xml;

import com.android.bluetooth.Utils;
import com.android.internal.util.FastXmlSerializer;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -91,7 +90,7 @@ public class BluetoothMapConvoListing {
     */
    public byte[] encode() throws UnsupportedEncodingException {
        StringWriter sw = new StringWriter();
        XmlSerializer xmlConvoElement = new FastXmlSerializer(0);
        XmlSerializer xmlConvoElement = Xml.newSerializer();
        try {
            xmlConvoElement.setOutput(sw);
            xmlConvoElement.startDocument("UTF-8", true);
+1 −2
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ import android.util.Log;
import android.util.Xml;

import com.android.bluetooth.Utils;
import com.android.internal.util.FastXmlSerializer;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -266,7 +265,7 @@ public class BluetoothMapFolderElement implements Comparable<BluetoothMapFolderE

    public byte[] encode(int offset, int count) throws UnsupportedEncodingException {
        StringWriter sw = new StringWriter();
        XmlSerializer xmlMsgElement = new FastXmlSerializer(0);
        XmlSerializer xmlMsgElement = Xml.newSerializer();
        int i, stopIndex;
        // We need index based access to the subFolders
        BluetoothMapFolderElement[] folders =
+2 −6
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ import android.util.Log;
import android.util.Xml;

import com.android.bluetooth.DeviceWorkArounds;
import com.android.internal.util.FastXmlSerializer;

import org.xmlpull.v1.XmlSerializer;

@@ -91,20 +90,17 @@ public class BluetoothMapMessageListing {
    public byte[] encode(boolean includeThreadId, String version)
            throws UnsupportedEncodingException {
        StringWriter sw = new StringWriter();
        XmlSerializer xmlMsgElement = null;
        boolean isBenzCarkit = DeviceWorkArounds.addressStartsWith(
                BluetoothMapService.getRemoteDevice().getAddress(),
                DeviceWorkArounds.MERCEDES_BENZ_CARKIT);
        try {
            XmlSerializer xmlMsgElement = Xml.newSerializer();
            xmlMsgElement.setOutput(sw);
            if (isBenzCarkit) {
                Log.d(TAG, "java_interop: Remote is Mercedes Benz, "
                        + "using Xml Workaround.");
                xmlMsgElement = Xml.newSerializer();
                xmlMsgElement.setOutput(sw);
                xmlMsgElement.text("\n");
            } else {
                xmlMsgElement = new FastXmlSerializer(0);
                xmlMsgElement.setOutput(sw);
                xmlMsgElement.startDocument("UTF-8", true);
                xmlMsgElement.setFeature(
                        "http://xmlpull.org/v1/doc/features.html#indent-output", true);
Loading