diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 2ff5aad1b4926..b9c88b3d95fb7 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; }