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

Commit efe1d4bf authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Don't factor animating-to-sleep for nav bar visibility" into sc-qpr1-dev

parents 84a7a431 af95ce5b
Loading
Loading
Loading
Loading
+38 −20
Original line number Original line Diff line number Diff line
@@ -53,6 +53,7 @@ import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManager;
import com.android.systemui.keyguard.FaceAuthScreenBrightnessController;
import com.android.systemui.keyguard.FaceAuthScreenBrightnessController;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.navigationbar.NavigationBarView;
import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.navigationbar.NavigationModeController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.QuickStepContract;
@@ -92,7 +93,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    // with the appear animations of the PIN/pattern/password views.
    // with the appear animations of the PIN/pattern/password views.
    private static final long NAV_BAR_SHOW_DELAY_BOUNCER = 320;
    private static final long NAV_BAR_SHOW_DELAY_BOUNCER = 320;


    private static final long WAKE_AND_UNLOCK_SCRIM_FADEOUT_DURATION_MS = 200;
    // The duration to fade the nav bar content in/out when the device starts to sleep
    private static final long NAV_BAR_CONTENT_FADE_DURATION = 125;


    // Duration of the Keyguard dismissal animation in case the user is currently locked. This is to
    // Duration of the Keyguard dismissal animation in case the user is currently locked. This is to
    // make everything a bit slower to bridge a gap until the user is unlocked and home screen has
    // make everything a bit slower to bridge a gap until the user is unlocked and home screen has
@@ -194,10 +196,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    private boolean mLastGesturalNav;
    private boolean mLastGesturalNav;
    private boolean mLastIsDocked;
    private boolean mLastIsDocked;
    private boolean mLastPulsing;
    private boolean mLastPulsing;
    private boolean mLastAnimatedToSleep;
    private int mLastBiometricMode;
    private int mLastBiometricMode;
    private boolean mQsExpanded;
    private boolean mQsExpanded;
    private boolean mAnimatedToSleep;


    private OnDismissAction mAfterKeyguardGoneAction;
    private OnDismissAction mAfterKeyguardGoneAction;
    private Runnable mKeyguardGoneCancelAction;
    private Runnable mKeyguardGoneCancelAction;
@@ -320,20 +320,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
            mDockManager.addListener(mDockEventListener);
            mDockManager.addListener(mDockEventListener);
            mIsDocked = mDockManager.isDocked();
            mIsDocked = mDockManager.isDocked();
        }
        }
        mWakefulnessLifecycle.addObserver(new WakefulnessLifecycle.Observer() {
            @Override
            public void onFinishedWakingUp() {
                mAnimatedToSleep = false;
                updateStates();
            }

            @Override
            public void onFinishedGoingToSleep() {
                mAnimatedToSleep =
                        mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying();
                updateStates();
            }
        });
    }
    }


    @Override
    @Override
@@ -566,12 +552,26 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    public void onStartedWakingUp() {
    public void onStartedWakingUp() {
        mStatusBar.getNotificationShadeWindowView().getWindowInsetsController()
        mStatusBar.getNotificationShadeWindowView().getWindowInsetsController()
                .setAnimationsDisabled(false);
                .setAnimationsDisabled(false);
        View currentView = getCurrentNavBarView();
        if (currentView != null) {
            currentView.animate()
                    .alpha(1f)
                    .setDuration(NAV_BAR_CONTENT_FADE_DURATION)
                    .start();
        }
    }
    }


    @Override
    @Override
    public void onStartedGoingToSleep() {
    public void onStartedGoingToSleep() {
        mStatusBar.getNotificationShadeWindowView().getWindowInsetsController()
        mStatusBar.getNotificationShadeWindowView().getWindowInsetsController()
                .setAnimationsDisabled(true);
                .setAnimationsDisabled(true);
        View currentView = getCurrentNavBarView();
        if (currentView != null) {
            currentView.animate()
                    .alpha(0f)
                    .setDuration(NAV_BAR_CONTENT_FADE_DURATION)
                    .start();
        }
    }
    }


    @Override
    @Override
