Merge "Sanitize Bluetooth device names without regex"

This commit is contained in:
Treehugger Robot
2020-03-01 03:21:38 +00:00
committed by Gerrit Code Review

View File

@@ -1025,7 +1025,11 @@ public final class BluetoothDevice implements Parcelable {
try {
String name = service.getRemoteName(this);
if (name != null) {
return name.replaceAll("[\\t\\n\\r]+", " ");
// remove whitespace characters from the name
return name
.replace('\t', ' ')
.replace('\n', ' ')
.replace('\r', ' ');
}
return null;
} catch (RemoteException e) {