bt: Set alias for all devices in a set
This reduces name flickering when one of the devices from the set disconnects. Bug: 269067986 Test: manual Tag: #feature Change-Id: Ic33c5bc1028d65fff3d46534a9ba951c608a1dd9
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user