Merge "Sanitize Bluetooth device names without regex" am: 6bd37ba788

Change-Id: I97c50cc31e681e53cc74d76803e3e24566b7e5dd
This commit is contained in:
Automerger Merge Worker
2020-03-01 03:34:53 +00:00

View File

@@ -1025,7 +1025,11 @@ public final class BluetoothDevice implements Parcelable {
try { try {
String name = service.getRemoteName(this); String name = service.getRemoteName(this);
if (name != null) { 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; return null;
} catch (RemoteException e) { } catch (RemoteException e) {