Fixed a potential heads up crash

If a group became suppressed with a summary that is
heads-upped, while also being in the process of being
removed, it could lead to a crash.

Test: isolate a HUN that was being removed and is a child
Change-Id: I943b63529778a3c85b03da033837f5a677b2d352
Fixes: 33645653
This commit is contained in:
Selim Cinek
2016-12-16 16:56:41 -08:00
parent 9bb05631fa
commit 40f8876515
2 changed files with 11 additions and 0 deletions

View File

@@ -416,6 +416,10 @@ public class NotificationGroupManager implements OnHeadsUpChangedListener {
child = getIsolatedChild(sbn.getGroupKey());
}
if (child != null) {
if (child.row.keepInParent() || child.row.isRemoved() || child.row.isDismissed()) {
// the notification is actually already removed, no need to do heads-up on it.
return;
}
if (mHeadsUpManager.isHeadsUp(child.key)) {
mHeadsUpManager.updateNotification(child, true);
} else {

View File

@@ -1929,6 +1929,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
childIndex++) {
ExpandableNotificationRow childView = orderedChildren.get(childIndex);
if (children == null || !children.contains(childView)) {
if (childView.getParent() != null) {
Log.wtf(TAG, "trying to add a notification child that already has " +
"a parent. class:" + childView.getParent().getClass() +
"\n child: " + childView);
// This shouldn't happen. We can recover by removing it though.
((ViewGroup) childView.getParent()).removeView(childView);
}
mVisualStabilityManager.notifyViewAddition(childView);
parent.addChildNotification(childView, childIndex);
mStackScroller.notifyGroupChildAdded(childView);