summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hansong Zhang <hsz@google.com> 2018-04-26 14:13:45 -0700
committer Hansong Zhang <hsz@google.com> 2018-04-26 21:18:46 +0000
commitb6cde9ecc19f2f156f8dc46976a5a91d21c3213f (patch)
tree85b2c6b3b46fb71d9cb20bf2b1b6229ccfe281fc
parent42f4ac8e427f998e4e9f3cc48abd790ff304e116 (diff)
DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name
Test: manual Bug: 73173182 Change-Id: I3c25af233742e63351a68e8c5a279b51a94e49e2
-rw-r--r--core/java/android/bluetooth/BluetoothDevice.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index 6d6dfebced2c..a061e19a40a6 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -727,7 +727,11 @@ public final class BluetoothDevice implements Parcelable {
return null;
}
try {
- return sService.getRemoteName(this);
+ String name = sService.getRemoteName(this);
+ if (name != null) {
+ return name.replaceAll("[\\t\\n\\r]+", " ");
+ }
+ return null;
} catch (RemoteException e) {Log.e(TAG, "", e);}
return null;
}