Merge "Revert "Revert "Enable CONTINUOUS_VIEW_TREE_CAPTURE FeatureFlag.""" into udc-dev
diff --git a/quickstep/res/values-sw720dp/dimens.xml b/quickstep/res/values-sw720dp/dimens.xml
index d27561a..f093185 100644
--- a/quickstep/res/values-sw720dp/dimens.xml
+++ b/quickstep/res/values-sw720dp/dimens.xml
@@ -41,4 +41,10 @@
     <!-- Transient taskbar -->
     <dimen name="transient_taskbar_size">76dp</dimen>
     <dimen name="transient_taskbar_icon_size">52dp</dimen>
+
+    <!-- Taskbar swipe up thresholds -->
+    <dimen name="taskbar_nav_threshold">30dp</dimen>
+    <dimen name="taskbar_app_window_threshold">100dp</dimen>
+    <dimen name="taskbar_home_overview_threshold">180dp</dimen>
+    <dimen name="taskbar_catch_up_threshold">300dp</dimen>
 </resources>
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 126ab7c..9e6ee8a 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -301,10 +301,10 @@
     <!-- An additional touch slop to prevent x-axis movement during the swipe up to show taskbar -->
     <dimen name="transient_taskbar_clamped_offset_bound">16dp</dimen>
     <!-- Taskbar swipe up thresholds -->
-    <dimen name="taskbar_nav_threshold">30dp</dimen>
-    <dimen name="taskbar_app_window_threshold">100dp</dimen>
-    <dimen name="taskbar_home_overview_threshold">180dp</dimen>
-    <dimen name="taskbar_catch_up_threshold">300dp</dimen>
+    <dimen name="taskbar_nav_threshold">40dp</dimen>
+    <dimen name="taskbar_app_window_threshold">88dp</dimen>
+    <dimen name="taskbar_home_overview_threshold">156dp</dimen>
+    <dimen name="taskbar_catch_up_threshold">264dp</dimen>
 
     <!--  Taskbar 3 button spacing  -->
     <dimen name="taskbar_button_space_inbetween">24dp</dimen>
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index e4681fd..93eb01c 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -795,7 +795,7 @@
 
                 if (initOnly) {
                     // For the init pass, we want full alpha since the window is not yet ready.
-                    floatingView.update(1f, 255, floatingIconBounds, percent, 0f,
+                    floatingView.update(1f, floatingIconBounds, percent, 0f,
                             mWindowRadius.value * scale, true /* isOpening */);
                     return;
                 }
@@ -823,7 +823,7 @@
                             matrix.postTranslate(windowTransX0, windowTransY0);
                         }
 
-                        floatingView.update(mIconAlpha.value, 255, floatingIconBounds, percent, 0f,
+                        floatingView.update(mIconAlpha.value, floatingIconBounds, percent, 0f,
                                 mWindowRadius.value * scale, true /* isOpening */);
                         builder.setMatrix(matrix)
                                 .setWindowCrop(crop)
@@ -1388,8 +1388,8 @@
                     windowTargetBounds, startWindowCornerRadius) {
                 @Override
                 public void onUpdate(RectF currentRectF, float progress) {
-                    finalFloatingIconView.update(1f, 255 /* fgAlpha */, currentRectF, progress,
-                            windowAlphaThreshold, getCornerRadius(progress), false);
+                    finalFloatingIconView.update(1f, currentRectF, progress, windowAlphaThreshold,
+                            getCornerRadius(progress), false);
 
                     super.onUpdate(currentRectF, progress);
                 }
diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
index 3151374..1dfad16 100644
--- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
+++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
@@ -139,8 +139,8 @@
             @Override
             public void update(RectF currentRect, float progress, float radius) {
                 super.update(currentRect, progress, radius);
-                floatingIconView.update(1f /* alpha */, 255 /* fgAlpha */, currentRect, progress,
-                        windowAlphaThreshold, radius, false);
+                floatingIconView.update(1f /* alpha */, currentRect, progress, windowAlphaThreshold,
+                        radius, false);
             }
         };
     }
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index d8f49ff..52b32d7 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -21,7 +21,6 @@
 import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
 
 import android.app.ActivityManager;
