From f9fdfa975129f96e6f33516992f67023f909ff7b Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 16 Jul 2021 20:56:23 -0700 Subject: [PATCH] Add null check to work around async unregistration of receiver Fixes: 193890703 Test: atest SystemUITests Change-Id: I47272513482c2ed31167574d2f2cab6094cfd590 Merged-In: I47272513482c2ed31167574d2f2cab6094cfd590 --- .../com/android/systemui/navigationbar/NavigationBar.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index 26f38ddd5919f..1b672fc1f2896 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -1620,6 +1620,11 @@ public class NavigationBar implements View.OnAttachStateChangeListener, private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { + // TODO(193941146): Currently unregistering a receiver through BroadcastDispatcher is + // async, but we've already cleared the fields. Just return early in this case. + if (mNavigationBarView == null) { + return; + } String action = intent.getAction(); if (Intent.ACTION_SCREEN_OFF.equals(action) || Intent.ACTION_SCREEN_ON.equals(action)) {