From b4893dcb98c1072c58eda7bbd4ba3e29c5bd97d8 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Fri, 2 Jul 2021 11:01:50 -0400 Subject: [PATCH] Ignore touches during setup to avoid crash. Also log in case the root cause is (now or in the future) a bug, rather than a race. Fixes: 192490822 Test: use device normally for a bit Change-Id: Id4a7f1980bff142e826839c3d76feac419158619 --- .../phone/NotificationShadeWindowViewController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java index 7f4dabd3f59f1..b5d9bd67bd2d9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java @@ -26,6 +26,7 @@ import android.media.session.MediaSessionLegacyHelper; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; +import android.util.Log; import android.view.GestureDetector; import android.view.InputDevice; import android.view.KeyEvent; @@ -66,6 +67,7 @@ import javax.inject.Inject; * Controller for {@link NotificationShadeWindowView}. */ public class NotificationShadeWindowViewController { + private static final String TAG = "NotifShadeWindowVC"; private final InjectionInflationController mInjectionInflationController; private final NotificationWakeUpCoordinator mCoordinator; private final PulseExpansionHandler mPulseExpansionHandler; @@ -213,6 +215,10 @@ public class NotificationShadeWindowViewController { mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() { @Override public Boolean handleDispatchTouchEvent(MotionEvent ev) { + if (mStatusBarView == null) { + Log.w(TAG, "Ignoring touch while statusBarView not yet set."); + return false; + } boolean isDown = ev.getActionMasked() == MotionEvent.ACTION_DOWN; boolean isUp = ev.getActionMasked() == MotionEvent.ACTION_UP; boolean isCancel = ev.getActionMasked() == MotionEvent.ACTION_CANCEL;