Merge "bt: Set alias for all devices in a set"

This commit is contained in:
Jack He
2023-04-28 00:45:36 +00:00
committed by Gerrit Code Review

View File

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