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

Commit c2980782 authored by Jon Miranda's avatar Jon Miranda
Browse files

Add staggered workspace animation to keyguard unlock animation.

Added behind FeatureFlag.KEYGUARD_ANIMATION due to dependency on
Ie94ab8ecd35e9dcc28d0b8f7aaeb058e15b0f80b.

Added dynamic resource unlock_staggered_velocity_dp_per_s so that the
animation can be tuned.

Bug: 151238866
Change-Id: I4d349d32cc7d86be3cdc582c2a7c565be2931444
parent 24b449d5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -120,8 +120,8 @@ public class FlingAndHoldTouchController extends PortraitStatesTouchController {
        mPeekAnim.start();
        VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC);

        mLauncher.getDragLayer().getScrim().animateToSysuiMultiplier(isPaused ? 0 : 1,
                peekDuration, 0);
        mLauncher.getDragLayer().getScrim().createSysuiMultiplierAnim(isPaused ? 0 : 1)
                .setDuration(peekDuration).start();
    }

    /**
+6 −0
Original line number Diff line number Diff line
@@ -126,6 +126,8 @@ public class StaggeredWorkspaceAnim {
            addScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS);
        }

        mAnimators.play(launcher.getDragLayer().getScrim().createSysuiMultiplierAnim(0f, 1f)
                .setDuration(ALPHA_DURATION_MS));
        mAnimators.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
@@ -153,6 +155,10 @@ public class StaggeredWorkspaceAnim {
        launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true);
    }

    public AnimatorSet getAnimators() {
        return mAnimators;
    }

    /**
     * Starts the animation.
     */
+26 −11
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.launcher3;

import static android.util.TypedValue.COMPLEX_UNIT_DIP;

import static com.android.launcher3.BaseActivity.INVISIBLE_ALL;
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_APP_TRANSITIONS;
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_PENDING_FLAGS;
@@ -29,6 +31,7 @@ import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE;
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7;
import static com.android.launcher3.anim.Interpolators.EXAGGERATED_EASE;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS;
import static com.android.launcher3.uioverrides.BackgroundBlurController.BACKGROUND_BLUR;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
@@ -58,6 +61,7 @@ import android.os.CancellationSignal;
import android.os.Handler;
import android.os.Looper;
import android.util.Pair;
import android.util.TypedValue;
import android.view.View;

import androidx.annotation.NonNull;
@@ -70,12 +74,14 @@ import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.uioverrides.BackgroundBlurController;
import com.android.launcher3.util.DynamicResource;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.RemoteAnimationTargets;
import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.QuickStepContract;
@@ -156,6 +162,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
    // Strong refs to runners which are cleared when the launcher activity is destroyed
    private WrappedAnimationRunnerImpl mWallpaperOpenRunner;
    private WrappedAnimationRunnerImpl mAppLaunchRunner;
    private WrappedAnimationRunnerImpl mKeyguardGoingAwayRunner;

    private final AnimatorListenerAdapter mForceInvisibleListener = new AnimatorListenerAdapter() {
        @Override
@@ -623,6 +630,17 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
                            new WrappedLauncherAnimationRunner<>(mWallpaperOpenRunner,
                                    false /* startAtFrontOfQueue */),
                            CLOSING_TRANSITION_DURATION_MS, 0 /* statusBarTransitionDelay */));

            if (KEYGUARD_ANIMATION.get()) {
                mKeyguardGoingAwayRunner = createWallpaperOpenRunner(true /* fromUnlock */);
                definition.addRemoteAnimation(
                        WindowManagerWrapper.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
                        new RemoteAnimationAdapterCompat(
                                new WrappedLauncherAnimationRunner<>(mKeyguardGoingAwayRunner,
                                        true /* startAtFrontOfQueue */),
                                CLOSING_TRANSITION_DURATION_MS, 0 /* statusBarTransitionDelay */));
            }

            new ActivityCompat(mLauncher).registerRemoteAnimations(definition);
        }
    }
@@ -639,6 +657,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
            // definition so we don't have to wait for the system gc
            mWallpaperOpenRunner = null;
            mAppLaunchRunner = null;
            mKeyguardGoingAwayRunner = null;
        }
    }

@@ -868,18 +887,14 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
                        || mLauncher.isForceInvisible()) {
                    // Only register the content animation for cancellation when state changes
                    mLauncher.getStateManager().setCurrentAnimation(anim);

                    if (mFromUnlock) {
                        Pair<AnimatorSet, Runnable> contentAnimator =
                                getLauncherContentAnimator(false /* isAppOpening */,
                                        new float[] {mContentTransY, 0});
                        contentAnimator.first.setStartDelay(0);
                        anim.play(contentAnimator.first);
                        anim.addListener(new AnimatorListenerAdapter() {
                            @Override
                            public void onAnimationEnd(Animator animation) {
                                contentAnimator.second.run();
                            }
                        });
                        float velocityDpPerS = DynamicResource.provider(mLauncher)
                                .getDimension(R.dimen.unlock_staggered_velocity_dp_per_s);
                        float velocityPxPerS = TypedValue.applyDimension(COMPLEX_UNIT_DIP,
                                velocityDpPerS, mLauncher.getResources().getDisplayMetrics());
                        anim.play(new StaggeredWorkspaceAnim(mLauncher, velocityPxPerS, false)
                                .getAnimators());
                    } else {
                        createLauncherResumeAnimation(anim);
                    }
+2 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@

    <item name="staggered_damping_ratio" type="dimen" format="float">0.7</item>
    <item name="staggered_stiffness" type="dimen" format="float">150</item>
    <dimen name="unlock_staggered_velocity_dp_per_s">3dp</dimen>

    <!-- Swipe up to home related -->
    <dimen name="swipe_up_fling_min_visible_change">18dp</dimen>
@@ -170,6 +171,7 @@

        <item>@dimen/staggered_damping_ratio</item>
        <item>@dimen/staggered_stiffness</item>
        <item>@dimen/unlock_staggered_velocity_dp_per_s</item>

        <item>@dimen/swipe_up_fling_min_visible_change</item>
        <item>@dimen/swipe_up_y_overshoot</item>
+3 −0
Original line number Diff line number Diff line
@@ -83,6 +83,9 @@ public final class FeatureFlags {
    public static final BooleanFlag UNSTABLE_SPRINGS = getDebugFlag(
            "UNSTABLE_SPRINGS", false, "Enable unstable springs for quickstep animations");

    public static final BooleanFlag KEYGUARD_ANIMATION = getDebugFlag(
            "KEYGUARD_ANIMATION", false, "Enable animation for keyguard going away on wallpaper");

    public static final BooleanFlag ADAPTIVE_ICON_WINDOW_ANIM = getDebugFlag(
            "ADAPTIVE_ICON_WINDOW_ANIM", true, "Use adaptive icons for window animations.");

Loading