From 4df42f85a40b963802fc736939bdd4c17bc1e029 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 13 Nov 2019 15:38:28 -0800 Subject: [PATCH] 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 --- .../android/launcher3/appprediction/PredictionRowView.java | 2 +- .../src/com/android/quickstep/LauncherSwipeHandler.java | 7 +------ src/com/android/launcher3/Launcher.java | 6 +++++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index 23db5df2ed..f82af62aac 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -276,7 +276,7 @@ public class PredictionRowView extends LinearLayout implements boolean predictionsEnabled = predictionCount > 0; if (predictionsEnabled != mPredictionsEnabled) { mPredictionsEnabled = predictionsEnabled; - mLauncher.reapplyUi(); + mLauncher.reapplyUi(false /* cancelCurrentAnimation */); updateVisibility(); } mParent.onHeightUpdated(); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java index 3d664bec7e..fe3926a3c3 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java @@ -167,8 +167,6 @@ public class LauncherSwipeHandler private boolean mIsShelfPeeking; 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; @@ -574,9 +572,7 @@ public class LauncherSwipeHandler // 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. float progress = mCurrentShift.value / mDragLengthFactor; - mLauncherTransitionController.setPlayFraction( - progress <= mShiftAtGestureStart || mShiftAtGestureStart >= 1 - ? 0 : (progress - mShiftAtGestureStart) / (1 - mShiftAtGestureStart)); + mLauncherTransitionController.setPlayFraction(progress); } /** @@ -626,7 +622,6 @@ public class LauncherSwipeHandler @Override public void onGestureStarted() { notifyGestureStartedAsync(); - mShiftAtGestureStart = mCurrentShift.value; mStateCallback.setStateOnUiThread(STATE_GESTURE_STARTED); mGestureStarted = true; } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index aafabff45c..577acb27f6 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -507,12 +507,16 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, @Override public void reapplyUi() { + reapplyUi(true /* cancelCurrentAnimation */); + } + + public void reapplyUi(boolean cancelCurrentAnimation) { if (supportsFakeLandscapeUI()) { mRotationMode = mStableDeviceProfile == null ? RotationMode.NORMAL : getFakeRotationMode(mDeviceProfile); } getRootView().dispatchInsets(); - getStateManager().reapplyState(true /* cancelCurrentAnimation */); + getStateManager().reapplyState(cancelCurrentAnimation); } @Override