From e21597da375818850c6e1289455e74efa5530cfe Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Wed, 11 Aug 2021 13:04:50 -0400 Subject: [PATCH] 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 --- .../statusbar/phone/KeyguardBottomAreaView.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 0a4e59c0391e6..4701d8b32ee63 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -203,13 +203,15 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private ControlsListingController.ControlsListingCallback mListingCallback = new ControlsListingController.ControlsListingCallback() { public void onServicesUpdated(List serviceInfos) { - boolean available = !serviceInfos.isEmpty(); + post(() -> { + boolean available = !serviceInfos.isEmpty(); - if (available != mControlServicesAvailable) { - mControlServicesAvailable = available; - updateControlsVisibility(); - updateAffordanceColors(); - } + if (available != mControlServicesAvailable) { + mControlServicesAvailable = available; + updateControlsVisibility(); + updateAffordanceColors(); + } + }); } };