Fix adjacent task positioning for consecutive swipe gestures
- Always use the recents scale down animation when coming from BACKGROUND_APP state
- Adjust scale down animation to calculate based on translationY = 0 instead of
translationY > 0 if it is still set from a previous interaction
- Fallback to using launcher's insets in the case that a task doesn't yet have
thumbnail data (we remove the data when the task stack is invisible, so it
might not yet be restored if you swipe up again too quickly)
Bug: 111926330
Change-Id: I4bf0bf1b2fa564f0a2c27e7c053c2216856cb024
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index 4df1b37..af25355 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -272,7 +272,8 @@
Consumer<AnimatorPlaybackController> callback) {
LauncherState endState = interactionType == INTERACTION_QUICK_SCRUB
? FAST_OVERVIEW : OVERVIEW;
- if (wasVisible) {
+ if (wasVisible && fromState != BACKGROUND_APP) {
+ // If a translucent app was launched fom launcher, animate launcher states.
DeviceProfile dp = activity.getDeviceProfile();
long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
callback.accept(activity.getStateManager()
@@ -330,14 +331,17 @@
}
// Setup the clip animation helper source/target rects in the final transformed state
- // of the recents view (a scale may be applied prior to this animation starting to
- // line up the side pages during swipe up)
+ // of the recents view (a scale/translationY may be applied prior to this animation
+ // starting to line up the side pages during swipe up)
float prevRvScale = recentsView.getScaleX();
+ float prevRvTransY = recentsView.getTranslationY();
float targetRvScale = endState.getOverviewScaleAndTranslationYFactor(launcher)[0];
SCALE_PROPERTY.set(recentsView, targetRvScale);
+ recentsView.setTranslationY(0);
ClipAnimationHelper clipHelper = new ClipAnimationHelper(launcher);
clipHelper.fromTaskThumbnailView(v.getThumbnail(), (RecentsView) v.getParent(), null);
SCALE_PROPERTY.set(recentsView, prevRvScale);
+ recentsView.setTranslationY(prevRvTransY);
if (!clipHelper.getSourceRect().isEmpty() && !clipHelper.getTargetRect().isEmpty()) {
float fromScale = clipHelper.getSourceRect().width()
diff --git a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
index c612b05..57400bd 100644
--- a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -32,7 +32,6 @@
import android.os.Build;
import android.os.RemoteException;
import android.view.animation.Interpolator;
-
import androidx.annotation.Nullable;
import com.android.launcher3.BaseDraggingActivity;
@@ -277,7 +276,8 @@
updateStackBoundsToMultiWindowTaskSize(activity);
} else {
mSourceStackBounds.set(mHomeStackBounds);
- mSourceInsets.set(ttv.getInsets());
+ Rect fallback = dl.getInsets();
+ mSourceInsets.set(ttv.getInsets(fallback));
}
TransformedRect targetRect = new TransformedRect();
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index d0289d0..90604ef 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -169,11 +169,11 @@
return mDimAlpha;
}
- public Rect getInsets() {
+ public Rect getInsets(Rect fallback) {
if (mThumbnailData != null) {
return mThumbnailData.insets;
}
- return new Rect();
+ return fallback;
}
public int getSysUiStatusNavFlags() {