-import android.app.ActivityOptions;
 import android.app.PendingIntent;
 import android.app.PictureInPictureParams;
 import android.content.ComponentName;
@@ -39,8 +38,6 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.util.Log;
-import android.view.IRecentsAnimationController;
-import android.view.IRecentsAnimationRunner;
 import android.view.IRemoteAnimationRunner;
 import android.view.MotionEvent;
 import android.view.RemoteAnimationAdapter;
@@ -48,7 +45,6 @@
 import android.view.SurfaceControl;
 import android.window.IOnBackInvokedCallback;
 import android.window.RemoteTransition;
-import android.window.TaskSnapshot;
 import android.window.TransitionFilter;
 
 import androidx.annotation.Nullable;
@@ -59,9 +55,6 @@
 import com.android.launcher3.util.MainThreadInitializedObject;
 import com.android.launcher3.util.SplitConfigurationOptions;
 import com.android.systemui.shared.recents.ISystemUiProxy;
-import com.android.systemui.shared.recents.model.ThumbnailData;
-import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
-import com.android.systemui.shared.system.RecentsAnimationListener;
 import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController;
 import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController;
 import com.android.systemui.shared.system.smartspace.SmartspaceState;
@@ -142,20 +135,9 @@
     // TODO(141886704): Find a way to remove this
     private int mLastSystemUiStateFlags;
 
-    /**
-     * This is a singleton pending intent that is used to start recents via Shell (which is a
-     * different process). It is bare-bones, so it's expected that the component and options will
-     * be provided via fill-in intent.
-     */
-    private final PendingIntent mRecentsPendingIntent;
-
     public SystemUiProxy(Context context) {
         mContext = context;
         mAsyncHandler = new Handler(UI_HELPER_EXECUTOR.getLooper(), this::handleMessageAsync);
-        final Intent baseIntent = new Intent().setPackage(mContext.getPackageName());
-        mRecentsPendingIntent = PendingIntent.getActivity(mContext, 0, baseIntent,
-                PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT
-                        | Intent.FILL_IN_COMPONENT);
     }
 
     @Override
@@ -1097,41 +1079,4 @@
             Log.e(TAG, "Failed call setUnfoldAnimationListener", e);
         }
     }
-
-
-    /**
-     * Starts the recents activity. The caller should manage the thread on which this is called.
-     */
-    public boolean startRecentsActivity(Intent intent, ActivityOptions options,
-            RecentsAnimationListener listener) {
-        final IRecentsAnimationRunner runner = new IRecentsAnimationRunner.Stub() {
-            @Override
-            public void onAnimationStart(IRecentsAnimationController controller,
-                    RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers,
-                    Rect homeContentInsets, Rect minimizedHomeBounds) {
-                listener.onAnimationStart(new RecentsAnimationControllerCompat(controller), apps,
-                        wallpapers, homeContentInsets, minimizedHomeBounds);
-            }
-
-            @Override
-            public void onAnimationCanceled(int[] taskIds, TaskSnapshot[] taskSnapshots) {
-                listener.onAnimationCanceled(
-                        ThumbnailData.wrap(taskIds, taskSnapshots));
-            }
-
-            @Override
-            public void onTasksAppeared(RemoteAnimationTarget[] apps) {
-                listener.onTasksAppeared(apps);
-            }
-        };
-        final Bundle optsBundle = options.toBundle();
-        try {
-            mRecentTasks.startRecentsTransition(mRecentsPendingIntent, intent, optsBundle,
-                    mContext.getIApplicationThread(), runner);
-        } catch (RemoteException e) {
-            Log.e(TAG, "Error starting recents via shell", e);
-            return false;
-        }
-        return true;
-    }
 }
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 5010ea5..2c95516 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -22,6 +22,7 @@
 import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_INITIALIZED;
 import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_STARTED;
 import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.START_RECENTS_ANIMATION;
