Merge "bt: Set alias for all devices in a set" into udc-dev

This commit is contained in:
Michał Narajowski
2023-05-04 10:27:07 +00:00
committed by Android (Google) Code Review

View File

@@ -581,9 +581,14 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
*/
public void setName(String name) {
// Prevent getName() to be set to null if setName(null) is called
if (name != null && !TextUtils.equals(name, getName())) {
mDevice.setAlias(name);
dispatchAttributesChanged();
if (name == null || TextUtils.equals(name, getName())) {
return;
}
mDevice.setAlias(name);
dispatchAttributesChanged();
for (CachedBluetoothDevice cbd : mMemberDevices) {
cbd.setName(name);
}
}