SystemUI: Fix crash from bad notifications
Fixes a crash that happens when Notification builders can't be recovered in cacheContentViews. Now we treat this the same way we handle failures during inflation of the remote views. Change-Id: Ic7dca4bf33db31d7da466b3e4ade8b450f2497f8 Fixes: 29541772
This commit is contained in:
@@ -961,7 +961,6 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
mNotificationGutsExposed = entry.row.getGuts();
|
mNotificationGutsExposed = entry.row.getGuts();
|
||||||
bindGuts(entry.row);
|
bindGuts(entry.row);
|
||||||
}
|
}
|
||||||
entry.cacheContentViews(mContext, null /* updatedNotification */);
|
|
||||||
inflateViews(entry, mStackScroller);
|
inflateViews(entry, mStackScroller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1585,7 +1584,12 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
entry.notification.getUser().getIdentifier());
|
entry.notification.getUser().getIdentifier());
|
||||||
|
|
||||||
final StatusBarNotification sbn = entry.notification;
|
final StatusBarNotification sbn = entry.notification;
|
||||||
entry.cacheContentViews(mContext, null);
|
try {
|
||||||
|
entry.cacheContentViews(mContext, null);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
Log.e(TAG, "Unable to get notification remote views", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final RemoteViews contentView = entry.cachedContentView;
|
final RemoteViews contentView = entry.cachedContentView;
|
||||||
final RemoteViews bigContentView = entry.cachedBigContentView;
|
final RemoteViews bigContentView = entry.cachedBigContentView;
|
||||||
@@ -2354,7 +2358,13 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
Notification n = notification.getNotification();
|
Notification n = notification.getNotification();
|
||||||
mNotificationData.updateRanking(ranking);
|
mNotificationData.updateRanking(ranking);
|
||||||
|
|
||||||
boolean applyInPlace = entry.cacheContentViews(mContext, notification.getNotification());
|
boolean applyInPlace;
|
||||||
|
try {
|
||||||
|
applyInPlace = entry.cacheContentViews(mContext, notification.getNotification());
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
Log.e(TAG, "Unable to get notification remote views", e);
|
||||||
|
applyInPlace = false;
|
||||||
|
}
|
||||||
boolean shouldPeek = shouldPeek(entry, notification);
|
boolean shouldPeek = shouldPeek(entry, notification);
|
||||||
boolean alertAgain = alertAgain(entry, n);
|
boolean alertAgain = alertAgain(entry, n);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
@@ -2406,7 +2416,10 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
StatusBarIconView.contentDescForNotification(mContext, n));
|
StatusBarIconView.contentDescForNotification(mContext, n));
|
||||||
entry.icon.setNotification(n);
|
entry.icon.setNotification(n);
|
||||||
entry.icon.set(ic);
|
entry.icon.set(ic);
|
||||||
inflateViews(entry, mStackScroller);
|
if (!inflateViews(entry, mStackScroller)) {
|
||||||
|
handleNotificationError(notification, "Couldn't update remote views for: "
|
||||||
|
+ notification);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
updateHeadsUp(key, entry, shouldPeek, alertAgain);
|
updateHeadsUp(key, entry, shouldPeek, alertAgain);
|
||||||
updateNotifications();
|
updateNotifications();
|
||||||
|
|||||||
Reference in New Issue
Block a user