summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Wren <cwren@android.com> 2014-12-05 13:53:23 -0500
committer Chris Wren <cwren@android.com> 2014-12-05 13:53:23 -0500
commitc11baeba208fd51a497d482e0b39cc8386c5800a (patch)
tree25da80d90b2dc33c29e5f6f75ad584ac5736086a
parent54daab1009e7be849fa1dcbf4ee3f9d0ba40d732 (diff)
Avoid race condition in heads up snooze code path.
The user can still snooze the heads up as its in the process of timing out. In this case, mHeadsUp is already null. We save the package name so that we can still snooze the package. Bug: 18639224 Change-Id: I9bcce99a5c912e70a6856b277b61adab9cdcbc33
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
index 8933d00912d9..2e3e67ad47ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
@@ -73,6 +73,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
private NotificationData.Entry mHeadsUp;
private int mUser;
+ private String mMostRecentPackageName;
public HeadsUpNotificationView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -117,6 +118,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
}
if (mHeadsUp != null) {
+ mMostRecentPackageName = mHeadsUp.notification.getPackageName();
mHeadsUp.row.setSystemExpanded(true);
mHeadsUp.row.setSensitive(false);
mHeadsUp.row.setHeadsUp(true);
@@ -198,8 +200,10 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
}
private void snooze() {
- mSnoozedPackages.put(snoozeKey(mHeadsUp.notification.getPackageName(), mUser),
- SystemClock.elapsedRealtime() + mSnoozeLengthMs);
+ if (mMostRecentPackageName != null) {
+ mSnoozedPackages.put(snoozeKey(mMostRecentPackageName, mUser),
+ SystemClock.elapsedRealtime() + mSnoozeLengthMs);
+ }
releaseAndClose();
}