Methods Summary |
---|
public void | add(com.android.systemui.statusbar.NotificationData$Entry entry, android.service.notification.NotificationListenerService.RankingMap ranking)
mEntries.put(entry.notification.getKey(), entry);
updateRankingAndSort(ranking);
|
public void | dump(java.io.PrintWriter pw, java.lang.String indent)
int N = mSortedAndFiltered.size();
pw.print(indent);
pw.println("active notifications: " + N);
int active;
for (active = 0; active < N; active++) {
NotificationData.Entry e = mSortedAndFiltered.get(active);
dumpEntry(pw, indent, active, e);
}
int M = mEntries.size();
pw.print(indent);
pw.println("inactive notifications: " + (M - active));
int inactiveCount = 0;
for (int i = 0; i < M; i++) {
Entry entry = mEntries.valueAt(i);
if (!mSortedAndFiltered.contains(entry)) {
dumpEntry(pw, indent, inactiveCount, entry);
inactiveCount++;
}
}
|
private void | dumpEntry(java.io.PrintWriter pw, java.lang.String indent, int i, com.android.systemui.statusbar.NotificationData$Entry e)
pw.print(indent);
pw.println(" [" + i + "] key=" + e.key + " icon=" + e.icon);
StatusBarNotification n = e.notification;
pw.print(indent);
pw.println(" pkg=" + n.getPackageName() + " id=" + n.getId() + " score=" +
n.getScore());
pw.print(indent);
pw.println(" notification=" + n.getNotification());
pw.print(indent);
pw.println(" tickerText=\"" + n.getNotification().tickerText + "\"");
|
public void | filterAndSort()
mSortedAndFiltered.clear();
mGroupsWithSummaries.clear();
final int N = mEntries.size();
for (int i = 0; i < N; i++) {
Entry entry = mEntries.valueAt(i);
StatusBarNotification sbn = entry.notification;
if (shouldFilterOut(sbn)) {
continue;
}
if (sbn.getNotification().isGroupSummary()) {
mGroupsWithSummaries.add(sbn.getGroupKey());
}
mSortedAndFiltered.add(entry);
}
// Second pass: Filter out group children with summary.
if (!mGroupsWithSummaries.isEmpty()) {
final int M = mSortedAndFiltered.size();
for (int i = M - 1; i >= 0; i--) {
Entry ent = mSortedAndFiltered.get(i);
StatusBarNotification sbn = ent.notification;
if (sbn.getNotification().isGroupChild() &&
mGroupsWithSummaries.contains(sbn.getGroupKey())) {
mSortedAndFiltered.remove(i);
}
}
}
Collections.sort(mSortedAndFiltered, mRankingComparator);
|
public com.android.systemui.statusbar.NotificationData$Entry | get(java.lang.String key)
return mEntries.get(key);
|
public java.util.ArrayList | getActiveNotifications()Returns the sorted list of active notifications (depending on {@link Environment}
This call doesn't update the list of active notifications. Call {@link #filterAndSort()}
when the environment changes.
Don't hold on to or modify the returned list.
return mSortedAndFiltered;
|
public int | getVisibilityOverride(java.lang.String key)
if (mRankingMap != null) {
mRankingMap.getRanking(key, mTmpRanking);
return mTmpRanking.getVisibilityOverride();
}
return NotificationListenerService.Ranking.VISIBILITY_NO_OVERRIDE;
|
public boolean | hasActiveClearableNotifications()Return whether there are any clearable notifications (that aren't errors).
for (Entry e : mSortedAndFiltered) {
if (e.expanded != null) { // the view successfully inflated
if (e.notification.isClearable()) {
return true;
}
}
}
return false;
|
public boolean | isAmbient(java.lang.String key)
if (mRankingMap != null) {
mRankingMap.getRanking(key, mTmpRanking);
return mTmpRanking.isAmbient();
}
return false;
|
public boolean | isGroupWithSummary(java.lang.String groupKey)
return mGroupsWithSummaries.contains(groupKey);
|
private static boolean | isSystemNotification(android.service.notification.StatusBarNotification sbn)
String sbnPackage = sbn.getPackageName();
return "android".equals(sbnPackage) || "com.android.systemui".equals(sbnPackage);
|
public com.android.systemui.statusbar.NotificationData$Entry | remove(java.lang.String key, android.service.notification.NotificationListenerService.RankingMap ranking)
Entry removed = mEntries.remove(key);
if (removed == null) return null;
updateRankingAndSort(ranking);
return removed;
|
boolean | shouldFilterOut(android.service.notification.StatusBarNotification sbn)
if (!(mEnvironment.isDeviceProvisioned() ||
showNotificationEvenIfUnprovisioned(sbn))) {
return true;
}
if (!mEnvironment.isNotificationForCurrentProfiles(sbn)) {
return true;
}
if (sbn.getNotification().visibility == Notification.VISIBILITY_SECRET &&
mEnvironment.shouldHideSensitiveContents(sbn.getUserId())) {
return true;
}
return false;
|
public static boolean | showNotificationEvenIfUnprovisioned(android.service.notification.StatusBarNotification sbn)
return "android".equals(sbn.getPackageName())
&& sbn.getNotification().extras.getBoolean(Notification.EXTRA_ALLOW_DURING_SETUP);
|
public void | updateRanking(android.service.notification.NotificationListenerService.RankingMap ranking)
updateRankingAndSort(ranking);
|
private void | updateRankingAndSort(android.service.notification.NotificationListenerService.RankingMap ranking)
if (ranking != null) {
mRankingMap = ranking;
}
filterAndSort();
|