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

Commit 8690be5b authored by Matt Pietal's avatar Matt Pietal
Browse files

Keyguard - Fix clock in occluded state

The status area (clock, smartspace) was not being shown after exiting
an activity on the lockscreen. The y translation value was incorrect
for the branch it was taking. Add a new check for occlusion, and use
the correct transition when leaving this state.

Fixes: 184188027
Test: manual (use emergency call button)
Change-Id: I6fa34e55252ac8435031915a7e929711e7976fe2
parent 28c48606
Loading
Loading
Loading
Loading
+4 −24
Original line number Diff line number Diff line
@@ -51,8 +51,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
    private final KeyguardVisibilityHelper mKeyguardVisibilityHelper;
    private final Rect mClipBounds = new Rect();

    private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL;

    @Inject
    public KeyguardStatusViewController(
            KeyguardStatusView keyguardStatusView,
@@ -192,28 +190,11 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
     * Update position of the view with an optional animation
     */
    public void updatePosition(int x, int y, float scale, boolean animate) {
        // We animate the status view visible/invisible using Y translation, so don't change it
        // while the animation is running.
        if (!mKeyguardVisibilityHelper.isVisibilityAnimating()) {
        PropertyAnimator.setProperty(mView, AnimatableProperty.Y, y, CLOCK_ANIMATION_PROPERTIES,
                animate);
        }

        if (mLockScreenMode == KeyguardUpdateMonitor.LOCK_SCREEN_MODE_LAYOUT_1) {
            // reset any prior movement
            PropertyAnimator.setProperty(mView, AnimatableProperty.X, 0,
                    CLOCK_ANIMATION_PROPERTIES, animate);

        mKeyguardClockSwitchController.updatePosition(x, scale, CLOCK_ANIMATION_PROPERTIES,
                animate);
        } else {
            // reset any prior movement
            mKeyguardClockSwitchController.updatePosition(0, 0f, CLOCK_ANIMATION_PROPERTIES,
                    animate);

            PropertyAnimator.setProperty(mView, AnimatableProperty.X, x,
                    CLOCK_ANIMATION_PROPERTIES, animate);
        }
    }

    /**
@@ -254,7 +235,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
    private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
        @Override
        public void onLockScreenModeChanged(int mode) {
            mLockScreenMode = mode;
            mKeyguardSliceViewController.updateLockScreenMode(mode);
            mView.setCanShowOwnerInfo(false);
            mView.updateLogoutView(false);
+15 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ public class KeyguardVisibilityHelper {
    private final KeyguardStateController mKeyguardStateController;
    private final DozeParameters mDozeParameters;
    private boolean mKeyguardViewVisibilityAnimating;
    private boolean mLastOccludedState = false;

    public KeyguardVisibilityHelper(View view, KeyguardStateController keyguardStateController,
            DozeParameters dozeParameters) {
@@ -57,6 +58,7 @@ public class KeyguardVisibilityHelper {
            boolean goingToFullShade,
            int oldStatusBarState) {
        mView.animate().cancel();
        boolean isOccluded = mKeyguardStateController.isOccluded();
        mKeyguardViewVisibilityAnimating = false;
        if ((!keyguardFadingAway && oldStatusBarState == KEYGUARD
                && statusBarState != KEYGUARD) || goingToFullShade) {
@@ -95,6 +97,17 @@ public class KeyguardVisibilityHelper {
                        .setStartDelay(0)
                        .withEndAction(mAnimateKeyguardStatusViewInvisibleEndRunnable)
                        .start();
            } else if (mLastOccludedState && !isOccluded) {
                // An activity was displayed over the lock screen, and has now gone away
                mView.setVisibility(View.VISIBLE);
                mView.setAlpha(0f);

                mView.animate()
                        .setDuration(StackStateAnimator.ANIMATION_DURATION_WAKEUP)
                        .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
                        .alpha(1f)
                        .withEndAction(mAnimateKeyguardStatusViewVisibleEndRunnable)
                        .start();
            } else if (mDozeParameters.shouldControlUnlockedScreenOff()) {
                mKeyguardViewVisibilityAnimating = true;

@@ -119,6 +132,8 @@ public class KeyguardVisibilityHelper {
            mView.setVisibility(View.GONE);
            mView.setAlpha(1f);
        }

        mLastOccludedState = isOccluded;
    }

    private final Runnable mAnimateKeyguardStatusViewInvisibleEndRunnable = () -> {