summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-05-03 11:25:29 -0400
committerDaniel Sandler <dsandler@android.com>2012-05-03 11:25:29 -0400
commit58b173b1ca10bfb8bd8f7fac676f51178e57ff83 (patch)
tree125a783080e03ad895f03210583625439bbd2e2c /packages/SystemUI/src
parent4ce64fb3644546eadfca12c01e4b174384a9de23 (diff)
downloadframeworks_base-58b173b1ca10bfb8bd8f7fac676f51178e57ff83.zip
frameworks_base-58b173b1ca10bfb8bd8f7fac676f51178e57ff83.tar.gz
frameworks_base-58b173b1ca10bfb8bd8f7fac676f51178e57ff83.tar.bz2
Hide icons for low-priority notifications.
Anything below PRIORITY_LOW will usually be hidden (unless the NotificationManagerService has a compelling reason to adjust the priority). Bug: 6357857 Change-Id: Ic8a806a6db87b0473014a5d006279991272a44ea
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java16
2 files changed, 20 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 0125b64..404c40d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -73,6 +73,7 @@ import com.android.systemui.R;
import com.android.systemui.recent.RecentTasksLoader;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.NotificationData;
+import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.SignalClusterView;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.policy.BatteryController;
@@ -116,6 +117,9 @@ public class PhoneStatusBar extends BaseStatusBar {
private static final boolean CLOSE_PANEL_WHEN_EMPTIED = true;
+ private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10; // see NotificationManagerService
+ private static final int HIDE_ICONS_BELOW_SCORE = Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;
+
// fling gesture tuning parameters, scaled to display density
private float mSelfExpandVelocityPx; // classic value: 2000px/s
private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up")
@@ -889,7 +893,10 @@ public class PhoneStatusBar extends BaseStatusBar {
ArrayList<View> toShow = new ArrayList<View>();
for (int i=0; i<N; i++) {
- toShow.add(mNotificationData.get(N-i-1).icon);
+ Entry ent = mNotificationData.get(N-i-1);
+ if (ent.notification.score >= HIDE_ICONS_BELOW_SCORE) {
+ toShow.add(ent.icon);
+ }
}
ArrayList<View> toRemove = new ArrayList<View>();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 49e5a61..6e87dd7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -70,6 +70,7 @@ import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.SignalClusterView;
import com.android.systemui.statusbar.StatusBarIconView;
+import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.CompatModeButton;
@@ -111,6 +112,9 @@ public class TabletStatusBar extends BaseStatusBar implements
final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms
final static int NOTIFICATION_PEEK_FADE_DELAY = 3000; // ms
+ private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10; // see NotificationManagerService
+ private static final int HIDE_ICONS_BELOW_SCORE = Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;
+
// The height of the bar, as definied by the build. It may be taller if we're plugged
// into hdmi.
int mNaturalBarHeight = -1;
@@ -1713,9 +1717,12 @@ public class TabletStatusBar extends BaseStatusBar implements
if (mInputMethodSwitchButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
if (mCompatModeButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
- for (int i=0; i< maxNotificationIconsCount; i++) {
- if (i>=N) break;
- toShow.add(mNotificationData.get(N-i-1).icon);
+ for (int i=0; toShow.size()< maxNotificationIconsCount; i++) {
+ if (i >= N) break;
+ Entry ent = mNotificationData.get(N-i-1);
+ if (ent.notification.score >= HIDE_ICONS_BELOW_SCORE) {
+ toShow.add(ent.icon);
+ }
}
ArrayList<View> toRemove = new ArrayList<View>();
@@ -1764,7 +1771,8 @@ public class TabletStatusBar extends BaseStatusBar implements
for (int i=0; i<toShow.size(); i++) {
View v = toShow.get(i);
if (v.getParent() == null) {
- mPile.addView(v, N-1-i); // the notification panel has newest at the bottom
+ // the notification panel has the most important things at the bottom
+ mPile.addView(v, N-1-i);
}
}