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

Commit 41748dbe authored by Hemant Gupta's avatar Hemant Gupta Committed by android-build-merger
Browse files

Merge "MAP: Fix IOT specific msgListing issue with BenzCarkit." am: 2aaf2a2c

am: 47d31c1b

Change-Id: I86e3169c778a66312ed4382920e994fa6bded071
parents 307d6048 47d31c1b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ public final class DeviceWorkArounds {
    public static final String HONDA_CARKIT = "64:D4:BD";
    public static final String SYNC_CARKIT = "D0:39:72";
    public static final String BREZZA_ZDI_CARKIT = "28:a1:83";
    public static final String MERCEDES_BENZ_CARKIT = "00:26:e8";

    /**
     * @hide
+19 −4
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package com.android.bluetooth.map;

import android.util.Log;
import android.util.Xml;

import com.android.bluetooth.DeviceWorkArounds;
import com.android.internal.util.FastXmlSerializer;
@@ -90,11 +91,25 @@ public class BluetoothMapMessageListing {
    public byte[] encode(boolean includeThreadId, String version)
            throws UnsupportedEncodingException {
        StringWriter sw = new StringWriter();
        XmlSerializer xmlMsgElement = new FastXmlSerializer();
        XmlSerializer xmlMsgElement = null;
        boolean isBenzCarkit = DeviceWorkArounds.addressStartsWith(
                BluetoothMapService.getRemoteDevice().getAddress(),
                DeviceWorkArounds.MERCEDES_BENZ_CARKIT);
        try {
            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();
                xmlMsgElement.setOutput(sw);
                xmlMsgElement.startDocument("UTF-8", true);
            xmlMsgElement.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
                xmlMsgElement.text("\n");
                xmlMsgElement.setFeature(
                        "http://xmlpull.org/v1/doc/features.html#indent-output", true);
            }
            xmlMsgElement.startTag(null, "MAP-msg-listing");
            xmlMsgElement.attribute(null, "version", version);
            // Do the XML encoding of list
+4 −3
Original line number Diff line number Diff line
@@ -14,8 +14,8 @@
*/
package com.android.bluetooth.map;

import com.android.bluetooth.DeviceWorkArounds;
import com.android.bluetooth.map.BluetoothMapUtils.TYPE;
import com.android.bluetooth.util.Interop;

import org.xmlpull.v1.XmlSerializer;

@@ -274,8 +274,9 @@ public class BluetoothMapMessageListingElement
        if (mSubject != null) {
            String stripped = BluetoothMapUtils.stripInvalidChars(mSubject);

            if (Interop.matchByAddress(Interop.INTEROP_MAP_ASCIIONLY,
                    BluetoothMapService.getRemoteDevice().getAddress())) {
            if (DeviceWorkArounds.addressStartsWith(BluetoothMapService
                    .getRemoteDevice().getAddress(), DeviceWorkArounds
                    .MERCEDES_BENZ_CARKIT)) {
                stripped = stripped.replaceAll("[\\P{ASCII}&\"><]", "");
                if (stripped.isEmpty()) {
                    stripped = "---";