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
This commit is contained in:
@@ -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>();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user