From 5da1b26198571e66e5edb361b36e1c81e1b67c08 Mon Sep 17 00:00:00 2001 From: armenk Date: Thu, 10 Mar 2022 10:36:58 -0800 Subject: [PATCH] Adding null check for mNotificationShadeView mNotificationShadeView sometimes is not initialized and it causes NPE in some of CTS tests. Adding null check to fix the issues. Bug: 222130505 Test: atest CompatChangeTests Change-Id: I4360f89fd52e0f056f59eb39885569b5b57561ea --- .../phone/NotificationShadeWindowControllerImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java index 0ff010aedfff6..16e573280417a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowControllerImpl.java @@ -386,10 +386,12 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW } visible = true; } - if (visible) { - mNotificationShadeView.setVisibility(View.VISIBLE); - } else { - mNotificationShadeView.setVisibility(View.INVISIBLE); + if (mNotificationShadeView != null) { + if (visible) { + mNotificationShadeView.setVisibility(View.VISIBLE); + } else { + mNotificationShadeView.setVisibility(View.INVISIBLE); + } } }