+import static com.android.systemui.shared.system.RemoteTransitionCompat.newRemoteTransition;
 
 import android.app.ActivityManager;
 import android.app.ActivityOptions;
@@ -30,6 +31,7 @@
 import android.os.SystemProperties;
 import android.util.Log;
 import android.view.RemoteAnimationTarget;
+import android.window.RemoteTransition;
 
 import androidx.annotation.Nullable;
 import androidx.annotation.UiThread;
@@ -228,7 +230,9 @@
         mCallbacks.addListener(listener);
 
         if (ENABLE_SHELL_TRANSITIONS) {
-            final ActivityOptions options = ActivityOptions.makeBasic();
+            RemoteTransition transition = newRemoteTransition(mCallbacks,
+                    mCtx.getIApplicationThread());
+            final ActivityOptions options = ActivityOptions.makeRemoteTransition(transition);
             // Allowing to pause Home if Home is top activity and Recents is not Home. So when user
             // start home when recents animation is playing, the home activity can be resumed again
             // to let the transition controller collect Home activity.
@@ -244,7 +248,7 @@
                 options.setTransientLaunch();
             }
             options.setSourceInfo(ActivityOptions.SourceInfo.TYPE_RECENTS_ANIMATION, eventTime);
-            SystemUiProxy.INSTANCE.getNoCreate().startRecentsActivity(intent, options, mCallbacks);
+            UI_HELPER_EXECUTOR.execute(() -> mCtx.startActivity(intent, options.toBundle()));
         } else {
             UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
                     .startRecentsActivity(intent, eventTime, mCallbacks, null, null));
diff --git a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
index de93818..b3243ff 100644
--- a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
@@ -354,7 +354,7 @@
                     mFakeIconView.setVisibility(View.VISIBLE);
                     mFakeIconView.update(rect, progress,
                             1f - SHAPE_PROGRESS_DURATION /* shapeProgressStart */,
-                            radius, 255,
+                            radius,
                             false, /* isOpening */
                             mFakeIconView, mDp);
                     mFakeIconView.setAlpha(1);
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 21f614f..e62cff5 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -389,14 +389,6 @@
     <dimen name="taskbar_button_space_inbetween_phone">0dp</dimen>
     <dimen name="taskbar_button_margin_split">0dp</dimen>
     <dimen name="taskbar_button_margin_6_5">0dp</dimen>
-    <!-- Taskbar swipe up thresholds threshold -->
-    <dimen name="taskbar_nav_threshold">0dp</dimen>
-    <dimen name="taskbar_app_window_threshold">0dp</dimen>
-    <dimen name="taskbar_home_overview_threshold">0dp</dimen>
-    <dimen name="taskbar_catch_up_threshold">0dp</dimen>
-    <dimen name="taskbar_nav_threshold_v2">0dp</dimen>
-    <dimen name="taskbar_app_window_threshold_v2">0dp</dimen>
-    <dimen name="taskbar_home_overview_threshold_v2">0dp</dimen>
 
     <!-- Size of the maximum radius for the enforced rounded rectangles. -->
     <dimen name="enforced_rounded_corner_max_radius">16dp</dimen>
diff --git a/src/com/android/launcher3/views/ClipIconView.java b/src/com/android/launcher3/views/ClipIconView.java
index d1f90e9..694dead 100644
--- a/src/com/android/launcher3/views/ClipIconView.java
+++ b/src/com/android/launcher3/views/ClipIconView.java
@@ -43,9 +43,6 @@
 import android.view.ViewOutlineProvider;
 
 import androidx.annotation.Nullable;
