Fixing wrong origin when launching new task from overview
> Also removing some unnecessary layout passes during launch animation
Bug: 133226418
Change-Id: I36fe69827853366deb7c56ca25f39e20c1a0b825
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
index 1042c60..eac4dce 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
@@ -121,12 +121,16 @@
alpha.setDuration(CONTENT_ALPHA_DURATION);
alpha.setInterpolator(LINEAR);
anim.play(alpha);
+ overview.setFreezeViewVisibility(true);
ObjectAnimator transY = ObjectAnimator.ofFloat(overview, View.TRANSLATION_Y, trans);
transY.setInterpolator(AGGRESSIVE_EASE);
transY.setDuration(CONTENT_TRANSLATION_DURATION);
anim.play(transY);
- return mLauncher.getStateManager()::reapplyState;
+ return () -> {
+ overview.setFreezeViewVisibility(false);
+ mLauncher.getStateManager().reapplyState();
+ };
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
index 8ad5f27..5b2e27e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -227,6 +227,7 @@
@Override
public void onStateTransitionStart(LauncherState toState) {
setOverviewStateEnabled(toState.overviewUi);
+ setFreezeViewVisibility(true);
}
@Override
@@ -236,6 +237,7 @@
reset();
}
setOverlayEnabled(finalState == OVERVIEW);
+ setFreezeViewVisibility(false);
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 38bd461..e38a315 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -188,6 +188,7 @@
private boolean mDwbToastShown;
private boolean mDisallowScrollToClearAll;
private boolean mOverlayEnabled;
+ private boolean mFreezeViewVisibility;
/**
* TODO: Call reloadIdNeeded in onTaskStackChanged.
@@ -1302,7 +1303,25 @@
mEmptyMessagePaint.setAlpha(alphaInt);
mEmptyIcon.setAlpha(alphaInt);
- setVisibility(alpha > 0 ? VISIBLE : GONE);
+ if (alpha > 0) {
+ setVisibility(VISIBLE);
+ } else if (!mFreezeViewVisibility) {
+ setVisibility(GONE);
+ }
+ }
+
+ /**
+ * Freezes the view visibility change. When frozen, the view will not change its visibility
+ * to gone due to alpha changes.
+ */
+ public void setFreezeViewVisibility(boolean freezeViewVisibility) {
+ if (mFreezeViewVisibility != freezeViewVisibility) {
+ mFreezeViewVisibility = freezeViewVisibility;
+
+ if (!mFreezeViewVisibility) {
+ setVisibility(mContentAlpha > 0 ? VISIBLE : GONE);
+ }
+ }
}
@Override
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 95c9681..339681c 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -124,6 +124,7 @@
private boolean mIsVerticalBarLayout = false;
private boolean mIsAdaptiveIcon = false;
+ private boolean mIsOpening;
private @Nullable Drawable mBadge;
private @Nullable Drawable mForeground;
@@ -178,8 +179,10 @@
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
- getViewTreeObserver().addOnGlobalLayoutListener(this);
- mLauncher.getRotationHelper().setCurrentTransitionRequest(REQUEST_LOCK);
+ if (!mIsOpening) {
+ getViewTreeObserver().addOnGlobalLayoutListener(this);
+ mLauncher.getRotationHelper().setCurrentTransitionRequest(REQUEST_LOCK);
+ }
}
@Override
@@ -326,7 +329,7 @@
* - For BubbleTextView, we return the icon bounds.
*/
private float getLocationBoundsForView(View v, RectF outRect) {
- boolean ignoreTransform = true;
+ boolean ignoreTransform = !mIsOpening;
if (v instanceof DeepShortcutView) {
v = ((DeepShortcutView) v).getBubbleText();
ignoreTransform = false;
@@ -627,6 +630,7 @@
view.recycle();
view.mIsVerticalBarLayout = launcher.getDeviceProfile().isVerticalBarLayout();
+ view.mIsOpening = isOpening;
view.mOriginalIcon = originalView;
view.mPositionOut = positionOut;