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

Commit e046ea22 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Don't show taskbar when keyguard occluded" into sc-v2-dev

parents 329cb375 ea7e9a48
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -75,9 +75,10 @@ public class NavbarButtonsViewController {
    private static final int FLAG_A11Y_VISIBLE = 1 << 3;
    private static final int FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE = 1 << 4;
    private static final int FLAG_KEYGUARD_VISIBLE = 1 << 5;
    private static final int FLAG_DISABLE_HOME = 1 << 6;
    private static final int FLAG_DISABLE_RECENTS = 1 << 7;
    private static final int FLAG_DISABLE_BACK = 1 << 8;
    private static final int FLAG_KEYGUARD_OCCLUDED = 1 << 6;
    private static final int FLAG_DISABLE_HOME = 1 << 7;
    private static final int FLAG_DISABLE_RECENTS = 1 << 8;
    private static final int FLAG_DISABLE_BACK = 1 << 9;

    private static final int MASK_IME_SWITCHER_VISIBLE = FLAG_SWITCHER_SUPPORTED | FLAG_IME_VISIBLE;

@@ -188,10 +189,11 @@ public class NavbarButtonsViewController {
        mPropertyHolders.add(new StatePropertyHolder(
                mBackButton, flags -> (flags & FLAG_IME_VISIBLE) != 0, View.ROTATION,
                isRtl ? 90 : -90, 0));
        // Hide when keyguard is showing, show when bouncer is showing
        // Hide when keyguard is showing, show when bouncer or lock screen app is showing
        mPropertyHolders.add(new StatePropertyHolder(mBackButton,
                flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 ||
                        (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0));
                        (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0 ||
                        (flags & FLAG_KEYGUARD_OCCLUDED) != 0));

        // home and recents buttons
        View homeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, navContainer,
@@ -256,10 +258,12 @@ public class NavbarButtonsViewController {
    }

    /**
     * Slightly misnamed, but should be called when keyguard OR AOD is showing
     * Slightly misnamed, but should be called when keyguard OR AOD is showing.
     * We consider keyguardVisible when it's showing bouncer OR is occlucded by another app
     */
    public void setKeyguardVisible(boolean isKeyguardVisible) {
        updateStateForFlag(FLAG_KEYGUARD_VISIBLE, isKeyguardVisible);
    public void setKeyguardVisible(boolean isKeyguardVisible, boolean isKeyguardOccluded) {
        updateStateForFlag(FLAG_KEYGUARD_VISIBLE, isKeyguardVisible || isKeyguardOccluded);
        updateStateForFlag(FLAG_KEYGUARD_OCCLUDED, isKeyguardOccluded);
        applyState();
    }

+6 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_D
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;

import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
@@ -21,7 +22,7 @@ public class TaskbarKeyguardController {
    private static final int KEYGUARD_SYSUI_FLAGS = SYSUI_STATE_BOUNCER_SHOWING |
            SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING | SYSUI_STATE_DEVICE_DOZING |
            SYSUI_STATE_OVERVIEW_DISABLED | SYSUI_STATE_HOME_DISABLED |
            SYSUI_STATE_BACK_DISABLED;
            SYSUI_STATE_BACK_DISABLED | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;

    private final TaskbarActivityContext mContext;
    private int mKeyguardSysuiFlags;
@@ -51,6 +52,8 @@ public class TaskbarKeyguardController {
        boolean bouncerShowing = (systemUiStateFlags & SYSUI_STATE_BOUNCER_SHOWING) != 0;
        boolean keyguardShowing = (systemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING)
                != 0;
        boolean keyguardOccluded =
                (systemUiStateFlags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0;
        boolean dozing = (systemUiStateFlags & SYSUI_STATE_DEVICE_DOZING) != 0;

        int interestingKeyguardFlags = systemUiStateFlags & KEYGUARD_SYSUI_FLAGS;
@@ -61,7 +64,8 @@ public class TaskbarKeyguardController {

        mBouncerShowing = bouncerShowing;

        mNavbarButtonsViewController.setKeyguardVisible(keyguardShowing || dozing);
        mNavbarButtonsViewController.setKeyguardVisible(keyguardShowing || dozing,
                keyguardOccluded);
        updateIconsForBouncer();
    }