Crash on device controls availability

Post the incoming event to the view's handler to avoid crashing when
attempting to update the on the wrong thread.

Fixes: 196008691
Test: manual (cannot repro locally but would most likely happen after reboot)
Change-Id: I3777d5a43e0ff3a56910124a93670eef1b027fe0
This commit is contained in:
Matt Pietal
2021-08-11 13:04:50 -04:00
parent abd75290ad
commit e21597da37

View File

@@ -203,13 +203,15 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private ControlsListingController.ControlsListingCallback mListingCallback =
new ControlsListingController.ControlsListingCallback() {
public void onServicesUpdated(List<ControlsServiceInfo> serviceInfos) {
boolean available = !serviceInfos.isEmpty();
post(() -> {
boolean available = !serviceInfos.isEmpty();
if (available != mControlServicesAvailable) {
mControlServicesAvailable = available;
updateControlsVisibility();
updateAffordanceColors();
}
if (available != mControlServicesAvailable) {
mControlServicesAvailable = available;
updateControlsVisibility();
updateAffordanceColors();
}
});
}
};