From 2a1792ea49cbcb14af55a4b0c14c26b719c03343 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Sat, 19 Feb 2022 01:00:42 +0000 Subject: [PATCH] Skip updating nav bar if it was destroyed - Since device config updates are posted, there can be a queued update after we remove the nav bar, which will reference a null bar Bug: 210713030 Test: Haven't been able to trigger the actual NPE Change-Id: I05f1cb6e2a97808ad05b5aaaa046689df04995e1 --- .../src/com/android/systemui/navigationbar/NavigationBar.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index 8b39e5c24ded0..a242df38b62fc 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -440,7 +440,9 @@ public class NavigationBar implements View.OnAttachStateChangeListener, mHomeButtonLongPressDurationMs = Optional.of( properties.getLong(HOME_BUTTON_LONG_PRESS_DURATION_MS, 0) ).filter(duration -> duration != 0); - reconfigureHomeLongClick(); + if (mNavigationBarView != null) { + reconfigureHomeLongClick(); + } } } };