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
This commit is contained in:
Jeff DeCew
2020-11-30 14:51:38 -05:00
parent b00728fd4a
commit 8610de5c26

View File

@@ -129,7 +129,7 @@ public class NotificationGroupingUtil {
*/
public void updateChildrenAppearance() {
List<ExpandableNotificationRow> 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);
}