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

Commit 09c09bba authored by Tony Wickham's avatar Tony Wickham
Browse files

Fix recents scale sometimes lagging behind window scale

We were previously offsetting the launcher animation progress based
on when we got onGestureStart, which meant it would lag behind if
onGestureStart came late. Now that we track the window instead of
the launcher shelf, and we don't show the launcher animation right
away in fully gestural mode anyway, we should remove this to ensure
the launcher part of the animation always lines up with the app
window.

We also reapply state whenever predictions are enabled, e.g. when
launcher starts after being force stopped, and previously this was
canceling the existing state animation. We don't want to do that
because predictions can be enabled at any point on a cold start,
and cancelling the existing state animation means that RecentsView
shows up in fullscreen and not attached to the app window for the
duration of the gesture.

Bug: 144454486
Change-Id: I65a2c71c9acd2f5345941ea2cff7d32c04b7be3f
Merged-In: I65a2c71c9acd2f5345941ea2cff7d32c04b7be3f
parent ec72bf63
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -276,7 +276,7 @@ public class PredictionRowView extends LinearLayout implements
        boolean predictionsEnabled = predictionCount > 0;
        boolean predictionsEnabled = predictionCount > 0;
        if (predictionsEnabled != mPredictionsEnabled) {
        if (predictionsEnabled != mPredictionsEnabled) {
            mPredictionsEnabled = predictionsEnabled;
            mPredictionsEnabled = predictionsEnabled;
            mLauncher.reapplyUi();
            mLauncher.reapplyUi(false /* cancelCurrentAnimation */);
            updateVisibility();
            updateVisibility();
        }
        }
        mParent.onHeightUpdated();
        mParent.onHeightUpdated();
+1 −6
Original line number Original line Diff line number Diff line
@@ -206,8 +206,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
    private boolean mIsShelfPeeking;
    private boolean mIsShelfPeeking;


    private boolean mContinuingLastGesture;
    private boolean mContinuingLastGesture;
    // To avoid UI jump when gesture is started, we offset the animation by the threshold.
    private float mShiftAtGestureStart = 0;


    private ThumbnailData mTaskSnapshot;
    private ThumbnailData mTaskSnapshot;


@@ -580,9 +578,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
        // Normalize the progress to 0 to 1, as the animation controller will clamp it to that
        // Normalize the progress to 0 to 1, as the animation controller will clamp it to that
        // anyway. The controller mimics the drag length factor by applying it to its interpolators.
        // anyway. The controller mimics the drag length factor by applying it to its interpolators.
        float progress = mCurrentShift.value / mDragLengthFactor;
        float progress = mCurrentShift.value / mDragLengthFactor;
        mLauncherTransitionController.setPlayFraction(
        mLauncherTransitionController.setPlayFraction(progress);
                progress <= mShiftAtGestureStart || mShiftAtGestureStart >= 1
                        ? 0 : (progress - mShiftAtGestureStart) / (1 - mShiftAtGestureStart));
    }
    }


    /**
    /**
@@ -622,7 +618,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
    @Override
    @Override
    public void onGestureStarted() {
    public void onGestureStarted() {
        notifyGestureStartedAsync();
        notifyGestureStartedAsync();
        mShiftAtGestureStart = mCurrentShift.value;
        setStateOnUiThread(STATE_GESTURE_STARTED);
        setStateOnUiThread(STATE_GESTURE_STARTED);
        mGestureStarted = true;
        mGestureStarted = true;
    }
    }
+5 −1
Original line number Original line Diff line number Diff line
@@ -445,12 +445,16 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,


    @Override
    @Override
    public void reapplyUi() {
    public void reapplyUi() {
        reapplyUi(true /* cancelCurrentAnimation */);
    }

    public void reapplyUi(boolean cancelCurrentAnimation) {
        if (supportsFakeLandscapeUI()) {
        if (supportsFakeLandscapeUI()) {
            mRotationMode = mStableDeviceProfile == null
            mRotationMode = mStableDeviceProfile == null
                    ? RotationMode.NORMAL : UiFactory.getRotationMode(mDeviceProfile);
                    ? RotationMode.NORMAL : UiFactory.getRotationMode(mDeviceProfile);
        }
        }
        getRootView().dispatchInsets();
        getRootView().dispatchInsets();
        getStateManager().reapplyState(true /* cancelCurrentAnimation */);
        getStateManager().reapplyState(cancelCurrentAnimation);
    }
    }


    @Override
    @Override