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

Commit b7094fcf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Using the first frame delay based on the display refresh rate instead...

Merge "Using the first frame delay based on the display refresh rate instead of hardcoding it to 16ms" into ub-launcher3-qt-r1-dev
parents 7b0520af 4e6c45bc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.app.ActivityOptions;
import android.content.Context;
import android.os.Handler;
import android.util.Log;

@@ -151,7 +152,7 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
    }

    @Override
    public ActivityOptions toActivityOptions(Handler handler, long duration) {
    public ActivityOptions toActivityOptions(Handler handler, long duration, Context context) {
        LauncherAnimationRunner runner = new LauncherAnimationRunner(handler,
                false /* startAtFrontOfQueue */) {

@@ -165,7 +166,7 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
                    );
                    return;
                }
                result.setAnimation(createWindowAnimation(targetCompats));
                result.setAnimation(createWindowAnimation(targetCompats), context);
            }
        };
        return ActivityOptionsCompat.makeRemoteAnimation(
+3 −3
Original line number Diff line number Diff line
@@ -16,10 +16,10 @@
package com.android.launcher3.uioverrides.touchcontrollers;

import static com.android.launcher3.AbstractFloatingView.TYPE_ACCESSIBLE;
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -266,8 +266,8 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
            animationDuration *= LauncherAnimUtils.blockedFlingDurationFactor(velocity);
        }

        float nextFrameProgress = Utilities.boundToRange(
                progress + velocity * SINGLE_FRAME_MS / Math.abs(mEndDisplacement), 0f, 1f);
        float nextFrameProgress = Utilities.boundToRange(progress
                + velocity * getSingleFrameMs(mActivity) / Math.abs(mEndDisplacement), 0f, 1f);

        mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd, logAction));

+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ public final class RecentsActivity extends BaseRecentsActivity {
                        mFallbackRecentsView.resetViewUI();
                    }
                });
                result.setAnimation(anim);
                result.setAnimation(anim, RecentsActivity.this);
            }
        };
        return ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(
+3 −3
Original line number Diff line number Diff line
@@ -17,12 +17,12 @@ package com.android.quickstep;

import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
import static com.android.launcher3.util.RaceConditionTracker.ENTER;
import static com.android.launcher3.util.RaceConditionTracker.EXIT;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
@@ -780,14 +780,14 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
            interpolator = endTarget == RECENTS ? OVERSHOOT_1_2 : DEACCEL;
        } else {
            startShift = Utilities.boundToRange(currentShift - velocityPxPerMs.y
                    * SINGLE_FRAME_MS / mTransitionDragLength, 0, mDragLengthFactor);
                    * getSingleFrameMs(mContext) / mTransitionDragLength, 0, mDragLengthFactor);
            float minFlingVelocity = mContext.getResources()
                    .getDimension(R.dimen.quickstep_fling_min_velocity);
            if (Math.abs(endVelocity) > minFlingVelocity && mTransitionDragLength > 0) {
                if (endTarget == RECENTS && mMode != Mode.NO_BUTTON) {
                    Interpolators.OvershootParams overshoot = new Interpolators.OvershootParams(
                            startShift, endShift, endShift, endVelocity / 1000,
                            mTransitionDragLength);
                            mTransitionDragLength, mContext);
                    endShift = overshoot.end;
                    interpolator = overshoot.interpolator;
                    duration = Utilities.boundToRange(overshoot.duration, MIN_OVERSHOOT_DURATION,
+5 −4
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@
 */
package com.android.launcher3;

import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
import static com.android.systemui.shared.recents.utilities.Utilities
        .postAtFrontOfQueueAsynchronously;

@@ -24,6 +24,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Handler;

@@ -66,7 +67,7 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo

    /**
     * Called on the UI thread when the animation targets are received. The implementation must
     * call {@link AnimationResult#setAnimation(AnimatorSet)} with the target animation to be run.
     * call {@link AnimationResult#setAnimation} with the target animation to be run.
     */
    @UiThread
    public abstract void onCreateAnimation(
@@ -110,7 +111,7 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo
        }

        @UiThread
        public void setAnimation(AnimatorSet animation) {
        public void setAnimation(AnimatorSet animation, Context context) {
            if (mInitialized) {
                throw new IllegalStateException("Animation already initialized");
            }
@@ -134,7 +135,7 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo

                // Because t=0 has the app icon in its original spot, we can skip the
                // first frame and have the same movement one frame earlier.
                mAnimator.setCurrentPlayTime(SINGLE_FRAME_MS);
                mAnimator.setCurrentPlayTime(getSingleFrameMs(context));
            }
        }
    }
Loading