summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2015-03-03 20:08:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-03 20:08:08 +0000
commit70205fc199d361334f258aba72a6a7d4b143200c (patch)
tree65250b6510a437288dec43094e3a5670d085f77d /packages
parent9b98afca76592b8a1dc8d17dcaa99166f3658cb8 (diff)
parent56919558f140e749b744b37aebc1bd232fa6a799 (diff)
downloadframeworks_base-70205fc199d361334f258aba72a6a7d4b143200c.zip
frameworks_base-70205fc199d361334f258aba72a6a7d4b143200c.tar.gz
frameworks_base-70205fc199d361334f258aba72a6a7d4b143200c.tar.bz2
Merge "add null guards around notification listener handlers"
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java74
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);
}
});
- }
+ } }
};