-import androidx.dynamicanimation.animation.FloatPropertyCompat;
-import androidx.dynamicanimation.animation.SpringAnimation;
-import androidx.dynamicanimation.animation.SpringForce;
 
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.R;
@@ -63,39 +60,6 @@
 
     private static final Rect sTmpRect = new Rect();
 
-    // We spring the foreground drawable relative to the icon's movement in the DragLayer.
-    // We then use these two factor values to scale the movement of the fg within this view.
-    private static final int FG_TRANS_X_FACTOR = 60;
-    private static final int FG_TRANS_Y_FACTOR = 75;
-
-    private static final FloatPropertyCompat<ClipIconView> mFgTransYProperty =
-            new FloatPropertyCompat<ClipIconView>("ClipIconViewFgTransY") {
-                @Override
-                public float getValue(ClipIconView view) {
-                    return view.mFgTransY;
-                }
-
-                @Override
-                public void setValue(ClipIconView view, float transY) {
-                    view.mFgTransY = transY;
-                    view.invalidate();
-                }
-            };
-
-    private static final FloatPropertyCompat<ClipIconView> mFgTransXProperty =
-            new FloatPropertyCompat<ClipIconView>("ClipIconViewFgTransX") {
-                @Override
-                public float getValue(ClipIconView view) {
-                    return view.mFgTransX;
-                }
-
-                @Override
-                public void setValue(ClipIconView view, float transX) {
-                    view.mFgTransX = transX;
-                    view.invalidate();
-                }
-            };
-
     private final int mBlurSizeOutline;
     private final boolean mIsRtl;
 
@@ -114,11 +78,6 @@
     private final Rect mOutline = new Rect();
     private final Rect mFinalDrawableBounds = new Rect();
 
-    private final SpringAnimation mFgSpringY;
-    private float mFgTransY;
-    private final SpringAnimation mFgSpringX;
-    private float mFgTransX;
-
     public ClipIconView(Context context) {
         this(context, null);
     }
@@ -132,22 +91,13 @@
         mBlurSizeOutline = getResources().getDimensionPixelSize(
                 R.dimen.blur_size_medium_outline);
         mIsRtl = Utilities.isRtl(getResources());
-
-        mFgSpringX = new SpringAnimation(this, mFgTransXProperty)
-                .setSpring(new SpringForce()
-                        .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)
-                        .setStiffness(SpringForce.STIFFNESS_LOW));
-        mFgSpringY = new SpringAnimation(this, mFgTransYProperty)
-                .setSpring(new SpringForce()
-                        .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)
-                        .setStiffness(SpringForce.STIFFNESS_LOW));
     }
 
     /**
      * Update the icon UI to match the provided parameters during an animation frame
      */
     public void update(RectF rect, float progress, float shapeProgressStart, float cornerRadius,
-            int fgIconAlpha, boolean isOpening, View container, DeviceProfile dp) {
+            boolean isOpening, View container, DeviceProfile dp) {
         MarginLayoutParams lp = (MarginLayoutParams) container.getLayoutParams();
 
         float dX = mIsRtl
@@ -167,8 +117,7 @@
             return;
         }
 
-        update(rect, progress, shapeProgressStart, cornerRadius, fgIconAlpha, isOpening, scale,
-                minSize, lp, dp);
+        update(rect, progress, shapeProgressStart, cornerRadius, isOpening, scale, minSize, dp);
 
         container.setPivotX(0);
         container.setPivotY(0);
