From 80e4f93e4228c02e08715aa835f71cebcfeadfbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Tue, 25 Apr 2023 08:03:49 +0000 Subject: [PATCH] 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 --- .../settingslib/bluetooth/CachedBluetoothDevice.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index e884cf8347221..bf95ab9a4c502 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -581,9 +581,14 @@ public class CachedBluetoothDevice implements Comparable */ 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); } }