@@ -993,10 +993,28 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        mLastBiometricMode = mBiometricUnlockController.getMode();
        mLastBiometricMode = mBiometricUnlockController.getMode();
        mLastGesturalNav = mGesturalNav;
        mLastGesturalNav = mGesturalNav;
        mLastIsDocked = mIsDocked;
        mLastIsDocked = mIsDocked;
        mLastAnimatedToSleep = mAnimatedToSleep;
        mStatusBar.onKeyguardViewManagerStatesUpdated();
        mStatusBar.onKeyguardViewManagerStatesUpdated();
    }
    }


    /**
     * Updates the visibility of the nav bar content views.
     */
    private void updateNavigationBarContentVisibility(boolean navBarContentVisible) {
        final NavigationBarView navBarView = mStatusBar.getNavigationBarView();
        if (navBarView != null && navBarView.getCurrentView() != null) {
            final View currentView = navBarView.getCurrentView();
            currentView.setVisibility(navBarContentVisible ? View.VISIBLE : View.INVISIBLE);
        }
    }

    private View getCurrentNavBarView() {
        final NavigationBarView navBarView = mStatusBar.getNavigationBarView();
        return navBarView != null ? navBarView.getCurrentView() : null;
    }

    /**
     * Updates the visibility of the nav bar window (which will cause insets changes).
     */
    protected void updateNavigationBarVisibility(boolean navBarVisible) {
    protected void updateNavigationBarVisibility(boolean navBarVisible) {
        if (mStatusBar.getNavigationBarView() != null) {
        if (mStatusBar.getNavigationBarView() != null) {
            if (navBarVisible) {
            if (navBarVisible) {
@@ -1024,7 +1042,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        boolean hideWhileDozing = mDozing && biometricMode != MODE_WAKE_AND_UNLOCK_PULSING;
        boolean hideWhileDozing = mDozing && biometricMode != MODE_WAKE_AND_UNLOCK_PULSING;
        boolean keyguardWithGestureNav = (keyguardShowing && !mDozing || mPulsing && !mIsDocked)
        boolean keyguardWithGestureNav = (keyguardShowing && !mDozing || mPulsing && !mIsDocked)
                && mGesturalNav;
                && mGesturalNav;
        return (!mAnimatedToSleep && !keyguardShowing && !hideWhileDozing || mBouncer.isShowing()
        return (!keyguardShowing && !hideWhileDozing || mBouncer.isShowing()
                || mRemoteInputActive || keyguardWithGestureNav
                || mRemoteInputActive || keyguardWithGestureNav
                || mGlobalActionsVisible);
                || mGlobalActionsVisible);
    }
    }
@@ -1037,7 +1055,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        boolean hideWhileDozing = mLastDozing && mLastBiometricMode != MODE_WAKE_AND_UNLOCK_PULSING;
        boolean hideWhileDozing = mLastDozing && mLastBiometricMode != MODE_WAKE_AND_UNLOCK_PULSING;
        boolean keyguardWithGestureNav = (keyguardShowing && !mLastDozing
        boolean keyguardWithGestureNav = (keyguardShowing && !mLastDozing
                || mLastPulsing && !mLastIsDocked) && mLastGesturalNav;
                || mLastPulsing && !mLastIsDocked) && mLastGesturalNav;
        return (!mLastAnimatedToSleep && !keyguardShowing && !hideWhileDozing || mLastBouncerShowing
        return (!keyguardShowing && !hideWhileDozing || mLastBouncerShowing
                || mLastRemoteInputActive || keyguardWithGestureNav
                || mLastRemoteInputActive || keyguardWithGestureNav
                || mLastGlobalActionsVisible);
                || mLastGlobalActionsVisible);
    }
    }
+0 −14
Original line number Original line Diff line number Diff line
@@ -299,18 +299,4 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {


        verify(mBouncer).updateKeyguardPosition(1.0f);
        verify(mBouncer).updateKeyguardPosition(1.0f);
    }
    }

    @Test
    public void testNavBarHiddenWhenSleepAnimationStarts() {
        mStatusBarKeyguardViewManager.hide(0 /* startTime */, 0 /* fadeoutDuration */);
        assertTrue(mStatusBarKeyguardViewManager.isNavBarVisible());

        // Verify that the nav bar is hidden when the screen off animation starts
        doReturn(true).when(mUnlockedScreenOffAnimationController).isScreenOffAnimationPlaying();
        mWakefulnessLifecycle.dispatchFinishedGoingToSleep();
        assertFalse(mStatusBarKeyguardViewManager.isNavBarVisible());

        mWakefulnessLifecycle.dispatchFinishedWakingUp();
        assertTrue(mStatusBarKeyguardViewManager.isNavBarVisible());
    }
}
}