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

Commit ce171dd5 authored by Matt Pietal's avatar Matt Pietal Committed by Automerger Merge Worker
Browse files

Merge "Transitions - Smooth out bouncer -> gone" into udc-dev am: f2c306c3

parents 41cdeefe f2c306c3
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -82,7 +82,7 @@
    <!-- The vertical margin between the date and the owner info. -->
    <!-- The vertical margin between the date and the owner info. -->


    <!-- The translation for disappearing security views after having solved them. -->
    <!-- The translation for disappearing security views after having solved them. -->
    <dimen name="disappear_y_translation">-32dp</dimen>
    <dimen name="disappear_y_translation">-50dp</dimen>


    <!-- Dimens for animation for the Bouncer PIN view -->
    <!-- Dimens for animation for the Bouncer PIN view -->
    <dimen name="pin_view_trans_y_entry">120dp</dimen>
    <dimen name="pin_view_trans_y_entry">120dp</dimen>
+3 −7
Original line number Original line Diff line number Diff line
@@ -39,7 +39,6 @@ import static java.lang.Integer.max;


import android.animation.Animator;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.Activity;
@@ -1044,13 +1043,10 @@ public class KeyguardSecurityContainer extends ConstraintLayout {


            int yTranslation = mResources.getDimensionPixelSize(R.dimen.disappear_y_translation);
            int yTranslation = mResources.getDimensionPixelSize(R.dimen.disappear_y_translation);


            AnimatorSet anims = new AnimatorSet();
            ObjectAnimator yAnim = ObjectAnimator.ofFloat(mView, View.TRANSLATION_Y, yTranslation);
            ObjectAnimator yAnim = ObjectAnimator.ofFloat(mView, View.TRANSLATION_Y, yTranslation);
            ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(mView, View.ALPHA, 0f);
            yAnim.setInterpolator(Interpolators.STANDARD_ACCELERATE);

            yAnim.setDuration(500);
            anims.setInterpolator(Interpolators.STANDARD_ACCELERATE);
            yAnim.start();
            anims.playTogether(alphaAnim, yAnim);
            anims.start();
        }
        }


        private void setupUserSwitcher() {
        private void setupUserSwitcher() {
+6 −1
Original line number Original line Diff line number Diff line
@@ -637,12 +637,17 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard


    public void startAppearAnimation() {
    public void startAppearAnimation() {
        if (mCurrentSecurityMode != SecurityMode.None) {
        if (mCurrentSecurityMode != SecurityMode.None) {
            mView.setAlpha(1f);
            setAlpha(1f);
            mView.startAppearAnimation(mCurrentSecurityMode);
            mView.startAppearAnimation(mCurrentSecurityMode);
            getCurrentSecurityController().startAppearAnimation();
            getCurrentSecurityController().startAppearAnimation();
        }
        }
    }
    }


    /** Set the alpha of the security container view */
    public void setAlpha(float alpha) {
        mView.setAlpha(alpha);
    }

    public boolean startDisappearAnimation(Runnable onFinishRunnable) {
    public boolean startDisappearAnimation(Runnable onFinishRunnable) {
        boolean didRunAnimation = false;
        boolean didRunAnimation = false;


+28 −0
Original line number Original line Diff line number Diff line
@@ -80,6 +80,9 @@ interface KeyguardRepository {
     */
     */
    val isKeyguardShowing: Flow<Boolean>
    val isKeyguardShowing: Flow<Boolean>


    /** Is the keyguard in a unlocked state? */
    val isKeyguardUnlocked: Flow<Boolean>

    /** Is an activity showing over the keyguard? */
    /** Is an activity showing over the keyguard? */
    val isKeyguardOccluded: Flow<Boolean>
    val isKeyguardOccluded: Flow<Boolean>


@@ -278,6 +281,31 @@ constructor(
            }
            }
            .distinctUntilChanged()
            .distinctUntilChanged()


    override val isKeyguardUnlocked: Flow<Boolean> =
        conflatedCallbackFlow {
                val callback =
                    object : KeyguardStateController.Callback {
                        override fun onUnlockedChanged() {
                            trySendWithFailureLogging(
                                keyguardStateController.isUnlocked,
                                TAG,
                                "updated isKeyguardUnlocked"
                            )
                        }
                    }

                keyguardStateController.addCallback(callback)
                // Adding the callback does not send an initial update.
                trySendWithFailureLogging(
                    keyguardStateController.isUnlocked,
                    TAG,
                    "initial isKeyguardUnlocked"
                )

                awaitClose { keyguardStateController.removeCallback(callback) }
            }
            .distinctUntilChanged()

    override val isKeyguardGoingAway: Flow<Boolean> = conflatedCallbackFlow {
    override val isKeyguardGoingAway: Flow<Boolean> = conflatedCallbackFlow {
        val callback =
        val callback =
            object : KeyguardStateController.Callback {
            object : KeyguardStateController.Callback {
+18 −8
Original line number Original line Diff line number Diff line
@@ -68,8 +68,11 @@ interface KeyguardTransitionRepository {
    /**
    /**
     * Begin a transition from one state to another. Transitions are interruptible, and will issue a
     * Begin a transition from one state to another. Transitions are interruptible, and will issue a
     * [TransitionStep] with state = [TransitionState.CANCELED] before beginning the next one.
     * [TransitionStep] with state = [TransitionState.CANCELED] before beginning the next one.
     *
     * When canceled, there are two options: to continue from the current position of the prior
     * transition, or to reset the position. When [resetIfCanceled] == true, it will do the latter.
     */
     */
    fun startTransition(info: TransitionInfo): UUID?
    fun startTransition(info: TransitionInfo, resetIfCanceled: Boolean = false): UUID?


    /**
    /**
     * Allows manual control of a transition. When calling [startTransition], the consumer must pass
     * Allows manual control of a transition. When calling [startTransition], the consumer must pass
@@ -130,7 +133,10 @@ class KeyguardTransitionRepositoryImpl @Inject constructor() : KeyguardTransitio
        )
        )
    }
    }


    override fun startTransition(info: TransitionInfo): UUID? {
    override fun startTransition(
        info: TransitionInfo,
        resetIfCanceled: Boolean,
    ): UUID? {
        if (lastStep.from == info.from && lastStep.to == info.to) {
        if (lastStep.from == info.from && lastStep.to == info.to) {
            Log.i(TAG, "Duplicate call to start the transition, rejecting: $info")
            Log.i(TAG, "Duplicate call to start the transition, rejecting: $info")
            return null
            return null
@@ -138,7 +144,11 @@ class KeyguardTransitionRepositoryImpl @Inject constructor() : KeyguardTransitio
        val startingValue =
        val startingValue =
            if (lastStep.transitionState != TransitionState.FINISHED) {
            if (lastStep.transitionState != TransitionState.FINISHED) {
                Log.i(TAG, "Transition still active: $lastStep, canceling")
                Log.i(TAG, "Transition still active: $lastStep, canceling")
                if (resetIfCanceled) {
                    0f
                } else {
                    lastStep.value
                    lastStep.value
                }
            } else {
            } else {
                0f
                0f
            }
            }
@@ -227,10 +237,7 @@ class KeyguardTransitionRepositoryImpl @Inject constructor() : KeyguardTransitio
    }
    }


    private fun trace(step: TransitionStep, isManual: Boolean) {
    private fun trace(step: TransitionStep, isManual: Boolean) {
        if (
        if (step.transitionState == TransitionState.RUNNING) {
            step.transitionState != TransitionState.STARTED &&
                step.transitionState != TransitionState.FINISHED
        ) {
            return
            return
        }
        }
        val traceName =
        val traceName =
@@ -243,7 +250,10 @@ class KeyguardTransitionRepositoryImpl @Inject constructor() : KeyguardTransitio
        val traceCookie = traceName.hashCode()
        val traceCookie = traceName.hashCode()
        if (step.transitionState == TransitionState.STARTED) {
        if (step.transitionState == TransitionState.STARTED) {
            Trace.beginAsyncSection(traceName, traceCookie)
            Trace.beginAsyncSection(traceName, traceCookie)
        } else if (step.transitionState == TransitionState.FINISHED) {
        } else if (
            step.transitionState == TransitionState.FINISHED ||
                step.transitionState == TransitionState.CANCELED
        ) {
            Trace.endAsyncSection(traceName, traceCookie)
            Trace.endAsyncSection(traceName, traceCookie)
        }
        }
    }
    }
Loading