summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bluetooth/map')
-rw-r--r--src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java9
-rw-r--r--src/com/android/bluetooth/map/BluetoothMapService.java4
2 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java b/src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java
index 2d234d597..13b164ba0 100644
--- a/src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java
+++ b/src/com/android/bluetooth/map/BluetoothMapMessageListingElement.java
@@ -27,6 +27,7 @@ import android.util.Log;
import android.util.Xml;
import com.android.bluetooth.map.BluetoothMapUtils.TYPE;
+import com.android.bluetooth.util.Interop;
public class BluetoothMapMessageListingElement
implements Comparable<BluetoothMapMessageListingElement> {
@@ -277,9 +278,17 @@ public class BluetoothMapMessageListingElement
BluetoothMapUtils.getMapHandle(mCpHandle, mType));
if(mSubject != null){
String stripped = BluetoothMapUtils.stripInvalidChars(mSubject);
+
+ if (Interop.matchByAddress(Interop.INTEROP_MAP_ASCIIONLY,
+ BluetoothMapService.getRemoteDevice().getAddress())) {
+ stripped = stripped.replaceAll("[\\P{ASCII}&\"><]", "");
+ if (stripped.isEmpty()) stripped = "---";
+ }
+
xmlMsgElement.attribute(null, "subject",
stripped.substring(0, stripped.length() < 256 ? stripped.length() : 256));
}
+
if(mDateTime != 0)
xmlMsgElement.attribute(null, "datetime", this.getDateTimeString());
if(mSenderName != null)
diff --git a/src/com/android/bluetooth/map/BluetoothMapService.java b/src/com/android/bluetooth/map/BluetoothMapService.java
index de82c34ab..d088f0edd 100644
--- a/src/com/android/bluetooth/map/BluetoothMapService.java
+++ b/src/com/android/bluetooth/map/BluetoothMapService.java
@@ -133,7 +133,7 @@ public class BluetoothMapService extends ProfileService {
private HashMap<BluetoothMapAccountItem, BluetoothMapMasInstance> mMasInstanceMap =
new HashMap<BluetoothMapAccountItem, BluetoothMapMasInstance>(1);
- private BluetoothDevice mRemoteDevice = null; // The remote connected device - protect access
+ private static BluetoothDevice mRemoteDevice = null; // The remote connected device - protect access
private ArrayList<BluetoothMapAccountItem> mEnabledAccounts = null;
private static String sRemoteDeviceName = null;
@@ -476,7 +476,7 @@ public class BluetoothMapService extends ProfileService {
protected boolean isMapStarted() {
return !mStartError;
}
- public BluetoothDevice getRemoteDevice() {
+ public static BluetoothDevice getRemoteDevice() {
return mRemoteDevice;
}
private void setState(int state) {