Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68a808bc authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Show even fewer notifications in Setup." into jb-dev

parents 9add5654 590d515d
Loading
Loading
Loading
Loading
+19 −2
Original line number Original line Diff line number Diff line
@@ -820,6 +820,23 @@ public class PhoneStatusBar extends BaseStatusBar {
            R.integer.config_show_search_delay);
            R.integer.config_show_search_delay);
    }
    }


    // Q: What kinds of notifications should show during setup?
    // A: Almost none! Only things coming from the system (package is "android") that also 
    // have special "kind" tags marking them as relevant for setup (see below).
    private boolean showNotificationEvenIfUnprovisioned(StatusBarNotification sbn) {
        if ("android".equals(sbn.pkg)) {
            if (sbn.notification.kind != null) {
                for (String aKind : sbn.notification.kind) {
                    // IME switcher, created by InputMethodManagerService
                    if ("android.system.imeswitcher".equals(aKind)) return true;
                    // OTA availability & errors, created by SystemUpdateService
                    if ("android.system.update".equals(aKind)) return true;
                }
            }
        }
        return false;
    }

    private void loadNotificationShade() {
    private void loadNotificationShade() {
        if (mPile == null) return;
        if (mPile == null) return;


@@ -831,7 +848,7 @@ public class PhoneStatusBar extends BaseStatusBar {
        // If the device hasn't been through Setup, we only show system notifications
        // If the device hasn't been through Setup, we only show system notifications
        for (int i=0; i<N; i++) {
        for (int i=0; i<N; i++) {
            Entry ent = mNotificationData.get(N-i-1);
            Entry ent = mNotificationData.get(N-i-1);
            if (provisioned || "android".equals(ent.notification.pkg)) {
            if (provisioned || showNotificationEvenIfUnprovisioned(ent.notification)) {
                toShow.add(ent.row);
                toShow.add(ent.row);
            }
            }
        }
        }
@@ -886,7 +903,7 @@ public class PhoneStatusBar extends BaseStatusBar {
        for (int i=0; i<N; i++) {
        for (int i=0; i<N; i++) {
            Entry ent = mNotificationData.get(N-i-1);
            Entry ent = mNotificationData.get(N-i-1);
            if ((provisioned && ent.notification.score >= HIDE_ICONS_BELOW_SCORE)
            if ((provisioned && ent.notification.score >= HIDE_ICONS_BELOW_SCORE)
                    || "android".equals(ent.notification.pkg)) {
                    || showNotificationEvenIfUnprovisioned(ent.notification)) {
                toShow.add(ent.icon);
                toShow.add(ent.icon);
            }
            }
        }
        }
+4 −0
Original line number Original line Diff line number Diff line
@@ -586,6 +586,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        mImeSwitcherNotification.defaults = 0; // please be quiet
        mImeSwitcherNotification.defaults = 0; // please be quiet
        mImeSwitcherNotification.sound = null;
        mImeSwitcherNotification.sound = null;
        mImeSwitcherNotification.vibrate = null;
        mImeSwitcherNotification.vibrate = null;

        // Tag this notification specially so SystemUI knows it's important
        mImeSwitcherNotification.kind = new String[] { "android.system.imeswitcher" };

        Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER);
        Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER);
        mImeSwitchPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
        mImeSwitchPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);