Update UI when BT device is rename

* Using getAliasName() instead of getName()
* Add BluetoothDevice isConnected check, when BluetoothDevice is
  disconnected. Do not add to the show list.

Bug: 77783217
Test: make -j50 RunSettingsRoboTests
Change-Id: I183fc693eaefd690568ba2f1ec740258b2bb62c8
This commit is contained in:
hughchen
2018-04-20 10:01:59 +08:00
parent 37a6a91444
commit 615becb392
6 changed files with 18 additions and 10 deletions

View File

@@ -131,7 +131,7 @@ public abstract class AudioSwitchPreferenceController extends BasePreferenceCont
final BluetoothDevice btDevice = mConnectedDevices.get(connectedDeviceIndex);
mSelectedIndex = connectedDeviceIndex;
setActiveBluetoothDevice(btDevice);
listPreference.setSummary(btDevice.getName());
listPreference.setSummary(btDevice.getAliasName());
}
return true;
}
@@ -319,7 +319,7 @@ public abstract class AudioSwitchPreferenceController extends BasePreferenceCont
mediaValues[mSelectedIndex] = mContext.getText(R.string.media_output_default_summary);
for (int i = 0, size = mConnectedDevices.size(); i < size; i++) {
final BluetoothDevice btDevice = mConnectedDevices.get(i);
mediaOutputs[i] = btDevice.getName();
mediaOutputs[i] = btDevice.getAliasName();
mediaValues[i] = btDevice.getAddress();
if (btDevice.equals(activeDevice)) {
// select the active connected device.