@@ -179,13 +128,7 @@
     }
 
     private void update(RectF rect, float progress, float shapeProgressStart, float cornerRadius,
-            int fgIconAlpha, boolean isOpening, float scale, float minSize,
-            MarginLayoutParams parentLp, DeviceProfile dp) {
-        float dX = mIsRtl
-                ? rect.left - (dp.widthPx - parentLp.getMarginStart() - parentLp.width)
-                : rect.left - parentLp.getMarginStart();
-        float dY = rect.top - parentLp.topMargin;
-
+            boolean isOpening, float scale, float minSize, DeviceProfile dp) {
         // shapeRevealProgress = 1 when progress = shapeProgressStart + SHAPE_PROGRESS_DURATION
         float toMax = isOpening ? 1 / SHAPE_PROGRESS_DURATION : 1f;
 
@@ -220,27 +163,17 @@
             float drawableScale = (dp.isLandscape ? mOutline.width() : mOutline.height())
                     / minSize;
             setBackgroundDrawableBounds(drawableScale, dp.isLandscape);
-            if (isOpening) {
-                // Center align foreground
-                int height = mFinalDrawableBounds.height();
-                int width = mFinalDrawableBounds.width();
-                int diffY = dp.isLandscape ? 0
-                        : (int) (((height * drawableScale) - height) / 2);
-                int diffX = dp.isLandscape ? (int) (((width * drawableScale) - width) / 2)
-                        : 0;
-                sTmpRect.set(mFinalDrawableBounds);
-                sTmpRect.offset(diffX, diffY);
-                mForeground.setBounds(sTmpRect);
-            } else {
-                mForeground.setAlpha(fgIconAlpha);
 
-                // Spring the foreground relative to the icon's movement within the DragLayer.
-                int diffX = (int) (dX / dp.availableWidthPx * FG_TRANS_X_FACTOR);
-                int diffY = (int) (dY / dp.availableHeightPx * FG_TRANS_Y_FACTOR);
-
-                mFgSpringX.animateToFinalPosition(diffX);
-                mFgSpringY.animateToFinalPosition(diffY);
-            }
+            // Center align foreground
+            int height = mFinalDrawableBounds.height();
+            int width = mFinalDrawableBounds.width();
+            int diffY = dp.isLandscape ? 0
+                    : (int) (((height * drawableScale) - height) / 2);
+            int diffX = dp.isLandscape ? (int) (((width * drawableScale) - width) / 2)
+                    : 0;
+            sTmpRect.set(mFinalDrawableBounds);
+            sTmpRect.offset(diffX, diffY);
+            mForeground.setBounds(sTmpRect);
         }
         invalidate();
         invalidateOutline();
@@ -359,10 +292,7 @@
             mBackground.draw(canvas);
         }
         if (mForeground != null) {
-            int count2 = canvas.save();
-            canvas.translate(mFgTransX, mFgTransY);
             mForeground.draw(canvas);
-            canvas.restoreToCount(count2);
         }
         canvas.restoreToCount(count);
     }
@@ -380,9 +310,5 @@
         mRevealAnimator = null;
         mTaskCornerRadius = 0;
         mOutline.setEmpty();
-        mFgTransY = 0;
-        mFgSpringX.cancel();
-        mFgTransX = 0;
-        mFgSpringY.cancel();
     }
 }
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index e233e46..172b405 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -146,17 +146,16 @@
     /**
      * Positions this view to match the size and location of {@param rect}.
      * @param alpha The alpha[0, 1] of the entire floating view.
-     * @param fgIconAlpha The alpha[0-255] of the foreground layer of the icon (if applicable).
      * @param progress A value from [0, 1] that represents the animation progress.
      * @param shapeProgressStart The progress value at which to start the shape reveal.
      * @param cornerRadius The corner radius of {@param rect}.
      * @param isOpening True if view is used for app open animation, false for app close animation.
      */
-    public void update(float alpha, int fgIconAlpha, RectF rect, float progress,
-            float shapeProgressStart, float cornerRadius, boolean isOpening) {
+    public void update(float alpha, RectF rect, float progress, float shapeProgressStart,
+            float cornerRadius, boolean isOpening) {
         setAlpha(alpha);
-        mClipIconView.update(rect, progress, shapeProgressStart, cornerRadius, fgIconAlpha,
-                isOpening, this, mLauncher.getDeviceProfile());
+        mClipIconView.update(rect, progress, shapeProgressStart, cornerRadius, isOpening, this,
+                mLauncher.getDeviceProfile());
     }
 
     @Override