summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorChristoph Studer <chstuder@google.com>2014-09-05 09:33:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-05 09:33:43 +0000
commit038839e9475b81abfe6fcfbec6c86647bd7592b1 (patch)
treecb87cb6d19a481456c7b43cbad3e523916770a67 /packages/SystemUI
parent9a245b5de347cb723ed327098a0375707b2139b0 (diff)
parent1492116a1cf44941ee2c8be68f6df6c14cfd39c5 (diff)
downloadframeworks_base-038839e9475b81abfe6fcfbec6c86647bd7592b1.zip
frameworks_base-038839e9475b81abfe6fcfbec6c86647bd7592b1.tar.gz
frameworks_base-038839e9475b81abfe6fcfbec6c86647bd7592b1.tar.bz2
Merge "SysUI: Upsort PRIORITY_MAX system notifications" into lmp-dev
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 0905fe7..ca1fbe0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -100,15 +100,26 @@ public class NotificationData {
@Override
public int compare(Entry a, Entry b) {
- String mediaNotification = mEnvironment.getCurrentMediaNotificationKey();
-
// Upsort current media notification.
+ String mediaNotification = mEnvironment.getCurrentMediaNotificationKey();
boolean aMedia = a.key.equals(mediaNotification);
boolean bMedia = b.key.equals(mediaNotification);
if (aMedia != bMedia) {
return aMedia ? -1 : 1;
}
+ final StatusBarNotification na = a.notification;
+ final StatusBarNotification nb = b.notification;
+
+ // Upsort PRIORITY_MAX system notifications
+ boolean aSystemMax = na.getNotification().priority >= Notification.PRIORITY_MAX &&
+ isSystemNotification(na);
+ boolean bSystemMax = nb.getNotification().priority >= Notification.PRIORITY_MAX &&
+ isSystemNotification(nb);
+ if (aSystemMax != bSystemMax) {
+ return aSystemMax ? -1 : 1;
+ }
+
// RankingMap as received from NoMan.
if (mRankingMap != null) {
mRankingMap.getRanking(a.key, mRankingA);
@@ -116,8 +127,6 @@ public class NotificationData {
return mRankingA.getRank() - mRankingB.getRank();
}
- final StatusBarNotification na = a.notification;
- final StatusBarNotification nb = b.notification;
int d = nb.getScore() - na.getScore();
if (a.interruption != b.interruption) {
return a.interruption ? -1 : 1;
@@ -305,6 +314,11 @@ public class NotificationData {
pw.println(" tickerText=\"" + n.getNotification().tickerText + "\"");
}
+ private static boolean isSystemNotification(StatusBarNotification sbn) {
+ String sbnPackage = sbn.getPackageName();
+ return "android".equals(sbnPackage) || "com.android.systemui".equals(sbnPackage);
+ }
+
/**
* Provides access to keyguard state and user settings dependent data.
*/