Merge "Avoid race condition in heads up snooze code path." into lmp-mr1-dev
This commit is contained in:
@@ -73,6 +73,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
|
|||||||
|
|
||||||
private NotificationData.Entry mHeadsUp;
|
private NotificationData.Entry mHeadsUp;
|
||||||
private int mUser;
|
private int mUser;
|
||||||
|
private String mMostRecentPackageName;
|
||||||
|
|
||||||
public HeadsUpNotificationView(Context context, AttributeSet attrs) {
|
public HeadsUpNotificationView(Context context, AttributeSet attrs) {
|
||||||
this(context, attrs, 0);
|
this(context, attrs, 0);
|
||||||
@@ -117,6 +118,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mHeadsUp != null) {
|
if (mHeadsUp != null) {
|
||||||
|
mMostRecentPackageName = mHeadsUp.notification.getPackageName();
|
||||||
mHeadsUp.row.setSystemExpanded(true);
|
mHeadsUp.row.setSystemExpanded(true);
|
||||||
mHeadsUp.row.setSensitive(false);
|
mHeadsUp.row.setSensitive(false);
|
||||||
mHeadsUp.row.setHeadsUp(true);
|
mHeadsUp.row.setHeadsUp(true);
|
||||||
@@ -198,8 +200,10 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void snooze() {
|
private void snooze() {
|
||||||
mSnoozedPackages.put(snoozeKey(mHeadsUp.notification.getPackageName(), mUser),
|
if (mMostRecentPackageName != null) {
|
||||||
|
mSnoozedPackages.put(snoozeKey(mMostRecentPackageName, mUser),
|
||||||
SystemClock.elapsedRealtime() + mSnoozeLengthMs);
|
SystemClock.elapsedRealtime() + mSnoozeLengthMs);
|
||||||
|
}
|
||||||
releaseAndClose();
|
releaseAndClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user