Truncate newline and tab characters in BluetoothDevice name

Test: manual
Bug: 73173182
Change-Id: I7f2201cab36adf7f01d1a794d783cb78a536811f
This commit is contained in:
Hansong Zhang
2018-04-26 14:22:39 -07:00
parent b7af9ee423
commit 2e3bf46039

View File

@@ -848,7 +848,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);
}