From: Hansong Zhang Date: Thu, 26 Apr 2018 21:22:39 +0000 (-0700) Subject: DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name X-Git-Tag: android-x86-8.1-r1~3^2^2~13 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;ds=sidebyside;h=9214edb61c5af7f33f7c0c861966082d9a28e21f;p=android-x86%2Fframeworks-base.git DO NOT MERGE Truncate newline and tab characters in BluetoothDevice name Test: manual Bug: 73173182 Change-Id: I7f2201cab36adf7f01d1a794d783cb78a536811f (cherry picked from commit 24da173b63b17a0bc6c80b2fcfefa7fe4574a15b) --- diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 98cd319a399a..9498f125c2a6 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -808,7 +808,11 @@ public final class BluetoothDevice implements Parcelable { return null; } try { - return service.getRemoteName(this); + String name = service.getRemoteName(this); + if (name != null) { + return name.replaceAll("[\\t\\n\\r]+", " "); + } + return null; } catch (RemoteException e) { Log.e(TAG, "", e); }