summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2015-02-24 15:56:34 -0500
committerChris Wren <cwren@android.com>2015-02-25 11:49:46 -0500
commit56919558f140e749b744b37aebc1bd232fa6a799 (patch)
tree2f3c4247195d02b8b6daab1bb6aa825867b2f3d3 /packages
parentcdd35e6776f1e699a507e4ebb3a19b5eb75dc0fb (diff)
downloadframeworks_base-56919558f140e749b744b37aebc1bd232fa6a799.zip
frameworks_base-56919558f140e749b744b37aebc1bd232fa6a799.tar.gz
frameworks_base-56919558f140e749b744b37aebc1bd232fa6a799.tar.bz2
add null guards around notification listener handlers
Bug: 17909556 Change-Id: I990489a3839c49f87e3b69b3cb7bdd055fe5aec1
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);
}
});
- }
+ } }
};