Skip to content

Commit 58b173b

Browse files
committed
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
1 parent 4ce64fb commit 58b173b

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import com.android.systemui.recent.RecentTasksLoader;
7474
import com.android.systemui.statusbar.BaseStatusBar;
7575
import com.android.systemui.statusbar.NotificationData;
76+
import com.android.systemui.statusbar.NotificationData.Entry;
7677
import com.android.systemui.statusbar.SignalClusterView;
7778
import com.android.systemui.statusbar.StatusBarIconView;
7879
import com.android.systemui.statusbar.policy.BatteryController;
@@ -116,6 +117,9 @@ public class PhoneStatusBar extends BaseStatusBar {
116117

117118
private static final boolean CLOSE_PANEL_WHEN_EMPTIED = true;
118119

120+
private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10; // see NotificationManagerService
121+
private static final int HIDE_ICONS_BELOW_SCORE = Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;
122+
119123
// fling gesture tuning parameters, scaled to display density
120124
private float mSelfExpandVelocityPx; // classic value: 2000px/s
121125
private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up")
@@ -889,7 +893,10 @@ private void updateNotificationIcons() {
889893
ArrayList<View> toShow = new ArrayList<View>();
890894

891895
for (int i=0; i<N; i++) {
892-
toShow.add(mNotificationData.get(N-i-1).icon);
896+
Entry ent = mNotificationData.get(N-i-1);
897+
if (ent.notification.score >= HIDE_ICONS_BELOW_SCORE) {
898+
toShow.add(ent.icon);
899+
}
893900
}
894901

895902
ArrayList<View> toRemove = new ArrayList<View>();

packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
import com.android.systemui.statusbar.NotificationData;
7171
import com.android.systemui.statusbar.SignalClusterView;
7272
import com.android.systemui.statusbar.StatusBarIconView;
73+
import com.android.systemui.statusbar.NotificationData.Entry;
7374
import com.android.systemui.statusbar.policy.BatteryController;
7475
import com.android.systemui.statusbar.policy.BluetoothController;
7576
import com.android.systemui.statusbar.policy.CompatModeButton;
@@ -111,6 +112,9 @@ public class TabletStatusBar extends BaseStatusBar implements
111112
final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms
112113
final static int NOTIFICATION_PEEK_FADE_DELAY = 3000; // ms
113114

115+
private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10; // see NotificationManagerService
116+
private static final int HIDE_ICONS_BELOW_SCORE = Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;
117+
114118
// The height of the bar, as definied by the build. It may be taller if we're plugged
115119
// into hdmi.
116120
int mNaturalBarHeight = -1;
@@ -1713,9 +1717,12 @@ private void updateNotificationIcons() {
17131717
if (mInputMethodSwitchButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
17141718
if (mCompatModeButton.getVisibility() != View.GONE) maxNotificationIconsCount --;
17151719

1716-
for (int i=0; i< maxNotificationIconsCount; i++) {
1717-
if (i>=N) break;
1718-
toShow.add(mNotificationData.get(N-i-1).icon);
1720+
for (int i=0; toShow.size()< maxNotificationIconsCount; i++) {
1721+
if (i >= N) break;
1722+
Entry ent = mNotificationData.get(N-i-1);
1723+
if (ent.notification.score >= HIDE_ICONS_BELOW_SCORE) {
1724+
toShow.add(ent.icon);
1725+
}
17191726
}
17201727

17211728
ArrayList<View> toRemove = new ArrayList<View>();
@@ -1764,7 +1771,8 @@ private void loadNotificationPanel() {
17641771
for (int i=0; i<toShow.size(); i++) {
17651772
View v = toShow.get(i);
17661773
if (v.getParent() == null) {
1767-
mPile.addView(v, N-1-i); // the notification panel has newest at the bottom
1774+
// the notification panel has the most important things at the bottom
1775+
mPile.addView(v, N-1-i);
17681776
}
17691777
}
17701778

0 commit comments

Comments
 (0)