From 8610de5c2661565121c4f60c1f05288f0ee5d30c Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Mon, 30 Nov 2020 14:51:38 -0500 Subject: [PATCH] Fix NPE that can occur on uiMode change if a group has a single child. Note that the ternary null check inside init is not necessary given the other change, but seems prudent. Fixes: 173777455 Fixes: 173650635 Test: manual -- use go/notify-apk to post a group of 2, dismiss 1, change font size. Observe SystemUI no longer crashes. Change-Id: I71a820a1ed2ac7ec71c4d9f78855ff264c5d5051 --- .../systemui/statusbar/NotificationGroupingUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGroupingUtil.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGroupingUtil.java index 0e6bcc58b7c0c..dbee0ee8f5d56 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGroupingUtil.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGroupingUtil.java @@ -129,7 +129,7 @@ public class NotificationGroupingUtil { */ public void updateChildrenAppearance() { List notificationChildren = mRow.getAttachedChildren(); - if (notificationChildren == null) { + if (notificationChildren == null || !mRow.isSummaryWithChildren()) { return; } // Initialize the processors @@ -256,8 +256,8 @@ public class NotificationGroupingUtil { } public void init() { - mParentView = mParentRow.getNotificationViewWrapper().getNotificationHeader() - .findViewById(mId); + View header = mParentRow.getNotificationViewWrapper().getNotificationHeader(); + mParentView = header == null ? null : header.findViewById(mId); mParentData = mExtractor == null ? null : mExtractor.extractData(mParentRow); mApply = !mComparator.isEmpty(mParentView); }