diff options
| author | 2018-04-26 14:13:45 -0700 | |
|---|---|---|
| committer | 2018-04-26 21:26:17 +0000 | |
| commit | d0c2aa5b1b2a09555c6e7eed151b3a324b55666a (patch) | |
| tree | 3381266b51393627bda0389fd291aad5f9375b73 | |
| parent | 231719b4d2b0ada5a5f842f90408ea3304b44db6 (diff) | |
DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name
Test: manual
Bug: 73173182
Change-Id: I3c25af233742e63351a68e8c5a279b51a94e49e2
Merged-In: I7f2201cab36adf7f01d1a794d783cb78a536811f
| -rw-r--r-- | core/java/android/bluetooth/BluetoothDevice.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 7ff37d29323e..d84cdf4ea8b0 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -780,7 +780,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; } |