Use new api to get bluetooth device icon

This CL use CachedBluetoothDevice#getDrawableWithDescription()
to get bluetooth device icon.

Bug: 178255374
Test: make RunSettingsRoboTests -j56

Change-Id: I45c273e2dd782029da7a3a2724cbca3762cc2d9c
This commit is contained in:
Hugh Chen
2021-04-16 22:15:52 +08:00
parent 976c6ac56d
commit 3cf4c3f3a5
2 changed files with 16 additions and 11 deletions

View File

@@ -176,17 +176,9 @@ public final class BluetoothDevicePreference extends GearPreference {
}
void onPreferenceAttributesChanged() {
ThreadUtils.postOnBackgroundThread(() -> {
final Pair<Drawable, String> pair =
BluetoothUtils.getBtRainbowDrawableWithDescription(getContext(), mCachedDevice);
ThreadUtils.postOnMainThread(() -> {
if (pair.first != null) {
setIcon(pair.first);
contentDescription = pair.second;
}
});
});
Pair<Drawable, String> pair = mCachedDevice.getDrawableWithDescription();
setIcon(pair.first);
contentDescription = pair.second;
/*
* The preference framework takes care of making sure the value has