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

Commit e84d544f authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Move redaction logic showing from Keyguard to PhoneStatusBar."

parents b6e0e122 15682508
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -41,8 +41,6 @@ public class StatusBarManager {
    @Deprecated
    public static final int DISABLE_NOTIFICATION_TICKER
            = View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER;
    public static final int DISABLE_PRIVATE_NOTIFICATIONS
            = View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER;
    public static final int DISABLE_SYSTEM_INFO = View.STATUS_BAR_DISABLE_SYSTEM_INFO;
    public static final int DISABLE_HOME = View.STATUS_BAR_DISABLE_HOME;
    public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT;
+0 −35
Original line number Diff line number Diff line
@@ -156,24 +156,6 @@ public class KeyguardViewMediator extends SystemUI {
     */
    private static final int KEYGUARD_DONE_DRAWING_TIMEOUT_MS = 2000;

    /**
     * Allow the user to expand the status bar when the keyguard is engaged
     * (without a pattern or password).
     */
    private static final boolean ENABLE_INSECURE_STATUS_BAR_EXPAND = true;

    /**
     * Allow the user to expand the status bar when a SECURE keyguard is engaged
     * and {@link android.provider.Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS} is set
     * (private notifications will be masked).
     */
    private static final boolean ENABLE_SECURE_STATUS_BAR_EXPAND = true;

    /**
     * Default value of {@link android.provider.Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
     */
    private static final boolean ALLOW_NOTIFICATIONS_DEFAULT = false;

    /**
     * Secure setting whether analytics are collected on the keyguard.
     */
@@ -276,11 +258,6 @@ public class KeyguardViewMediator extends SystemUI {
    private int mUnlockSoundId;
    private int mLockSoundStreamId;

    /**
     * Tracks value of {@link android.provider.Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
     */
    private boolean mAllowNotificationsWhenSecure;

    /**
     * The volume applied to the lock/unlock sounds.
     */
@@ -895,13 +872,6 @@ public class KeyguardViewMediator extends SystemUI {
            return;
        }

        // note whether notification access should be allowed
        mAllowNotificationsWhenSecure = ENABLE_SECURE_STATUS_BAR_EXPAND
                && 0 != Settings.Global.getInt(
                        mContext.getContentResolver(),
                        Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS,
                        ALLOW_NOTIFICATIONS_DEFAULT ? 1 : 0);

        // if the keyguard is already showing, don't bother
        if (mStatusBarKeyguardViewManager.isShowing()) {
            if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
@@ -1271,11 +1241,6 @@ public class KeyguardViewMediator extends SystemUI {
                // (like recents). Temporary enable/disable (e.g. the "back" button) are
                // done in KeyguardHostView.
                flags |= StatusBarManager.DISABLE_RECENT;
                if (isSecure()) {
                    // showing secure lockscreen; disable ticker and switch private notifications
                    // to show their public versions, if available.
                    flags |= StatusBarManager.DISABLE_PRIVATE_NOTIFICATIONS;
                }
                if (!isAssistantAvailable()) {
                    flags |= StatusBarManager.DISABLE_SEARCH;
                }
+4 −0
Original line number Diff line number Diff line
@@ -143,6 +143,10 @@ public class KeyguardBouncer {
        return false;
    }

    public boolean isSecure() {
        return mKeyguardView == null || mKeyguardView.getSecurityMode() != SecurityMode.None;
    }

    public boolean onMenuPressed() {
        ensureView();
        if (mKeyguardView.handleMenuKey()) {
+35 −30
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OU
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_OPAQUE;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_SEMI_TRANSPARENT;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_TRANSLUCENT;
import static com.android.systemui.statusbar.stack.NotificationStackScrollLayout.OnChildLocationsChangedListener;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -77,7 +76,6 @@ import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewPropertyAnimator;
import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.animation.AccelerateInterpolator;
@@ -148,6 +146,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
    private static final int NOTIFICATION_PRIORITY_MULTIPLIER = 10; // see NotificationManagerService
    private static final int HIDE_ICONS_BELOW_SCORE = Notification.PRIORITY_LOW * NOTIFICATION_PRIORITY_MULTIPLIER;

    /**
     * Default value of {@link android.provider.Settings.Global#LOCK_SCREEN_SHOW_NOTIFICATIONS}.
     */
    private static final boolean ALLOW_NOTIFICATIONS_DEFAULT = false;

    private static final int STATUS_OR_NAV_TRANSIENT =
            View.STATUS_BAR_TRANSIENT | View.NAVIGATION_BAR_TRANSIENT;
    private static final long AUTOHIDE_TIMEOUT_MS = 3000;
@@ -1452,8 +1455,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        flagdbg.append(((diff  & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) ? "ALERTS" : "alerts");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_PRIVATE_NOTIFICATIONS) != 0) ? "PRIVATE" : "private");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_PRIVATE_NOTIFICATIONS) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "SYSTEM_INFO" : "system_info");
        flagdbg.append(((diff  & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "* " : " ");
        flagdbg.append(((state & StatusBarManager.DISABLE_BACK) != 0) ? "BACK" : "back");
@@ -1538,15 +1539,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
                    .setDuration(175)
                    .start();
            }
        } else if ((diff & StatusBarManager.DISABLE_PRIVATE_NOTIFICATIONS) != 0) {
            if ((state & StatusBarManager.DISABLE_PRIVATE_NOTIFICATIONS) != 0) {
                // we are outside a secure keyguard, so we need to switch to "public" mode
                setLockscreenPublicMode(true);
            } else {
                // user has authenticated the device; full notifications may be shown
                setLockscreenPublicMode(false);
            }
            updateNotificationIcons();
        }
    }

@@ -2910,7 +2902,22 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {

    public void showKeyguard() {
        mOnKeyguard = true;
        updateKeyguardState();
        instantExpandNotificationsPanel();
    }

    public void hideKeyguard() {
        mOnKeyguard = false;
        updateKeyguardState();
        instantCollapseNotificationPanel();
    }

    private void updatePublicMode() {
        setLockscreenPublicMode(mOnKeyguard && mStatusBarKeyguardViewManager.isSecure());
    }

    private void updateKeyguardState() {
        if (mOnKeyguard) {
            if (isFlippedToSettings()) {
                flipToNotifications();
            }
@@ -2920,21 +2927,19 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {

            mKeyguardFlipper.setVisibility(View.VISIBLE);
            mSettingsContainer.setKeyguardShowing(true);
        updateRowStates();
        checkBarModes();
    }

    public void hideKeyguard() {
        mOnKeyguard = false;
        } else {
            mKeyguardStatusView.setVisibility(View.GONE);
            mKeyguardBottomArea.setVisibility(View.GONE);
            mNotificationPanelHeader.setVisibility(View.VISIBLE);

            mKeyguardFlipper.setVisibility(View.GONE);
            mSettingsContainer.setKeyguardShowing(false);
        }

        updatePublicMode();
        updateRowStates();
        instantCollapseNotificationPanel();
        checkBarModes();
        updateNotificationIcons();
    }

    public void userActivity() {
+4 −0
Original line number Diff line number Diff line
@@ -179,6 +179,10 @@ public class StatusBarKeyguardViewManager {
        }
    }

    public boolean isSecure() {
        return mBouncer.isSecure();
    }

    /**
     * @return Whether the keyguard is showing
     */