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

Commit a78e070a authored by Schneider Victor-tulias's avatar Schneider Victor-tulias Committed by Android (Google) Code Review
Browse files

Merge changes from topic "presubmit-am-1224af9ca3f341a895e4bc19976e2bb8" into tm-dev

* changes:
  Fix recents animation flicker
  Fix janky overview animation.
parents 8217fce3 9f922d35
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.widget.Toast.LENGTH_SHORT;

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.PagedView.INVALID_PAGE;
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
@@ -66,6 +67,7 @@ import android.graphics.RectF;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnApplyWindowInsetsListener;
@@ -926,7 +928,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
            mLogDirectionUpOrLeft = velocity.x < 0;
        }
        mDownPos = downPos;
        handleNormalGestureEnd(endVelocity, isFling, velocity, false /* isCancel */);
        Runnable handleNormalGestureEndCallback = () ->
                handleNormalGestureEnd(endVelocity, isFling, velocity, /* isCancel= */ false);
        if (mRecentsView != null) {
            mRecentsView.runOnPageScrollsInitialized(handleNormalGestureEndCallback);
        } else {
            handleNormalGestureEndCallback.run();
        }
    }

    private void endRunningWindowAnim(boolean cancel) {
@@ -1130,6 +1138,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
        } else if (endTarget == RECENTS) {
            if (mRecentsView != null) {
                int nearestPage = mRecentsView.getDestinationPage();
                if (nearestPage == INVALID_PAGE) {
                    // Allow the snap to invalid page to catch future error cases.
                    Log.e(TAG,
                            "RecentsView destination page is invalid",
                            new IllegalStateException());
                }

                boolean isScrolling = false;
                if (mRecentsView.getNextPage() != nearestPage) {
                    // We shouldn't really scroll to the next page when swiping up to recents.
+19 −1
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T

    private STATE_TYPE mTargetState;

    @Nullable private Runnable mOnInitBackgroundStateUICallback = null;

    protected BaseActivityInterface(boolean rotationSupportedByActivity,
            STATE_TYPE overviewState, STATE_TYPE backgroundState) {
        this.rotationSupportedByActivity = rotationSupportedByActivity;
@@ -408,6 +410,21 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        return null;
    }

    protected void runOnInitBackgroundStateUI(Runnable callback) {
        mOnInitBackgroundStateUICallback = callback;
        ACTIVITY_TYPE activity = getCreatedActivity();
        if (activity != null && activity.getStateManager().getState() == mBackgroundState) {
            onInitBackgroundStateUI();
        }
    }

    private void onInitBackgroundStateUI() {
        if (mOnInitBackgroundStateUICallback != null) {
            mOnInitBackgroundStateUICallback.run();
            mOnInitBackgroundStateUICallback = null;
        }
    }

    public interface AnimationFactory {

        void createActivityInterface(long transitionLength);
@@ -447,13 +464,14 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
            mStartState = mActivity.getStateManager().getState();
        }

        protected ACTIVITY_TYPE initUI() {
        protected ACTIVITY_TYPE initBackgroundStateUI() {
            STATE_TYPE resetState = mStartState;
            if (mStartState.shouldDisableRestore()) {
                resetState = mActivity.getStateManager().getRestState();
            }
            mActivity.getStateManager().setRestState(resetState);
            mActivity.getStateManager().goToState(mBackgroundState, false);
            onInitBackgroundStateUI();
            return mActivity;
        }

+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ public final class FallbackActivityInterface extends
            boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
        notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
        DefaultAnimationFactory factory = new DefaultAnimationFactory(callback);
        factory.initUI();
        factory.initBackgroundStateUI();
        return factory;
    }

+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ public final class LauncherActivityInterface extends
            }
        };

        BaseQuickstepLauncher launcher = factory.initUI();
        BaseQuickstepLauncher launcher = factory.initBackgroundStateUI();
        // Since all apps is not visible, we can safely reset the scroll position.
        // This ensures then the next swipe up to all-apps starts from scroll 0.
        launcher.getAppsView().reset(false /* animate */);
+2 −1
Original line number Diff line number Diff line
@@ -217,7 +217,8 @@ public class OverviewCommandHelper {
            @Override
            public void onRecentsAnimationStart(RecentsAnimationController controller,
                    RecentsAnimationTargets targets) {
                interactionHandler.onGestureEnded(0, new PointF(), new PointF());
                activityInterface.runOnInitBackgroundStateUI(() ->
                        interactionHandler.onGestureEnded(0, new PointF(), new PointF()));
                cmd.removeListener(this);
            }

Loading