summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2014-05-28 16:40:57 -0400
committerChris Wren <cwren@android.com>2014-05-30 16:09:51 -0400
commit333a61c3a5a83fe9c50ebeb5c947317f61385b7b (patch)
treebbac1a9f9e5bcaf742116ee53c47bbf931e88b12 /packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
parent5c0727ff2debd2ce0b92bf264524480009a36935 (diff)
downloadframeworks_base-333a61c3a5a83fe9c50ebeb5c947317f61385b7b.zip
frameworks_base-333a61c3a5a83fe9c50ebeb5c947317f61385b7b.tar.gz
frameworks_base-333a61c3a5a83fe9c50ebeb5c947317f61385b7b.tar.bz2
Track Zen Mode status in the NotificationRecord
This requires the record to be present in makeRankingUpdateForListener, however, if the ranking object is created before the post to the handler, then no cloning is necessary. Depends-On: I907a1ff28123219db1c08889d723ad1b70b191ab Change-Id: I51fcf689ddbee7715e3387b865f18a715887c943
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java31
1 files changed, 27 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java b/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
index 24da5c2..de27119 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
@@ -20,8 +20,10 @@ import android.app.Notification;
import android.content.Context;
import android.os.Process;
import android.provider.Settings;
+import android.service.notification.NotificationListenerService.Ranking;
import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;
+import android.util.ArraySet;
import android.view.View;
import com.android.systemui.R;
@@ -30,12 +32,13 @@ import com.android.systemui.statusbar.phone.PhoneStatusBar;
public class InterceptedNotifications {
private static final String TAG = "InterceptedNotifications";
- private static final String EXTRA_INTERCEPT = "android.intercept";
+ private static final String SYNTHETIC_KEY = "InterceptedNotifications.SYNTHETIC_KEY";
private final Context mContext;
private final PhoneStatusBar mBar;
private final ArrayMap<String, StatusBarNotification> mIntercepted
= new ArrayMap<String, StatusBarNotification>();
+ private final ArraySet<String> mReleased = new ArraySet<String>();
private String mSynKey;
@@ -48,25 +51,45 @@ public class InterceptedNotifications {
final int n = mIntercepted.size();
for (int i = 0; i < n; i++) {
final StatusBarNotification sbn = mIntercepted.valueAt(i);
- sbn.getNotification().extras.putBoolean(EXTRA_INTERCEPT, false);
+ mReleased.add(sbn.getKey());
mBar.addNotificationInternal(sbn, null);
}
mIntercepted.clear();
updateSyntheticNotification();
}
- public boolean tryIntercept(StatusBarNotification notification) {
- if (!notification.getNotification().extras.getBoolean(EXTRA_INTERCEPT)) return false;
+ public boolean tryIntercept(StatusBarNotification notification, Ranking ranking) {
+ if (ranking == null) return false;
if (shouldDisplayIntercepted()) return false;
+ if (mReleased.contains(notification.getKey())) return false;
+ if (!ranking.isInterceptedByDoNotDisturb(notification.getKey())) return false;
mIntercepted.put(notification.getKey(), notification);
updateSyntheticNotification();
return true;
}
+ public void retryIntercepts(Ranking ranking) {
+ if (ranking == null) return;
+
+ boolean changed = false;
+ final int N = mIntercepted.size();
+ for (int i = 0; i < N; i++) {
+ final StatusBarNotification sbn = mIntercepted.valueAt(i);
+ if (!tryIntercept(sbn, ranking)) {
+ changed = true;
+ mBar.addNotificationInternal(sbn, ranking);
+ }
+ }
+ if (changed) {
+ updateSyntheticNotification();
+ }
+ }
+
public void remove(String key) {
if (mIntercepted.remove(key) != null) {
updateSyntheticNotification();
}
+ mReleased.remove(key);
}
public boolean isSyntheticEntry(Entry ent) {