diff options
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index ca54349..3a812cc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -419,61 +419,67 @@ public abstract class BaseStatusBar extends SystemUI implements public void onNotificationPosted(final StatusBarNotification sbn, final RankingMap rankingMap) { if (DEBUG) Log.d(TAG, "onNotificationPosted: " + sbn); - mHandler.post(new Runnable() { - @Override - public void run() { - Notification n = sbn.getNotification(); - boolean isUpdate = mNotificationData.get(sbn.getKey()) != null - || isHeadsUp(sbn.getKey()); - - // Ignore children of notifications that have a summary, since we're not - // going to show them anyway. This is true also when the summary is canceled, - // because children are automatically canceled by NoMan in that case. - if (n.isGroupChild() && - mNotificationData.isGroupWithSummary(sbn.getGroupKey())) { - if (DEBUG) { - Log.d(TAG, "Ignoring group child due to existing summary: " + sbn); - } + if (sbn != null) { + mHandler.post(new Runnable() { + @Override + public void run() { + Notification n = sbn.getNotification(); + boolean isUpdate = mNotificationData.get(sbn.getKey()) != null + || isHeadsUp(sbn.getKey()); + + // Ignore children of notifications that have a summary, since we're not + // going to show them anyway. This is true also when the summary is canceled, + // because children are automatically canceled by NoMan in that case. + if (n.isGroupChild() && + mNotificationData.isGroupWithSummary(sbn.getGroupKey())) { + if (DEBUG) { + Log.d(TAG, "Ignoring group child due to existing summary: " + sbn); + } - // Remove existing notification to avoid stale data. + // Remove existing notification to avoid stale data. + if (isUpdate) { + removeNotification(sbn.getKey(), rankingMap); + } else { + mNotificationData.updateRanking(rankingMap); + } + return; + } if (isUpdate) { - removeNotification(sbn.getKey(), rankingMap); + updateNotification(sbn, rankingMap); } else { - mNotificationData.updateRanking(rankingMap); + addNotification(sbn, rankingMap); } - return; } - if (isUpdate) { - updateNotification(sbn, rankingMap); - } else { - addNotification(sbn, rankingMap); - } - } - }); + }); + } } @Override - public void onNotificationRemoved(final StatusBarNotification sbn, + public void onNotificationRemoved(StatusBarNotification sbn, final RankingMap rankingMap) { if (DEBUG) Log.d(TAG, "onNotificationRemoved: " + sbn); - mHandler.post(new Runnable() { - @Override - public void run() { - removeNotification(sbn.getKey(), rankingMap); - } - }); + if (sbn != null) { + final String key = sbn.getKey(); + mHandler.post(new Runnable() { + @Override + public void run() { + removeNotification(key, rankingMap); + } + }); + } } @Override public void onNotificationRankingUpdate(final RankingMap rankingMap) { if (DEBUG) Log.d(TAG, "onRankingUpdate"); + if (rankingMap != null) { mHandler.post(new Runnable() { @Override public void run() { updateNotificationRanking(rankingMap); } }); - } + } } }; |