Fix battery level of earbuds bt devices is inconsistent

Before this CL, bluetooth settings update the battery level of earbuds
when receiving first pair status callback. But sometimes the callback
will not send immediately cause the battery level is inconsistent.

This CL will update the earbuds battery level when onResum() to refresh
battery level immediately.

Bug: 174929347
Bug: 159544311
Test: make -j42 RunSettingsRoboTests
Change-Id: I8505f8fed4ec821b9fa2d88bc437bddd7a30f0e2
This commit is contained in:
Hugh Chen
2021-03-08 15:21:33 +08:00
parent 6d513a2c67
commit bbbae9af8a
11 changed files with 35 additions and 1 deletions

View File

@@ -175,7 +175,7 @@ public final class BluetoothDevicePreference extends GearPreference {
mHideSecondTarget = hideSecondTarget;
}
private void onPreferenceAttributesChanged() {
void onPreferenceAttributesChanged() {
ThreadUtils.postOnBackgroundThread(() -> {
final Pair<Drawable, String> pair =
BluetoothUtils.getBtRainbowDrawableWithDescription(getContext(), mCachedDevice);