diff options
author | Hansong Zhang <hsz@google.com> | 2018-04-26 14:13:45 -0700 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-09-14 20:44:55 +0000 |
commit | f127326128e1b63b3eb765fb8841de79c01953af (patch) | |
tree | 48361b7ed66b11d80fccc4ebf1d042d03b447702 | |
parent | 3902575634b295e93463b03a1cc8c187f4e77a84 (diff) | |
download | base-f127326128e1b63b3eb765fb8841de79c01953af.tar.gz |
DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name
Test: manual
Bug: 73173182
Change-Id: I3c25af233742e63351a68e8c5a279b51a94e49e2
(cherry picked from commit b6cde9ecc19f2f156f8dc46976a5a91d21c3213f)
-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 c12317f07718..36a5c618dee2 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -724,7 +724,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; } |