Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index fb9765c..caf52e3 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -26,10 +26,13 @@
 
 import android.animation.AnimatorSet;
 import android.animation.ValueAnimator;
+import android.app.ActivityOptions;
 import android.content.Intent;
 import android.content.IntentSender;
+import android.os.Binder;
 import android.os.Bundle;
 import android.os.CancellationSignal;
+import android.os.IBinder;
 import android.view.View;
 
 import androidx.annotation.Nullable;
@@ -37,6 +40,8 @@
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.dragndrop.DragOptions;
 import com.android.launcher3.model.WellbeingModel;
+import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
 import com.android.launcher3.popup.SystemShortcut;
 import com.android.launcher3.proxy.ProxyActivityStarter;
 import com.android.launcher3.proxy.StartActivityParams;
@@ -50,6 +55,7 @@
 import com.android.launcher3.uioverrides.RecentsViewStateController;
 import com.android.launcher3.util.ActivityOptionsWrapper;
 import com.android.launcher3.util.DisplayController;
+import com.android.launcher3.util.ObjectWrapper;
 import com.android.launcher3.util.UiThreadHelper;
 import com.android.quickstep.RecentsModel;
 import com.android.quickstep.SysUINavigationMode;
@@ -67,6 +73,7 @@
 import com.android.systemui.shared.system.ActivityOptionsCompat;
 import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Stream;
 
@@ -418,18 +425,38 @@
     }
 
     @Override
-    public ActivityOptionsWrapper getActivityLaunchOptions(View v) {
+    public ActivityOptionsWrapper getActivityLaunchOptions(View v, @Nullable ItemInfo item) {
         ActivityOptionsWrapper activityOptions =
                 mAppTransitionManager.hasControlRemoteAppTransitionPermission()
                         ? mAppTransitionManager.getActivityLaunchOptions(this, v)
-                        : super.getActivityLaunchOptions(v);
+                        : super.getActivityLaunchOptions(v, item);
         if (mLastTouchUpTime > 0) {
             ActivityOptionsCompat.setLauncherSourceInfo(
                     activityOptions.options, mLastTouchUpTime);
         }
+        addLaunchCookie(item, activityOptions.options);
         return activityOptions;
     }
 
+    /**
+     * Adds a new launch cookie for the activity launch of the given {@param info} if supported.
+     */
+    public void addLaunchCookie(ItemInfo info, ActivityOptions opts) {
+        if (info == null) {
+            return;
+        }
+        switch (info.itemType) {
+            case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
+            case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
+            case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT:
+                // Fall through and continue if it's an app or shortcut
+                break;
+            default:
+                return;
+        }
+        opts.setLaunchCookie(ObjectWrapper.wrap(new Integer(info.id)));
+    }
+
     public void setHintUserWillBeActive() {
         addActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE);
     }
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index 009ca27..827eb7d 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -693,7 +693,7 @@
                             matrix.postTranslate(windowTransX0, windowTransY0);
                         }
 
-                        floatingView.update(floatingIconBounds, mIconAlpha.value, percent, 0f,
+                        floatingView.update(mIconAlpha.value, 255, floatingIconBounds, percent, 0f,
                                 mWindowRadius.value * scale, true /* isOpening */);
                         builder.withMatrix(matrix)
                                 .withWindowCrop(crop)
diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index 9097c8b..0652d48 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -113,7 +113,7 @@
                         ANIM_OVERVIEW_ACTIONS_FADE, LINEAR));
 
         float splitPlaceholderAlpha = state.areElementsVisible(mLauncher, SPLIT_PLACHOLDER_VIEW) ?
-                0.7f : 0;
+                0.85f : 0;
         propertySetter.setFloat(mRecentsView.getSplitPlaceholder(), ALPHA_FLOAT,
                 splitPlaceholderAlpha, LINEAR);
     }
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index dbb8272..53f1fd0 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -66,11 +66,13 @@
 import android.graphics.Rect;
 import android.os.Build;
 import android.os.Handler;
+import android.os.IBinder;
 import android.os.SystemClock;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.View.OnApplyWindowInsetsListener;
 import android.view.ViewTreeObserver.OnDrawListener;
+import android.view.ViewTreeObserver.OnScrollChangedListener;
 import android.view.WindowInsets;
 import android.view.animation.Interpolator;
 import android.widget.Toast;
@@ -139,6 +141,8 @@
     private final Handler mHandler = new Handler();
     // Callbacks to be made once the recents animation starts
     private final ArrayList<Runnable> mRecentsAnimationStartCallbacks = new ArrayList<>();
+    private final OnScrollChangedListener mOnRecentsScrollListener = this::onRecentsViewScroll;
+
     protected RecentsAnimationController mRecentsAnimationController;
     protected RecentsAnimationTargets mRecentsAnimationTargets;
     protected T mActivity;
@@ -1043,7 +1047,8 @@
                 interpolator, target, velocityPxPerMs));
     }
 
-    protected abstract HomeAnimationFactory createHomeAnimationFactory(long duration);
+    protected abstract HomeAnimationFactory createHomeAnimationFactory(
+            ArrayList<IBinder> launchCookies, long duration);
 
     private final TaskStackChangeListener mActivityRestartListener = new TaskStackChangeListener() {
         @Override
@@ -1084,7 +1089,8 @@
             final RemoteAnimationTargetCompat runningTaskTarget = mRecentsAnimationTargets != null
                     ? mRecentsAnimationTargets.findTask(mGestureState.getRunningTaskId())
                     : null;
-            HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(duration);
+            HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(
+                    runningTaskTarget.taskInfo.launchCookies, duration);
             mIsSwipingPipToHome = homeAnimFactory.supportSwipePipToHome()
                     && runningTaskTarget != null
                     && runningTaskTarget.taskInfo.pictureInPictureParams != null
@@ -1252,7 +1258,7 @@
             HomeAnimationFactory homeAnimationFactory) {
         RectFSpringAnim anim =
                 super.createWindowAnimationToHome(startProgress, homeAnimationFactory);
-        anim.addOnUpdateListener((r, p) -> {
+        anim.addOnUpdateListener((v, r, p) -> {
             updateSysUiFlags(Math.max(p, mCurrentShift.value));
         });
         anim.addAnimatorListener(new AnimationSuccessListener() {
@@ -1368,6 +1374,7 @@
     private void invalidateHandlerWithLauncher() {
         endLauncherTransitionController();
 
+        mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener);
         mRecentsView.onGestureAnimationEnd();
         resetLauncherListeners();
     }
@@ -1395,7 +1402,9 @@
         mActivityInterface.onTransitionCancelled(wasVisible);
 
         // Leave the pending invisible flag, as it may be used by wallpaper open animation.
-        mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
+        if (mActivity != null) {
+            mActivity.clearForceInvisibleFlag(INVISIBLE_BY_STATE_HANDLER);
+        }
     }
 
     protected void switchToScreenshot() {
@@ -1503,9 +1512,8 @@
             SystemUiProxy.INSTANCE.get(mContext).stopSwipePipToHome(
                     mSwipePipToHomeAnimator.getComponentName(),
                     mSwipePipToHomeAnimator.getDestinationBounds());
-            mRecentsAnimationController.setFinishTaskBounds(
+            mRecentsAnimationController.setFinishTaskTransaction(
                     mSwipePipToHomeAnimator.getTaskId(),
-                    mSwipePipToHomeAnimator.getDestinationBounds(),
                     mSwipePipToHomeAnimator.getFinishTransaction());
             mIsSwipingPipToHome = false;
         }
@@ -1560,17 +1568,19 @@
                     mRecentsAnimationTargets.addReleaseCheck(applier));
         });
 
-        mRecentsView.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
-            if (moveWindowWithRecentsScroll()) {
-                updateFinalShift();
-            }
-        });
+        mRecentsView.addOnScrollChangedListener(mOnRecentsScrollListener);
         runOnRecentsAnimationStart(() ->
                 mRecentsView.setRecentsAnimationTargets(mRecentsAnimationController,
                         mRecentsAnimationTargets));
         mRecentsViewScrollLinked = true;
     }
 
+    private void onRecentsViewScroll() {
+        if (moveWindowWithRecentsScroll()) {
+            updateFinalShift();
+        }
+    }
+
     protected void startNewTask(Consumer<Boolean> resultCallback) {
         // Launch the task user scrolled to (mRecentsView.getNextPage()).
         if (!mCanceled) {
diff --git a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
index ec1cc4a..9846ee7 100644
--- a/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/FallbackSwipeHandler.java
@@ -38,6 +38,7 @@
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
 import android.os.Messenger;
@@ -48,6 +49,7 @@
 import android.view.SurfaceControl.Transaction;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.Utilities;
@@ -56,6 +58,7 @@
 import com.android.launcher3.anim.SpringAnimationBuilder;
 import com.android.quickstep.fallback.FallbackRecentsView;
 import com.android.quickstep.fallback.RecentsState;
+import com.android.quickstep.util.AppCloseConfig;
 import com.android.quickstep.util.RectFSpringAnim;
 import com.android.quickstep.util.TransformParams;
 import com.android.quickstep.util.TransformParams.BuilderProxy;
@@ -66,6 +69,7 @@
 import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
 
 import java.lang.ref.WeakReference;
+import java.util.ArrayList;
 import java.util.UUID;
 import java.util.function.Consumer;
 
@@ -124,7 +128,8 @@
     }
 
     @Override
-    protected HomeAnimationFactory createHomeAnimationFactory(long duration) {
+    protected HomeAnimationFactory createHomeAnimationFactory(ArrayList<IBinder> launchCookies,
+            long duration) {
         mActiveAnimationFactory = new FallbackHomeAnimationFactory(duration);
         ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0);
         Intent intent = new Intent(mGestureState.getHomeIntent());
@@ -298,7 +303,8 @@
         }
 
         @Override
-        public void update(RectF currentRect, float progress, float radius) {
+        public void update(@Nullable AppCloseConfig config, RectF currentRect, float progress,
+                 float radius) {
             if (mSurfaceControl != null) {
                 currentRect.roundOut(mTempRect);
                 Transaction t = new Transaction();
diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
index 311ac83..dd35d68 100644
--- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
+++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
@@ -15,28 +15,51 @@
  */
 package com.android.quickstep;
 
+import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
+import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
 import static com.android.launcher3.LauncherState.NORMAL;
+import static com.android.launcher3.Utilities.dpToPx;
+import static com.android.launcher3.Utilities.mapToRange;
+import static com.android.launcher3.anim.Interpolators.LINEAR;
+import static com.android.launcher3.config.FeatureFlags.PROTOTYPE_APP_CLOSE;
 import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
+import static com.android.launcher3.views.FloatingIconView.getFloatingIconView;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
 import android.animation.AnimatorSet;
+import android.animation.ValueAnimator;
 import android.content.Context;
 import android.graphics.RectF;
+import android.os.IBinder;
 import android.os.UserHandle;
 import android.view.View;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 
 import com.android.launcher3.BaseQuickstepLauncher;
+import com.android.launcher3.Hotseat;
 import com.android.launcher3.LauncherState;
+import com.android.launcher3.R;
+import com.android.launcher3.Workspace;
 import com.android.launcher3.anim.AnimatorPlaybackController;
+import com.android.launcher3.anim.SpringAnimationBuilder;
+import com.android.launcher3.dragndrop.DragLayer;
 import com.android.launcher3.states.StateAnimationConfig;
+import com.android.launcher3.util.DynamicResource;
+import com.android.launcher3.util.ObjectWrapper;
 import com.android.launcher3.views.FloatingIconView;
+import com.android.quickstep.util.AppCloseConfig;
 import com.android.quickstep.util.RectFSpringAnim;
 import com.android.quickstep.util.StaggeredWorkspaceAnim;
 import com.android.quickstep.views.RecentsView;
 import com.android.quickstep.views.TaskView;
+import com.android.systemui.plugins.ResourceProvider;
 import com.android.systemui.shared.system.InputConsumerController;
 
+import java.util.ArrayList;
+
 /**
  * Temporary class to allow easier refactoring
  */
@@ -52,38 +75,47 @@
 
 
     @Override
-    protected HomeAnimationFactory createHomeAnimationFactory(long duration) {
+    protected HomeAnimationFactory createHomeAnimationFactory(ArrayList<IBinder> launchCookies,
+            long duration) {
         HomeAnimationFactory homeAnimFactory;
         if (mActivity != null) {
-            final TaskView runningTaskView = mRecentsView.getRunningTaskView();
-            final View workspaceView;
-            if (runningTaskView != null
-                    && !mIsSwipingPipToHome
-                    && runningTaskView.getTask().key.getComponent() != null) {
-                workspaceView = mActivity.getWorkspace().getFirstMatchForAppClose(
-                        runningTaskView.getTask().key.getComponent().getPackageName(),
-                        UserHandle.of(runningTaskView.getTask().key.userId));
-            } else {
-                workspaceView = null;
-            }
-            final RectF iconLocation = new RectF();
+            final View workspaceView = findWorkspaceView(launchCookies,
+                    mRecentsView.getRunningTaskView());
             boolean canUseWorkspaceView =
                     workspaceView != null && workspaceView.isAttachedToWindow();
-            FloatingIconView floatingIconView = canUseWorkspaceView
-                    ? FloatingIconView.getFloatingIconView(mActivity, workspaceView,
-                    true /* hideOriginal */, iconLocation, false /* isOpening */)
-                    : null;
 
             mActivity.getRootView().setForceHideBackArrow(true);
             mActivity.setHintUserWillBeActive();
 
             if (canUseWorkspaceView) {
+                final ResourceProvider rp = DynamicResource.provider(mActivity);
+                final float transY = dpToPx(rp.getFloat(R.dimen.swipe_up_trans_y_dp));
+                float dpPerSecond = dpToPx(rp.getFloat(R.dimen.swipe_up_trans_y_dp_per_s));
+                final float launcherAlphaMax =
+                        rp.getFloat(R.dimen.swipe_up_launcher_alpha_max_progress);
+
+                RectF iconLocation = new RectF();
+                FloatingIconView floatingIconView = getFloatingIconView(mActivity, workspaceView,
+                        true /* hideOriginal */, iconLocation, false /* isOpening */);
+
                 // We want the window alpha to be 0 once this threshold is met, so that the
                 // FolderIconView can be seen morphing into the icon shape.
                 float windowAlphaThreshold = 1f - SHAPE_PROGRESS_DURATION;
                 homeAnimFactory = new LauncherHomeAnimationFactory() {
+
+                    // There is a delay in loading the icon, so we need to keep the window
+                    // opaque until it is ready.
+                    private boolean mIsFloatingIconReady = false;
+
+                    private @Nullable ValueAnimator mBounceBackAnimator;
+
                     @Override
                     public RectF getWindowTargetRect() {
+                        if (PROTOTYPE_APP_CLOSE.get()) {
+                            // We want the target rect to be at this offset position, so that all
+                            // launcher content can spring back upwards.
+                            floatingIconView.setPositionOffsetY(transY);
+                        }
                         return iconLocation;
                     }
 
@@ -92,17 +124,92 @@
                         anim.addAnimatorListener(floatingIconView);
                         floatingIconView.setOnTargetChangeListener(anim::onTargetPositionChanged);
                         floatingIconView.setFastFinishRunnable(anim::end);
+                        if (PROTOTYPE_APP_CLOSE.get()) {
+                            mBounceBackAnimator = bounceBackToRestingPosition();
+                            // Use a spring to put drag layer translation back to 0.
+                            anim.addAnimatorListener(new AnimatorListenerAdapter() {
+                                @Override
+                                public void onAnimationEnd(Animator animation) {
+                                    floatingIconView.setPositionOffsetY(0);
+                                    mBounceBackAnimator.start();
+                                }
+                            });
+
+                            Workspace workspace = mActivity.getWorkspace();
+                            workspace.setPivotToScaleWithSelf(mActivity.getHotseat());
+                        }
+                    }
+
+                    private ValueAnimator bounceBackToRestingPosition() {
+                        DragLayer dl = mActivity.getDragLayer();
+                        Workspace workspace = mActivity.getWorkspace();
+                        Hotseat hotseat = mActivity.getHotseat();
+
+                        final float startValue = transY;
+                        final float endValue = 0;
+                        // Ensures the velocity is always aligned with the direction.
+                        float pixelPerSecond = Math.abs(dpPerSecond)
+                                * Math.signum(endValue - transY);
+
+                        ValueAnimator springTransY = new SpringAnimationBuilder(dl.getContext())
+                                .setStiffness(rp.getFloat(R.dimen.swipe_up_trans_y_stiffness))
+                                .setDampingRatio(rp.getFloat(R.dimen.swipe_up_trans_y_damping))
+                                .setMinimumVisibleChange(1f)
+                                .setStartValue(startValue)
+                                .setEndValue(endValue)
+                                .setStartVelocity(pixelPerSecond)
+                                .build(dl, VIEW_TRANSLATE_Y);
+                        springTransY.addListener(new AnimatorListenerAdapter() {
+                            @Override
+                            public void onAnimationEnd(Animator animation) {
+                                dl.setTranslationY(0f);
+                                dl.setAlpha(1f);
+                                SCALE_PROPERTY.set(workspace, 1f);
+                                SCALE_PROPERTY.set(hotseat, 1f);
+                            }
+                        });
+                        return springTransY;
                     }
 
                     @Override
-                    public void update(RectF currentRect, float progress, float radius) {
-                        floatingIconView.update(currentRect, 1f, progress, windowAlphaThreshold,
-                                radius, false);
+                    public boolean keepWindowOpaque() {
+                        if (mIsFloatingIconReady || floatingIconView.isVisibleToUser()) {
+                            mIsFloatingIconReady = true;
+                            return false;
+                        }
+                        return true;
+                    }
+
+                    @Override
+                    public void update(@Nullable AppCloseConfig config, RectF currentRect,
+                            float progress, float radius) {
+                        int fgAlpha = 255;
+                        if (config != null && PROTOTYPE_APP_CLOSE.get()) {
+                            DragLayer dl = mActivity.getDragLayer();
+                            float translationY = config.getWorkspaceTransY();
+                            dl.setTranslationY(translationY);
+
+                            float alpha = mapToRange(progress, 0, launcherAlphaMax, 0, 1f, LINEAR);
+                            dl.setAlpha(Math.min(alpha, 1f));
+
+                            float scale = Math.min(1f, config.getWorkspaceScale());
+                            SCALE_PROPERTY.set(mActivity.getWorkspace(), scale);
+                            SCALE_PROPERTY.set(mActivity.getHotseat(), scale);
+                            SCALE_PROPERTY.set(mActivity.getAppsView(), scale);
+
+                            progress = config.getInterpolatedProgress();
+                            fgAlpha = config.getFgAlpha();
+                        }
+                        floatingIconView.update(1f, fgAlpha, currentRect, progress,
+                                windowAlphaThreshold, radius, false);
                     }
 
                     @Override
                     public void onCancel() {
                         floatingIconView.fastFinish();
+                        if (mBounceBackAnimator != null) {
+                            mBounceBackAnimator.cancel();
+                        }
                     }
                 };
             } else {
@@ -121,6 +228,37 @@
         return homeAnimFactory;
     }
 
+    /**
+     * Returns the associated view on the workspace matching one of the launch cookies, or the app
+     * associated with the running task.
+     */
+    @Nullable
+    private View findWorkspaceView(ArrayList<IBinder> launchCookies, TaskView runningTaskView) {
+        if (mIsSwipingPipToHome) {
+            // Disable if swiping to PIP
+            return null;
+        }
+        if (runningTaskView == null || runningTaskView.getTask() == null
+                || runningTaskView.getTask().key.getComponent() == null) {
+            // Disable if it's an invalid task
+            return null;
+        }
+
+        // Find the associated item info for the launch cookie (if available)
+        int launchCookieItemId = -1;
+        for (IBinder cookie : launchCookies) {
+            Integer itemId = ObjectWrapper.unwrap(cookie);
+            if (itemId != null) {
+                launchCookieItemId = itemId;
+                break;
+            }
+        }
+
+        return mActivity.getWorkspace().getFirstMatchForAppClose(launchCookieItemId,
+                runningTaskView.getTask().key.getComponent().getPackageName(),
+                UserHandle.of(runningTaskView.getTask().key.userId));
+    }
+
     @Override
     protected void finishRecentsControllerToHome(Runnable callback) {
         mRecentsAnimationController.finish(
diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java
index 7c453e7..ec224ed 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -37,6 +37,8 @@
 import android.os.Looper;
 import android.view.View;
 
+import androidx.annotation.Nullable;
+
 import com.android.launcher3.AbstractFloatingView;
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.InvariantDeviceProfile;
@@ -48,6 +50,7 @@
 import com.android.launcher3.anim.Interpolators;
 import com.android.launcher3.anim.PendingAnimation;
 import com.android.launcher3.compat.AccessibilityManagerCompat;
+import com.android.launcher3.model.data.ItemInfo;
 import com.android.launcher3.statemanager.StateManager;
 import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory;
 import com.android.launcher3.statemanager.StateManager.StateHandler;
@@ -177,9 +180,9 @@
     }
 
     @Override
-    public ActivityOptionsWrapper getActivityLaunchOptions(final View v) {
+    public ActivityOptionsWrapper getActivityLaunchOptions(final View v, @Nullable ItemInfo item) {
         if (!(v instanceof TaskView)) {
-            return super.getActivityLaunchOptions(v);
+            return super.getActivityLaunchOptions(v, item);
         }
 
         final TaskView taskView = (TaskView) v;
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationController.java b/quickstep/src/com/android/quickstep/RecentsAnimationController.java
index 82e8a93..4560735 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationController.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationController.java
@@ -19,7 +19,6 @@
 import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
 import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
 
-import android.graphics.Rect;
 import android.window.PictureInPictureSurfaceTransaction;
 
 import androidx.annotation.NonNull;
@@ -145,18 +144,16 @@
     }
 
     /**
-     * Sets the final bounds on a Task. This is used by Launcher to notify the system that
-     * animating Activity to PiP has completed and the associated task surface should be updated
-     * accordingly. This should be called before `finish`
+     * Sets the final surface transaction on a Task. This is used by Launcher to notify the system
+     * that animating Activity to PiP has completed and the associated task surface should be
+     * updated accordingly. This should be called before `finish`
      * @param taskId for which the leash should be updated
-     * @param destinationBounds bounds of the final PiP window
      * @param finishTransaction leash operations for the final transform.
      */
-    public void setFinishTaskBounds(int taskId, Rect destinationBounds,
+    public void setFinishTaskTransaction(int taskId,
             PictureInPictureSurfaceTransaction finishTransaction) {
         UI_HELPER_EXECUTOR.execute(
-                () -> mController.setFinishTaskBounds(taskId, destinationBounds,
-                        finishTransaction));
+                () -> mController.setFinishTaskTransaction(taskId, finishTransaction));
     }
 
     /**
diff --git a/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java b/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java
index a8c09dc..0f34a72 100644
--- a/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java
+++ b/quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java
@@ -17,6 +17,7 @@
 
 import static com.android.launcher3.anim.Interpolators.ACCEL_1_5;
 import static com.android.launcher3.anim.Interpolators.LINEAR;
+import static com.android.launcher3.config.FeatureFlags.PROTOTYPE_APP_CLOSE;
 
 import android.animation.Animator;
 import android.content.Context;
@@ -26,6 +27,7 @@
 import android.graphics.RectF;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 import androidx.annotation.UiThread;
 
 import com.android.launcher3.DeviceProfile;
@@ -35,7 +37,9 @@
 import com.android.launcher3.anim.PendingAnimation;
 import com.android.launcher3.touch.PagedOrientationHandler;
 import com.android.quickstep.util.AnimatorControllerWithResistance;
+import com.android.quickstep.util.AppCloseConfig;
 import com.android.quickstep.util.RectFSpringAnim;
+import com.android.quickstep.util.RectFSpringAnim2;
 import com.android.quickstep.util.TaskViewSimulator;
 import com.android.quickstep.util.TransformParams;
 import com.android.quickstep.util.TransformParams.BuilderProxy;
@@ -149,7 +153,10 @@
 
         public void setAnimation(RectFSpringAnim anim) { }
 
-        public void update(RectF currentRect, float progress, float radius) { }
+        public boolean keepWindowOpaque() { return false; }
+
+        public void update(@Nullable AppCloseConfig config, RectF currentRect, float progress,
+                float radius) { }
 
         public void onCancel() { }
 
@@ -199,7 +206,14 @@
         homeToWindowPositionMap.invert(windowToHomePositionMap);
         windowToHomePositionMap.mapRect(startRect);
 
-        RectFSpringAnim anim = new RectFSpringAnim(startRect, targetRect, mContext);
+        RectFSpringAnim anim;
+        if (PROTOTYPE_APP_CLOSE.get()) {
+            anim = new RectFSpringAnim2(startRect, targetRect, mContext,
+                    mTaskViewSimulator.getCurrentCornerRadius(),
+                    cropRectF.width() / 2f);
+        } else {
+            anim = new RectFSpringAnim(startRect, targetRect, mContext);
+        }
         homeAnimationFactory.setAnimation(anim);
 
         SpringAnimationRunner runner = new SpringAnimationRunner(
@@ -259,18 +273,26 @@
         }
 
         @Override
-        public void onUpdate(RectF currentRect, float progress) {
+        public void onUpdate(@Nullable AppCloseConfig config, RectF currentRect, float progress) {
             mHomeAnim.setPlayFraction(progress);
             mHomeToWindowPositionMap.mapRect(mWindowCurrentRect, currentRect);
 
             mMatrix.setRectToRect(mCropRectF, mWindowCurrentRect, ScaleToFit.FILL);
             float cornerRadius = Utilities.mapRange(progress, mStartRadius, mEndRadius);
+            float alpha = getWindowAlpha(progress);
+            if (config != null && PROTOTYPE_APP_CLOSE.get()) {
+                alpha = config.getWindowAlpha();
+                cornerRadius = config.getCornerRadius();
+            }
+            if (mAnimationFactory.keepWindowOpaque()) {
+                alpha = 1f;
+            }
             mTransformParams
-                    .setTargetAlpha(getWindowAlpha(progress))
+                    .setTargetAlpha(alpha)
                     .setCornerRadius(cornerRadius);
-
             mTransformParams.applySurfaceParams(mTransformParams.createSurfaceParams(this));
-            mAnimationFactory.update(currentRect, progress, mMatrix.mapRadius(cornerRadius));
+            mAnimationFactory.update(config, currentRect, progress,
+                    mMatrix.mapRadius(cornerRadius));
         }
 
         @Override
diff --git a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
index 8fc453d..1aa64fa 100644
--- a/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/SwipeUpGestureTutorialController.java
@@ -52,6 +52,7 @@
 import com.android.quickstep.RecentsAnimationDeviceState;
 import com.android.quickstep.SwipeUpAnimationLogic;
 import com.android.quickstep.SwipeUpAnimationLogic.RunningWindowAnim;
+import com.android.quickstep.util.AppCloseConfig;
 import com.android.quickstep.util.RectFSpringAnim;
 import com.android.quickstep.util.TransformParams;
 import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
@@ -306,11 +307,12 @@
                 }
 
                 @Override
-                public void update(RectF rect, float progress, float radius) {
+                public void update(@Nullable AppCloseConfig config, RectF rect, float progress,
+                        float radius) {
                     mFakeIconView.setVisibility(View.VISIBLE);
                     mFakeIconView.update(rect, progress,
                             1f - SHAPE_PROGRESS_DURATION /* shapeProgressStart */,
-                            radius,
+                            radius, 255,
                             false, /* isOpening */
                             mFakeIconView, mDp,
                             false /* isVerticalBarLayout */);
diff --git a/quickstep/src/com/android/quickstep/util/AppCloseConfig.java b/quickstep/src/com/android/quickstep/util/AppCloseConfig.java
new file mode 100644
index 0000000..bec3379
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/AppCloseConfig.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.quickstep.util;
+
+import android.annotation.FloatRange;
+import android.annotation.IntRange;
+
+/*
+ * Adds getter methods to {@link MultiValueUpdateListener} specific to app close animation,
+ * so that the entire animation can be defined in one place.
+ */
+public abstract class AppCloseConfig extends MultiValueUpdateListener {
+
+    /**
+     * Returns the translation y of the workspace contents.
+     */
+    public abstract float getWorkspaceTransY();
+
+    /*
+     * Returns the scale of the workspace contents.
+     */
+    public abstract float getWorkspaceScale();
+
+    /*
+     * Returns the alpha of the window.
+     */
+    public abstract @FloatRange(from = 0, to = 1) float getWindowAlpha();
+
+    /*
+     * Returns the alpha of the foreground layer of an adaptive icon.
+     */
+    public abstract @IntRange(from = 0, to = 255) int getFgAlpha();
+
+    /*
+     * Returns the corner radius of the window and icon.
+     */
+    public abstract float getCornerRadius();
+
+    /*
+     * Returns the interpolated progress of the animation.
+     */
+    public abstract float getInterpolatedProgress();
+
+}
diff --git a/quickstep/src/com/android/quickstep/util/RectFSpringAnim.java b/quickstep/src/com/android/quickstep/util/RectFSpringAnim.java
index e5d2c53..02ec68a 100644
--- a/quickstep/src/com/android/quickstep/util/RectFSpringAnim.java
+++ b/quickstep/src/com/android/quickstep/util/RectFSpringAnim.java
@@ -20,6 +20,7 @@
 import android.graphics.PointF;
 import android.graphics.RectF;
 
+import androidx.annotation.Nullable;
 import androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationEndListener;
 import androidx.dynamicanimation.animation.FloatPropertyCompat;
 import androidx.dynamicanimation.animation.SpringAnimation;
@@ -241,7 +242,7 @@
                         mCurrentCenterX + currentWidth / 2, mCurrentY + currentHeight);
             }
             for (OnUpdateListener onUpdateListener : mOnUpdateListeners) {
-                onUpdateListener.onUpdate(mCurrentRect, mCurrentScaleProgress);
+                onUpdateListener.onUpdate(null, mCurrentRect, mCurrentScaleProgress);
             }
         }
     }
@@ -266,7 +267,7 @@
     }
 
     public interface OnUpdateListener {
-        void onUpdate(RectF currentRect, float progress);
+        void onUpdate(@Nullable AppCloseConfig values, RectF currentRect, float progress);
 
         default void onCancel() { }
     }
diff --git a/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java b/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java
new file mode 100644
index 0000000..95d56aa
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java
@@ -0,0 +1,390 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.quickstep.util;
+
+import static com.android.launcher3.Utilities.dpToPx;
+import static com.android.launcher3.anim.Interpolators.LINEAR;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.graphics.PointF;
+import android.graphics.RectF;
+import android.util.PathParser;
+import android.util.Property;
+import android.view.animation.Interpolator;
+
+import androidx.core.view.animation.PathInterpolatorCompat;
+import androidx.dynamicanimation.animation.FloatPropertyCompat;
+import androidx.dynamicanimation.animation.SpringAnimation;
+import androidx.dynamicanimation.animation.SpringForce;
+
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.InvariantDeviceProfile;
+import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.util.DynamicResource;
+import com.android.systemui.plugins.ResourceProvider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Applies spring forces to animate from a starting rect to a target rect,
+ * while providing update callbacks to the caller.
+ */
+public class RectFSpringAnim2 extends RectFSpringAnim {
+
+    private static final FloatPropertyCompat<RectFSpringAnim2> RECT_CENTER_X =
+            new FloatPropertyCompat<RectFSpringAnim2>("rectCenterXSpring") {
+                @Override
+                public float getValue(RectFSpringAnim2 anim) {
+                    return anim.mCurrentCenterX;
+                }
+
+                @Override
+                public void setValue(RectFSpringAnim2 anim, float currentCenterX) {
+                    anim.mCurrentCenterX = currentCenterX;
+                    anim.onUpdate();
+                }
+            };
+
+    private static final FloatPropertyCompat<RectFSpringAnim2> RECT_Y =
+            new FloatPropertyCompat<RectFSpringAnim2>("rectYSpring") {
+                @Override
+                public float getValue(RectFSpringAnim2 anim) {
+                    return anim.mCurrentY;
+                }
+
+                @Override
+                public void setValue(RectFSpringAnim2 anim, float y) {
+                    anim.mCurrentY = y;
+                    anim.onUpdate();
+                }
+            };
+
+    private static final Property<RectFSpringAnim2, Float> PROGRESS =
+            new Property<RectFSpringAnim2, Float>(Float.class, "rectFProgress") {
+                @Override
+                public Float get(RectFSpringAnim2 rectFSpringAnim) {
+                    return rectFSpringAnim.mProgress;
+                }
+
+                @Override
+                public void set(RectFSpringAnim2 rectFSpringAnim, Float progress) {
+                    rectFSpringAnim.mProgress = progress;
+                    rectFSpringAnim.onUpdate();
+                }
+            };
+
+    private final RectF mStartRect;
+    private final RectF mTargetRect;
+    private final RectF mCurrentRect = new RectF();
+    private final List<OnUpdateListener> mOnUpdateListeners = new ArrayList<>();
+    private final List<Animator.AnimatorListener> mAnimatorListeners = new ArrayList<>();
+
+    private float mCurrentCenterX;
+    private float mCurrentY;
+
+    private float mTargetX;
+    private float mTargetY;
+
+    // If true, tracking the bottom of the rects, else tracking the top.
+    private final boolean mTrackingBottomY;
+    private float mProgress;
+    private SpringAnimation mRectXAnim;
+    private SpringAnimation mRectYAnim;
+    private ValueAnimator mRectScaleAnim;
+    private boolean mAnimsStarted;
+    private boolean mRectXAnimEnded;
+    private boolean mRectYAnimEnded;
+    private boolean mRectScaleAnimEnded;
+
+    private final float mXDamping;
+    private final float mXStiffness;
+
+    private final float mYDamping;
+    private float mYStiffness;
+
+    private long mDuration;
+
+    private final Interpolator mCloseInterpolator;
+
+    private AppCloseConfig mValues;
+    final float mStartRadius;
+    final float mEndRadius;
+
+    final float mHomeTransYEnd;
+    final float mScaleStart;
+
+    public RectFSpringAnim2(RectF startRect, RectF targetRect, Context context, float startRadius,
+            float endRadius) {
+        super(startRect, targetRect, context);
+        mStartRect = startRect;
+        mTargetRect = targetRect;
+
+        mTrackingBottomY = startRect.bottom < targetRect.bottom;
+        mCurrentY = mTrackingBottomY ? mStartRect.bottom : mStartRect.top;
+        mCurrentCenterX = mStartRect.centerX();
+
+        mTargetY = mTrackingBottomY ? mTargetRect.bottom : mTargetRect.top;
+        mTargetX = mTargetRect.centerX();
+
+        ResourceProvider rp = DynamicResource.provider(context);
+        mXDamping = rp.getFloat(R.dimen.swipe_up_rect_2_x_damping_ratio);
+        mXStiffness = rp.getFloat(R.dimen.swipe_up_rect_2_x_stiffness);
+
+        mYDamping = rp.getFloat(R.dimen.swipe_up_rect_2_y_damping_ratio);
+        mYStiffness = rp.getFloat(R.dimen.swipe_up_rect_2_y_stiffness);
+        mDuration = Math.round(rp.getFloat(R.dimen.swipe_up_duration));
+
+        mHomeTransYEnd = dpToPx(rp.getFloat(R.dimen.swipe_up_trans_y_dp));
+        mScaleStart = rp.getFloat(R.dimen.swipe_up_scale_start);
+
+
+        if (!mTrackingBottomY) {
+            mYStiffness *= rp.getFloat(R.dimen.swipe_up_rect_2_y_stiffness_low_swipe_multiplier);
+            mDuration *= rp.getFloat(R.dimen.swipe_up_low_swipe_duration_multiplier);
+        }
+
+        mCloseInterpolator = getAppCloseInterpolator(context);
+
+        // End on a "round-enough" radius so that the shape reveal doesn't have to do too much
+        // rounding at the end of the animation.
+        mStartRadius = startRadius;
+        mEndRadius = endRadius;
+
+        setCanRelease(true);
+    }
+
+    public void onTargetPositionChanged() {
+        if (mRectXAnim != null && mTargetX != mTargetRect.centerX()) {
+            mTargetX = mTargetRect.centerX();
+            mRectXAnim.animateToFinalPosition(mTargetX);
+        }
+
+        if (mRectYAnim != null) {
+            if (mTrackingBottomY && mTargetY != mTargetRect.bottom) {
+                mTargetY = mTargetRect.bottom;
+                mRectYAnim.animateToFinalPosition(mTargetY);
+            } else if (!mTrackingBottomY && mTargetY != mTargetRect.top) {
+                mTargetY = mTargetRect.top;
+                mRectYAnim.animateToFinalPosition(mTargetY);
+            }
+        }
+    }
+
+    public void addOnUpdateListener(OnUpdateListener onUpdateListener) {
+        mOnUpdateListeners.add(onUpdateListener);
+    }
+
+    public void addAnimatorListener(Animator.AnimatorListener animatorListener) {
+        mAnimatorListeners.add(animatorListener);
+    }
+
+    /**
+     * Starts the fling/spring animation.
+     * @param context The activity context.
+     * @param velocityPxPerMs Velocity of swipe in px/ms.
+     */
+    public void start(Context context, PointF velocityPxPerMs) {
+        DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(context).getDeviceProfile(context);
+
+        mRectXAnim = new SpringAnimation(this, RECT_CENTER_X)
+                .setStartValue(mCurrentCenterX)
+                .setMinValue(Math.min(0, mCurrentCenterX))
+                .setMaxValue(Math.max(dp.widthPx, mCurrentCenterX))
+                .setStartVelocity(velocityPxPerMs.x * 1000)
+                .setSpring(new SpringForce(mTargetX)
+                        .setStiffness(mXStiffness)
+                        .setDampingRatio(mXDamping));
+        mRectXAnim.addEndListener(((animation, canceled, centerX, velocityX) -> {
+            mRectXAnimEnded = true;
+            maybeOnEnd();
+        }));
+
+        mRectYAnim = new SpringAnimation(this, RECT_Y)
+                .setStartValue(mCurrentY)
+                .setMinValue(Math.min(0, mCurrentY))
+                .setMaxValue(Math.max(dp.heightPx, mCurrentY))
+                .setStartVelocity(velocityPxPerMs.y * 1000)
+                .setSpring(new SpringForce(mTargetY)
+                        .setStiffness(mYStiffness)
+                        .setDampingRatio(mYDamping));
+        mRectYAnim.addEndListener(((animation, canceled, centerY, velocityY) -> {
+            mRectYAnimEnded = true;
+            maybeOnEnd();
+        }));
+
+        mRectScaleAnim = ObjectAnimator.ofFloat(this, PROGRESS, 0, 1f)
+                .setDuration(mDuration);
+        mRectScaleAnim.setInterpolator(mCloseInterpolator);
+        mRectScaleAnim.addListener(new AnimatorListenerAdapter() {
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                mRectScaleAnimEnded = true;
+                maybeOnEnd();
+            }
+        });
+
+        mValues = buildConfig();
+        mRectScaleAnim.addUpdateListener(mValues);
+
+        setCanRelease(false);
+        mAnimsStarted = true;
+
+        mRectXAnim.start();
+        mRectYAnim.start();
+        mRectScaleAnim.start();
+        for (Animator.AnimatorListener animatorListener : mAnimatorListeners) {
+            animatorListener.onAnimationStart(null);
+        }
+    }
+
+    private AppCloseConfig buildConfig() {
+        return new AppCloseConfig() {
+            FloatProp mHomeTransY = new FloatProp(0, mHomeTransYEnd, 0, mDuration, LINEAR);
+            FloatProp mHomeScale = new FloatProp(mScaleStart, 1f, 0, mDuration, LINEAR);
+            FloatProp mWindowFadeOut = new FloatProp(1f, 0f, 0, 116, LINEAR);
+            // There should be a slight overlap b/w window fading out and fg fading in.
+            // (fg startDelay < window fade out duration)
+            FloatProp mFgFadeIn = new FloatProp(0, 255f, 100, mDuration - 100, LINEAR);
+            FloatProp mRadius = new FloatProp(mStartRadius, mEndRadius, 0, mDuration, LINEAR);
+            FloatProp mThreePointInterpolation = new FloatProp(0, 1, 0, mDuration, LINEAR);
+
+            @Override
+            public float getWorkspaceTransY() {
+                return mHomeTransY.value;
+            }
+
+            @Override
+            public float getWorkspaceScale() {
+                return mHomeScale.value;
+            }
+
+            @Override
+            public float getWindowAlpha() {
+                return mWindowFadeOut.value;
+            }
+
+            @Override
+            public int getFgAlpha() {
+                return (int) mFgFadeIn.value;
+            }
+
+            @Override
+            public float getCornerRadius() {
+                return mRadius.value;
+            }
+
+            @Override
+            public float getInterpolatedProgress() {
+                return mThreePointInterpolation.value;
+            }
+
+            @Override
+            public void onUpdate(float percent) {}
+        };
+    }
+
+    public void end() {
+        if (mAnimsStarted) {
+            if (mRectXAnim.canSkipToEnd()) {
+                mRectXAnim.skipToEnd();
+            }
+            if (mRectYAnim.canSkipToEnd()) {
+                mRectYAnim.skipToEnd();
+            }
+            mRectScaleAnim.end();
+        }
+        mRectXAnimEnded = true;
+        mRectYAnimEnded = true;
+        mRectScaleAnimEnded = true;
+        maybeOnEnd();
+    }
+
+    private boolean isEnded() {
+        return mRectXAnimEnded && mRectYAnimEnded && mRectScaleAnimEnded;
+    }
+
+    private void onUpdate() {
+        if (isEnded()) {
+            // Prevent further updates from being called. This can happen between callbacks for
+            // ending the x/y/scale animations.
+            return;
+        }
+
+        if (!mOnUpdateListeners.isEmpty()) {
+            float rectProgress = mProgress;
+            float currentWidth = Utilities.mapRange(rectProgress, mStartRect.width(),
+                    mTargetRect.width());
+            float currentHeight = Utilities.mapRange(rectProgress, mStartRect.height(),
+                    mTargetRect.height());
+            if (mTrackingBottomY) {
+                mCurrentRect.set(mCurrentCenterX - currentWidth / 2, mCurrentY - currentHeight,
+                        mCurrentCenterX + currentWidth / 2, mCurrentY);
+            } else {
+                mCurrentRect.set(mCurrentCenterX - currentWidth / 2, mCurrentY,
+                        mCurrentCenterX + currentWidth / 2, mCurrentY + currentHeight);
+            }
+
+            float currentPlayTime = mRectScaleAnimEnded ? mRectScaleAnim.getDuration()
+                    : mRectScaleAnim.getCurrentPlayTime();
+            float linearProgress = Math.min(1f, currentPlayTime / mRectScaleAnim.getDuration());
+            for (OnUpdateListener onUpdateListener : mOnUpdateListeners) {
+                onUpdateListener.onUpdate(mValues, mCurrentRect, linearProgress);
+            }
+        }
+    }
+
+    private void maybeOnEnd() {
+        if (mAnimsStarted && isEnded()) {
+            mAnimsStarted = false;
+            setCanRelease(true);
+            for (Animator.AnimatorListener animatorListener : mAnimatorListeners) {
+                animatorListener.onAnimationEnd(null);
+            }
+        }
+    }
+
+    public void cancel() {
+        if (mAnimsStarted) {
+            for (OnUpdateListener onUpdateListener : mOnUpdateListeners) {
+                onUpdateListener.onCancel();
+            }
+        }
+        end();
+    }
+
+    private Interpolator getAppCloseInterpolator(Context context) {
+        ResourceProvider rp = DynamicResource.provider(context);
+        String path = String.format("M 0,0 C %f, %f, %f, %f, %f, %f C %f, %f, %f, %f, 1, 1",
+                rp.getFloat(R.dimen.c1_a),
+                rp.getFloat(R.dimen.c1_b),
+                rp.getFloat(R.dimen.c1_c),
+                rp.getFloat(R.dimen.c1_d),
+                rp.getFloat(R.dimen.mp_x),
+                rp.getFloat(R.dimen.mp_y),
+                rp.getFloat(R.dimen.c2_a),
+                rp.getFloat(R.dimen.c2_b),
+                rp.getFloat(R.dimen.c2_c),
+                rp.getFloat(R.dimen.c2_d));
+        return PathInterpolatorCompat.create(PathParser.createPathFromPathData(path));
+    }
+}
diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
index c1c8c1b..01d51f8 100644
--- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
+++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java
@@ -16,16 +16,20 @@
 
 package com.android.quickstep.util;
 
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+
 import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
 import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
 import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
 
 import android.animation.AnimatorSet;
 import android.app.ActivityOptions;
+import android.content.res.Resources;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
 import android.util.Pair;
+import android.view.Gravity;
 import android.view.SurfaceControl;
 import android.window.TransitionInfo;
 
@@ -33,7 +37,10 @@
 
 import com.android.launcher3.BaseActivity;
 import com.android.launcher3.BaseQuickstepLauncher;
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.InsettableFrameLayout;
 import com.android.launcher3.LauncherAnimationRunner;
+import com.android.launcher3.R;
 import com.android.launcher3.WrappedAnimationRunnerImpl;
 import com.android.launcher3.WrappedLauncherAnimationRunner;
 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
@@ -115,6 +122,26 @@
         resetState();
     }
 
+    /**
+     * @return {@link InsettableFrameLayout.LayoutParams} to correctly position the
+     * split placeholder view
+     */
+    public InsettableFrameLayout.LayoutParams getLayoutParamsForActivePosition(Resources resources,
+            DeviceProfile deviceProfile) {
+        InsettableFrameLayout.LayoutParams params =
+                new InsettableFrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
+        boolean topLeftPosition = mInitialPosition.mStagePosition == STAGE_POSITION_TOP_OR_LEFT;
+        if (deviceProfile.isLandscape) {
+            params.width = (int) resources.getDimension(R.dimen.split_placeholder_size);
+            params.gravity = topLeftPosition ? Gravity.START : Gravity.END;
+        } else {
+            params.height = (int) resources.getDimension(R.dimen.split_placeholder_size);
+            params.gravity = Gravity.TOP;
+        }
+
+        return params;
+    }
+
     @Nullable
     public SplitPositionOption getActiveSplitPositionOption() {
         return mInitialPosition;
diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 1df459e..de6c4f5 100644
--- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -20,6 +20,7 @@
 import static com.android.launcher3.LauncherState.NORMAL;
 import static com.android.launcher3.anim.Interpolators.LINEAR;
 import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
+import static com.android.launcher3.config.FeatureFlags.PROTOTYPE_APP_CLOSE;
 import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
 import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
 import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM;
@@ -220,6 +221,9 @@
      * @param totalRows Total number of rows.
      */
     private void addStaggeredAnimationForView(View v, int row, int totalRows) {
+        if (PROTOTYPE_APP_CLOSE.get()) {
+            return;
+        }
         // Invert the rows, because we stagger starting from the bottom of the screen.
         int invertedRow = totalRows - row;
         // Add 1 to the inverted row so that the bottom most row has a start delay.
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 6ed490d..790c655 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -42,6 +42,7 @@
 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP;
 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
 import static com.android.launcher3.statehandlers.DepthController.DEPTH;
+import static com.android.launcher3.touch.PagedOrientationHandler.CANVAS_TRANSLATE;
 import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
 import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
 import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
@@ -88,11 +89,13 @@
 import android.view.View;
 import android.view.ViewDebug;
 import android.view.ViewGroup;
+import android.view.ViewTreeObserver.OnScrollChangedListener;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.view.animation.Interpolator;
 import android.widget.FrameLayout;
 import android.widget.ListView;
+import android.widget.OverScroller;
 
 import androidx.annotation.Nullable;
 import androidx.annotation.UiThread;
@@ -116,14 +119,15 @@
 import com.android.launcher3.statemanager.BaseState;
 import com.android.launcher3.statemanager.StatefulActivity;
 import com.android.launcher3.testing.TestProtocol;
+import com.android.launcher3.touch.OverScroll;
 import com.android.launcher3.touch.PagedOrientationHandler;
 import com.android.launcher3.util.DynamicResource;
 import com.android.launcher3.util.IntSet;
 import com.android.launcher3.util.MultiValueAlpha;
-import com.android.launcher3.util.OverScroller;
 import com.android.launcher3.util.ResourceBasedOverride.Overrides;
 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
 import com.android.launcher3.util.Themes;
+import com.android.launcher3.util.TranslateEdgeEffect;
 import com.android.launcher3.util.ViewPool;
 import com.android.quickstep.AnimatedFloat;
 import com.android.quickstep.BaseActivityInterface;
@@ -141,6 +145,7 @@
 import com.android.quickstep.util.MultiValueUpdateListener;
 import com.android.quickstep.util.RecentsOrientedState;
 import com.android.quickstep.util.SplitScreenBounds;
+import com.android.quickstep.util.SplitSelectStateController;
 import com.android.quickstep.util.SurfaceTransactionApplier;
 import com.android.quickstep.util.TaskViewSimulator;
 import com.android.quickstep.util.TransformParams;
@@ -157,6 +162,7 @@
 import com.android.wm.shell.pip.IPipAnimationListener;
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.function.Consumer;
 
 /**
@@ -296,6 +302,9 @@
                 }
             };
 
+    // OverScroll constants
+    private static final int OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION = 270;
+
     protected final RecentsOrientedState mOrientationState;
     protected final BaseActivityInterface<STATE_TYPE, ACTIVITY_TYPE> mSizeStrategy;
     protected RecentsAnimationController mRecentsAnimationController;
@@ -314,6 +323,8 @@
     protected final Rect mTempRect = new Rect();
     protected final RectF mTempRectF = new RectF();
     private final PointF mTempPointF = new PointF();
+    private final float[] mTempFloat = new float[1];
+    private final List<OnScrollChangedListener> mScrollListeners = new ArrayList<>();
     private float mFullscreenScale;
 
     private static final int DISMISS_TASK_DURATION = 300;
@@ -360,6 +371,9 @@
 
     IntSet mTopIdSet = new IntSet();
 
+    private int mOverScrollShift = 0;
+
+
     /**
      * TODO: Call reloadIdNeeded in onTaskStackChanged.
      */
@@ -584,6 +598,72 @@
     }
 
     @Override
+    protected void initEdgeEffect() {
+        mEdgeGlowLeft = new TranslateEdgeEffect(getContext());
+        mEdgeGlowRight = new TranslateEdgeEffect(getContext());
+    }
+
+    @Override
+    protected void drawEdgeEffect(Canvas canvas) {
+        // Do not draw edge effect
+    }
+
+    @Override
+    protected void dispatchDraw(Canvas canvas) {
+        // Draw overscroll
+        if (mAllowOverScroll && (!mEdgeGlowRight.isFinished() || !mEdgeGlowLeft.isFinished())) {
+            final int restoreCount = canvas.save();
+            final int width = getWidth();
+            final int height = getHeight();
+            int primarySize = mOrientationHandler.getPrimaryValue(width, height);
+            int secondarySize = mOrientationHandler.getSecondaryValue(width, height);
+
+            float effectiveShift = 0;
+            if (!mEdgeGlowLeft.isFinished()) {
+                mEdgeGlowLeft.setSize(secondarySize, primarySize);
+                if (((TranslateEdgeEffect) mEdgeGlowLeft).getTranslationShift(mTempFloat)) {
+                    effectiveShift = mTempFloat[0];
+                    postInvalidateOnAnimation();
+                }
+            }
+            if (!mEdgeGlowRight.isFinished()) {
+                mEdgeGlowRight.setSize(secondarySize, primarySize);
+                if (((TranslateEdgeEffect) mEdgeGlowRight).getTranslationShift(mTempFloat)) {
+                    effectiveShift -= mTempFloat[0];
+                    postInvalidateOnAnimation();
+                }
+            }
+
+            int scroll = OverScroll.dampedScroll(effectiveShift * primarySize, primarySize);
+            mOrientationHandler.set(canvas, CANVAS_TRANSLATE, scroll);
+
+            if (mOverScrollShift != scroll) {
+                mOverScrollShift = scroll;
+                dispatchScrollChanged();
+            }
+
+            super.dispatchDraw(canvas);
+            canvas.restoreToCount(restoreCount);
+        } else {
+            if (mOverScrollShift != 0) {
+                mOverScrollShift = 0;
+                dispatchScrollChanged();
+            }
+            super.dispatchDraw(canvas);
+        }
+        if (LIVE_TILE.get() && mEnableDrawingLiveTile && mLiveTileParams.getTargetSet() != null) {
+            redrawLiveTile();
+        }
+    }
+
+    /**
+     * Returns the view shift due to overscroll
+     */
+    public int getOverScrollShift() {
+        return mOverScrollShift;
+    }
+
+    @Override
     public Task onTaskThumbnailChanged(int taskId, ThumbnailData thumbnailData) {
         if (mHandleTaskStackChanges) {
             TaskView taskView = getTaskView(taskId);
@@ -936,8 +1016,30 @@
     }
 
     @Override
-    protected boolean snapToPageInFreeScroll() {
-        return !showAsGrid();
+    protected void onNotSnappingToPageInFreeScroll() {
+        int finalPos = mScroller.getFinalX();
+        if (!showAsGrid() && finalPos > mMinScroll && finalPos < mMaxScroll) {
+            int firstPageScroll = getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1);
+            int lastPageScroll = getScrollForPage(!mIsRtl ? getPageCount() - 1 : 0);
+
+            // If scrolling ends in the half of the added space that is closer to
+            // the end, settle to the end. Otherwise snap to the nearest page.
+            // If flinging past one of the ends, don't change the velocity as it
+            // will get stopped at the end anyway.
+            int pageSnapped = finalPos < (firstPageScroll + mMinScroll) / 2
+                    ? mMinScroll
+                    : finalPos > (lastPageScroll + mMaxScroll) / 2
+                            ? mMaxScroll
+                            : getScrollForPage(mNextPage);
+
+            mScroller.setFinalX(pageSnapped);
+            // Ensure the scroll/snap doesn't happen too fast;
+            int extraScrollDuration = OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION
+                    - mScroller.getDuration();
+            if (extraScrollDuration > 0) {
+                mScroller.extendDuration(extraScrollDuration);
+            }
+        }
     }
 
     @Override
@@ -1267,12 +1369,6 @@
 
         // Update the high res thumbnail loader state
         mModel.getThumbnailCache().getHighResLoadingState().setFlingingFast(isFlingingFast);
-
-        mLiveTileTaskViewSimulator.setScroll(getScrollOffset());
-        if (LIVE_TILE.get() && mEnableDrawingLiveTile
-                && mLiveTileParams.getTargetSet() != null) {
-            redrawLiveTile();
-        }
         return scrolling;
     }
 
@@ -1420,9 +1516,7 @@
         mTaskListChangeId = -1;
         mFocusedTaskId = -1;
 
-        if (mRecentsAnimationController != null) {
-            finishRecentsAnimation(true /* toRecents */, null);
-        }
+        mRecentsAnimationController = null;
         mLiveTileParams.setTargetSet(null);
         mLiveTileTaskViewSimulator.setDrawsBelowRecents(true);
 
@@ -1571,7 +1665,6 @@
             updateOrientationHandler();
         }
 
-        setOnScrollChangeListener(null);
         setEnableFreeScroll(true);
         setEnableDrawingLiveTile(true);
         if (!LIVE_TILE.get()) {
@@ -2528,10 +2621,6 @@
                     ? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty()
                     : mOrientationHandler.getPrimaryViewTranslate();
             translationProperty.set(child, totalTranslation);
-            if (LIVE_TILE.get() && mEnableDrawingLiveTile && i == getRunningTaskIndex()) {
-                mLiveTileTaskViewSimulator.taskPrimaryTranslation.value = totalTranslation;
-                redrawLiveTile();
-            }
         }
         updateCurveProperties();
     }
@@ -2665,9 +2754,14 @@
 
     public void initiateSplitSelect(TaskView taskView, SplitPositionOption splitPositionOption) {
         mSplitHiddenTaskView = taskView;
-        mSplitPlaceholderView.getSplitController().setInitialTaskSelect(taskView,
+        SplitSelectStateController splitController = mSplitPlaceholderView.getSplitController();
+        splitController.setInitialTaskSelect(taskView,
                 splitPositionOption);
         mSplitHiddenTaskViewIndex = indexOfChild(taskView);
+        mSplitPlaceholderView.setLayoutParams(
+                splitController.getLayoutParamsForActivePosition(getResources(),
+                        mActivity.getDeviceProfile()));
+        mSplitPlaceholderView.setIcon(taskView.getIconView());
     }
 
     public PendingAnimation createSplitSelectInitAnimation() {
@@ -3147,8 +3241,8 @@
     @Override
     protected boolean getPageScrolls(int[] outPageScrolls, boolean layoutChildren,
             ComputePageScrollsLogic scrollLogic) {
-        boolean pageScrollChanged = super.getPageScrolls(outPageScrolls, layoutChildren,
-                scrollLogic);
+        int[] newPageScrolls = new int[outPageScrolls.length];
+        super.getPageScrolls(newPageScrolls, layoutChildren, scrollLogic);
         boolean showAsFullscreen = showAsFullscreen();
         boolean showAsGrid = showAsGrid();
 
@@ -3160,6 +3254,7 @@
             mClearAllButton.setScrollOffsetPrimary(mIsRtl ? clearAllWidthDiff : -clearAllWidthDiff);
         }
 
+        boolean pageScrollChanged = false;
         final int childCount = getChildCount();
         for (int i = 0; i < childCount; i++) {
             View child = getChildAt(i);
@@ -3171,9 +3266,10 @@
                         showAsGrid);
             }
 
-            if (scrollDiff != 0) {
-                outPageScrolls[i] += scrollDiff;
+            final int pageScroll = newPageScrolls[i] + (int) scrollDiff;
+            if (outPageScrolls[i] != pageScroll) {
                 pageScrollChanged = true;
+                outPageScrolls[i] = pageScroll;
             }
         }
         return pageScrollChanged;
@@ -3207,13 +3303,6 @@
         return mClearAllButton;
     }
 
-    @Override
-    protected boolean onOverscroll(int amount) {
-        // overscroll should only be accepted on -1 direction (for clear all button)
-        if ((amount > 0 && !mIsRtl) || (amount < 0 && mIsRtl)) return false;
-        return super.onOverscroll(amount);
-    }
-
     /**
      * @return How many pixels the running task is offset on the currently laid out dominant axis.
      */
@@ -3228,14 +3317,8 @@
         if (pageIndex == -1) {
             return 0;
         }
-        // Unbound the scroll (due to overscroll) if the adjacent tasks are offset away from it.
-        // This allows the page to move freely, given there's no visual indication why it shouldn't.
-        int boundedScroll = mOrientationHandler.getPrimaryScroll(this);
-        int unboundedScroll = getUnboundedScroll();
-        float unboundedProgress = mAdjacentPageOffset;
-        int scroll = Math.round(unboundedScroll * unboundedProgress
-                + boundedScroll * (1 - unboundedProgress));
-        return getScrollForPage(pageIndex) - scroll;
+        return getScrollForPage(pageIndex) - mOrientationHandler.getPrimaryScroll(this)
+                + getOverScrollShift();
     }
 
     /**
@@ -3421,6 +3504,33 @@
         void onEmptyMessageUpdated(boolean isEmpty);
     }
 
+    /**
+     * Adds a listener for scroll changes
+     */
+    public void addOnScrollChangedListener(OnScrollChangedListener listener) {
+        mScrollListeners.add(listener);
+    }
+
+    /**
+     * Removes a previously added scroll change listener
+     */
+    public void removeOnScrollChangedListener(OnScrollChangedListener listener) {
+        mScrollListeners.remove(listener);
+    }
+
+    @Override
+    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
+        super.onScrollChanged(l, t, oldl, oldt);
+        dispatchScrollChanged();
+    }
+
+    private void dispatchScrollChanged() {
+        mLiveTileTaskViewSimulator.setScroll(getScrollOffset());
+        for (int i = mScrollListeners.size() - 1; i >= 0; i--) {
+            mScrollListeners.get(i).onScrollChanged();
+        }
+    }
+
     private static class PinnedStackAnimationListener<T extends BaseActivity> extends
             IPipAnimationListener.Stub {
         private T mActivity;
diff --git a/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java b/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java
index fb9be81..bb8bc11 100644
--- a/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java
+++ b/quickstep/src/com/android/quickstep/views/SplitPlaceholderView.java
@@ -19,11 +19,12 @@
 import android.content.Context;
 import android.util.AttributeSet;
 import android.util.FloatProperty;
-import android.view.View;
+import android.view.Gravity;
+import android.widget.FrameLayout;
 
 import com.android.quickstep.util.SplitSelectStateController;
 
-public class SplitPlaceholderView extends View {
+public class SplitPlaceholderView extends FrameLayout {
 
     public static final FloatProperty<SplitPlaceholderView> ALPHA_FLOAT =
             new FloatProperty<SplitPlaceholderView>("SplitViewAlpha") {
@@ -40,6 +41,7 @@
             };
 
     private SplitSelectStateController mSplitController;
+    private IconView mIcon;
 
     public SplitPlaceholderView(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -52,4 +54,15 @@
     public SplitSelectStateController getSplitController() {
         return mSplitController;
     }
+
+    public void setIcon(IconView icon) {
+        if (mIcon == null) {
+            mIcon = new IconView(getContext());
+            addView(mIcon);
+        }
+        mIcon.setDrawable(icon.getDrawable());
+        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(icon.getLayoutParams());
+        params.gravity = Gravity.CENTER;
+        mIcon.setLayoutParams(params);
+    }
 }
diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
index 658d71d..f55cdac 100644
--- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
@@ -121,7 +121,7 @@
         };
     }
 
-    private void setPosition(float x, float y) {
+    private void setPosition(float x, float y, int overscrollShift) {
         PagedOrientationHandler pagedOrientationHandler = mTaskView.getPagedOrientationHandler();
         int taskTopMargin = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
         float adjustedY = y + taskTopMargin;
@@ -136,8 +136,9 @@
             setPivotY(0);
         }
         setRotation(pagedOrientationHandler.getDegreesRotated());
-        setX(pagedOrientationHandler.getTaskMenuX(x, mTaskView.getThumbnail()));
-        setY(pagedOrientationHandler.getTaskMenuY(adjustedY, mTaskView.getThumbnail()));
+        setX(pagedOrientationHandler.getTaskMenuX(x, mTaskView.getThumbnail(), overscrollShift));
+        setY(pagedOrientationHandler.getTaskMenuY(
+                adjustedY, mTaskView.getThumbnail(), overscrollShift));
     }
 
     public void onRotationChanged() {
@@ -169,14 +170,15 @@
             return false;
         }
         post(this::animateOpen);
-        mActivity.getRootView().getViewTreeObserver().addOnScrollChangedListener(this);
+        ((RecentsView) mActivity.getOverviewPanel()).addOnScrollChangedListener(this);
         return true;
     }
 
     @Override
     public void onScrollChanged() {
         RecentsView rv = mTaskView.getRecentsView();
-        setPosition(mTaskView.getX() - rv.getScrollX(), mTaskView.getY() - rv.getScrollY());
+        setPosition(mTaskView.getX() - rv.getScrollX(), mTaskView.getY() - rv.getScrollY(),
+                rv.getOverScrollShift());
     }
 
     /** @return true if successfully able to populate task view menu, false otherwise */
@@ -236,7 +238,7 @@
             .mOrientationState.isRecentsActivityRotationAllowed();
         mOptionLayout.setOrientation(orientationHandler
                 .getTaskMenuLayoutOrientation(canActivityRotate, mOptionLayout));
-        setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top);
+        setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top, 0);
     }
 
     private void animateOpen() {
@@ -282,7 +284,7 @@
     private void closeComplete() {
         mIsOpen = false;
         mActivity.getDragLayer().removeView(this);
-        mActivity.getRootView().getViewTreeObserver().removeOnScrollChangedListener(this);
+        ((RecentsView) mActivity.getOverviewPanel()).removeOnScrollChangedListener(this);
     }
 
     private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 2bb14d2..35acdd1 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -523,7 +523,7 @@
         if (mTask != null) {
             TestLogging.recordEvent(
                     TestProtocol.SEQUENCE_MAIN, "startActivityFromRecentsAsync", mTask);
-            ActivityOptionsWrapper opts =  mActivity.getActivityLaunchOptions(this);
+            ActivityOptionsWrapper opts =  mActivity.getActivityLaunchOptions(this, null);
             if (ActivityManagerWrapper.getInstance()
                     .startActivityFromRecents(mTask.key, opts.options)) {
                 return opts.onEndCallback;
diff --git a/res/values/config.xml b/res/values/config.xml
index db98811..b75af7f 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -134,8 +134,45 @@
     <item name="swipe_up_rect_scale_stiffness" type="dimen" format="float">200</item>
 
     <item name="swipe_up_rect_xy_fling_friction" type="dimen" format="float">1.5</item>
+
+    <item name="swipe_up_scale_start"  type="dimen" format="float">0.98</item>
+    <item name="swipe_up_duration"  type="dimen" format="float">500</item>
+
+    <item name="swipe_up_trans_y_dp"  type="dimen" format="float">3</item>
+    <item name="swipe_up_trans_y_dp_per_s" type="dimen" format="float">3</item>
+
+    <item name="swipe_up_trans_y_damping" type="dimen" format="float">0.4</item>
+    <item name="swipe_up_trans_y_stiffness" type="dimen" format="float">200</item>
+
     <item name="swipe_up_rect_xy_damping_ratio" type="dimen" format="float">0.8</item>
-    <item name="swipe_up_rect_xy_stiffness" type="dimen" format="float">200</item>
+    <item name="swipe_up_rect_xy_stiffness" type="dimen" format="float">100</item>
+
+
+    <item name="swipe_up_rect_2_x_damping_ratio" type="dimen" format="float">1</item>
+    <item name="swipe_up_rect_2_x_stiffness" type="dimen" format="float">350</item>
+
+    <item name="swipe_up_rect_2_y_damping_ratio" type="dimen" format="float">1</item>
+    <item name="swipe_up_rect_2_y_stiffness" type="dimen" format="float">700</item>
+
+    <item name="swipe_up_rect_2_y_stiffness_low_swipe_multiplier" type="dimen" format="float">1</item>
+    <item name="swipe_up_low_swipe_duration_multiplier"  type="dimen" format="float">1</item>
+
+    <item name="swipe_up_launcher_alpha_max_progress" type="dimen" format="float">0.85</item>
+
+
+    <item name="c1_a" type="dimen" format="float">0.05</item>
+    <item name="c1_b" type="dimen" format="float">0</item>
+    <item name="c1_c" type="dimen" format="float">0.133333</item>
+    <item name="c1_d" type="dimen" format="float">0.06</item>
+
+    <item name="mp_x" type="dimen" format="float">0.166666</item>
+    <item name="mp_y" type="dimen" format="float">.4</item>
+
+    <item name="c2_a" type="dimen" format="float">0.208333</item>
+    <item name="c2_b" type="dimen" format="float">.82</item>
+    <item name="c2_c" type="dimen" format="float">.25</item>
+    <item name="c2_d" type="dimen" format="float">1</item>
+
 
     <item name="staggered_damping_ratio" type="dimen" format="float">0.7</item>
     <item name="staggered_stiffness" type="dimen" format="float">150</item>
@@ -151,35 +188,32 @@
     <dimen name="swipe_up_max_workspace_trans_y">-60dp</dimen>
 
     <array name="dynamic_resources">
-        <item>@dimen/all_apps_spring_damping_ratio</item>
-        <item>@dimen/all_apps_spring_stiffness</item>
+        <item>@dimen/swipe_up_duration</item>
+        <item>@dimen/swipe_up_scale_start</item>
+        <item>@dimen/swipe_up_trans_y_dp</item>
+        <item>@dimen/swipe_up_trans_y_dp_per_s</item>
+        <item>@dimen/swipe_up_trans_y_damping</item>
+        <item>@dimen/swipe_up_trans_y_stiffness</item>
+        <item>@dimen/swipe_up_rect_2_x_damping_ratio</item>
+        <item>@dimen/swipe_up_rect_2_x_stiffness</item>
+        <item>@dimen/swipe_up_rect_2_y_damping_ratio</item>
+        <item>@dimen/swipe_up_rect_2_y_stiffness</item>
+        <item>@dimen/swipe_up_launcher_alpha_max_progress</item>
+        <item>@dimen/swipe_up_rect_2_y_stiffness_low_swipe_multiplier</item>
+        <item>@dimen/swipe_up_low_swipe_duration_multiplier</item>
 
-        <item>@dimen/dismiss_task_trans_y_damping_ratio</item>
-        <item>@dimen/dismiss_task_trans_y_stiffness</item>
+        <item>@dimen/c1_a</item>
+        <item>@dimen/c1_b</item>
+        <item>@dimen/c1_c</item>
+        <item>@dimen/c1_d</item>
 
-        <item>@dimen/dismiss_task_trans_x_damping_ratio</item>
-        <item>@dimen/dismiss_task_trans_x_stiffness</item>
+        <item>@dimen/mp_x</item>
+        <item>@dimen/mp_y</item>
 
-        <item>@dimen/horizontal_spring_damping_ratio</item>
-        <item>@dimen/horizontal_spring_stiffness</item>
-
-        <item>@dimen/swipe_up_rect_scale_damping_ratio</item>
-        <item>@dimen/swipe_up_rect_scale_stiffness</item>
-
-        <item>@dimen/swipe_up_rect_xy_fling_friction</item>
-        <item>@dimen/swipe_up_rect_xy_damping_ratio</item>
-        <item>@dimen/swipe_up_rect_xy_stiffness</item>
-
-        <item>@dimen/staggered_damping_ratio</item>
-        <item>@dimen/staggered_stiffness</item>
-        <item>@dimen/unlock_staggered_velocity_dp_per_s</item>
-
-        <item>@dimen/swipe_up_fling_min_visible_change</item>
-        <item>@dimen/swipe_up_y_overshoot</item>
-
-        <item>@dimen/hint_scale_damping_ratio</item>
-        <item>@dimen/hint_scale_stiffness</item>
-        <item>@dimen/hint_scale_velocity_dp_per_s</item>
+        <item>@dimen/c2_a</item>
+        <item>@dimen/c2_b</item>
+        <item>@dimen/c2_c</item>
+        <item>@dimen/c2_d</item>
     </array>
 
     <string-array name="live_wallpapers_remove_sysui_scrims">
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index e9412d9..cc9f594 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -165,7 +165,7 @@
     }
 
     @NonNull
-    public ActivityOptionsWrapper getActivityLaunchOptions(View v) {
+    public ActivityOptionsWrapper getActivityLaunchOptions(View v, @Nullable ItemInfo item) {
         int left = 0, top = 0;
         int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
         if (v instanceof BubbleTextView) {
@@ -192,7 +192,7 @@
             return false;
         }
 
-        Bundle optsBundle = (v != null) ? getActivityLaunchOptions(v).toBundle() : null;
+        Bundle optsBundle = (v != null) ? getActivityLaunchOptions(v, item).toBundle() : null;
         UserHandle user = item == null ? null : item.user;
 
         // Prepare intent
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 3c85564..11dc0c4 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -18,7 +18,6 @@
 
 import static com.android.launcher3.Utilities.getDevicePrefs;
 import static com.android.launcher3.Utilities.getPointString;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_FOUR_COLUMNS;
 import static com.android.launcher3.config.FeatureFlags.ENABLE_TWO_PANEL_HOME;
 import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
 import static com.android.launcher3.util.DisplayController.CHANGE_SIZE;
@@ -262,9 +261,6 @@
         if (ENABLE_TWO_PANEL_HOME.get()) {
             return ENABLE_TWO_PANEL_HOME.key;
         }
-        if (ENABLE_FOUR_COLUMNS.get()) {
-            return ENABLE_FOUR_COLUMNS.key;
-        }
         return Utilities.isGridOptionsEnabled(context)
                 ? Utilities.getPrefs(context).getString(KEY_IDP_GRID_NAME, null) : null;
     }
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 4754558..11585f9 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -17,9 +17,6 @@
 package com.android.launcher3;
 
 import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS;
-import static com.android.launcher3.InvariantDeviceProfile.KEY_MIGRATION_SRC_HOTSEAT_COUNT;
-import static com.android.launcher3.InvariantDeviceProfile.KEY_MIGRATION_SRC_WORKSPACE_SIZE;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_FOUR_COLUMNS;
 import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
 import static com.android.launcher3.util.SettingsCache.NOTIFICATION_BADGING_URI;
 
@@ -126,33 +123,6 @@
 
         mInvariantDeviceProfile = InvariantDeviceProfile.INSTANCE.get(context);
 
-        // b/175329686 Temporary logic to gracefully migrate group of users to the new 4x5 grid.
-        String gridName = InvariantDeviceProfile.getCurrentGridName(context);
-        if (ENABLE_FOUR_COLUMNS.get()
-                || "reasonable".equals(gridName)
-                || ENABLE_FOUR_COLUMNS.key.equals(gridName)) {
-            // Reset flag and remove it from developer options to prevent it from being enabled
-            // again.
-            ENABLE_FOUR_COLUMNS.reset(context);
-            FeatureFlags.removeFlag(ENABLE_FOUR_COLUMNS);
-
-            // Force migration code to run
-            Utilities.getPrefs(context).edit()
-                    .remove(KEY_MIGRATION_SRC_HOTSEAT_COUNT)
-                    .remove(KEY_MIGRATION_SRC_WORKSPACE_SIZE)
-                    .apply();
-
-            // We make an empty call here to ensure the database is created with the old IDP grid,
-            // so that when we set the new grid the migration can proceeds as expected.
-            LauncherSettings.Settings.call(context.getContentResolver(), "");
-
-            String newGridName = "practical";
-            Utilities.getPrefs(mContext).edit().putString("idp_grid_name", newGridName).commit();
-            mInvariantDeviceProfile.setCurrentGrid(context, "practical");
-        } else {
-            FeatureFlags.removeFlag(ENABLE_FOUR_COLUMNS);
-        }
-
         mIconCache = new IconCache(mContext, mInvariantDeviceProfile, iconCacheFileName);
         mWidgetCache = new WidgetPreviewLoader(mContext, mIconCache);
         mModel = new LauncherModel(context, this, mIconCache, new AppFilter(mContext));
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 7496703..c9cc372 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -16,16 +16,14 @@
 
 package com.android.launcher3;
 
+import static com.android.launcher3.anim.Interpolators.SCROLL;
 import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
 import static com.android.launcher3.compat.AccessibilityManagerCompat.isObservedEventType;
-import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
 import static com.android.launcher3.touch.OverScroll.OVERSCROLL_DAMP_FACTOR;
-import static com.android.launcher3.touch.PagedOrientationHandler.CANVAS_TRANSLATE;
 import static com.android.launcher3.touch.PagedOrientationHandler.VIEW_SCROLL_BY;
 import static com.android.launcher3.touch.PagedOrientationHandler.VIEW_SCROLL_TO;
 
 import android.animation.LayoutTransition;
-import android.animation.TimeInterpolator;
 import android.annotation.SuppressLint;
 import android.content.Context;
 import android.content.res.TypedArray;
@@ -46,19 +44,17 @@
 import android.view.ViewParent;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
-import android.view.animation.Interpolator;
+import android.widget.OverScroller;
 import android.widget.ScrollView;
 
 import androidx.annotation.Nullable;
 
-import com.android.launcher3.anim.Interpolators;
 import com.android.launcher3.compat.AccessibilityManagerCompat;
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.pageindicators.PageIndicator;
-import com.android.launcher3.touch.OverScroll;
 import com.android.launcher3.touch.PagedOrientationHandler;
 import com.android.launcher3.touch.PagedOrientationHandler.ChildBounds;
-import com.android.launcher3.util.OverScroller;
+import com.android.launcher3.util.EdgeEffectCompat;
 import com.android.launcher3.util.Thunk;
 import com.android.launcher3.views.ActivityContext;
 
@@ -80,9 +76,6 @@
 
     public static final int PAGE_SNAP_ANIMATION_DURATION = 750;
 
-    // OverScroll constants
-    private final static int OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION = 270;
-
     private static final float RETURN_TO_ORIGINAL_PAGE_THRESHOLD = 0.33f;
     // The page is moved more than halfway, automatically move to the next page on touch up.
     private static final float SIGNIFICANT_MOVE_THRESHOLD = 0.4f;
@@ -113,7 +106,6 @@
     protected int mMaxScroll;
     protected int mMinScroll;
     protected OverScroller mScroller;
-    private Interpolator mDefaultInterpolator;
     private VelocityTracker mVelocityTracker;
     protected int mPageSpacing = 0;
 
@@ -144,12 +136,6 @@
     protected boolean mIsPageInTransition = false;
     private Runnable mOnPageTransitionEndCallback;
 
-    protected float mSpringOverScroll;
-
-    protected boolean mWasInOverscroll = false;
-
-    protected int mUnboundedScroll;
-
     // Page Indicator
     @Thunk int mPageIndicatorViewId;
     protected T mPageIndicator;
@@ -162,6 +148,9 @@
 
     private int[] mTmpIntPair = new int[2];
 
+    protected EdgeEffectCompat mEdgeGlowLeft;
+    protected EdgeEffectCompat mEdgeGlowRight;
+
     public PagedView(Context context) {
         this(context, null);
     }
@@ -181,8 +170,7 @@
         setHapticFeedbackEnabled(false);
         mIsRtl = Utilities.isRtl(getResources());
 
-        mScroller = new OverScroller(context);
-        setDefaultInterpolator(Interpolators.SCROLL);
+        mScroller = new OverScroller(context, SCROLL);
         mCurrentPage = 0;
 
         final ViewConfiguration configuration = ViewConfiguration.get(context);
@@ -196,12 +184,14 @@
         mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * density);
         mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * density);
 
+        initEdgeEffect();
         setDefaultFocusHighlightEnabled(false);
+        setWillNotDraw(false);
     }
 
-    protected void setDefaultInterpolator(Interpolator interpolator) {
-        mDefaultInterpolator = interpolator;
-        mScroller.setInterpolator(mDefaultInterpolator);
+    protected void initEdgeEffect() {
+        mEdgeGlowLeft = new EdgeEffectCompat(getContext());
+        mEdgeGlowRight = new EdgeEffectCompat(getContext());
     }
 
     public void initParentViews(View parent) {
@@ -256,7 +246,7 @@
             newPosition = getScrollForPage(mCurrentPage);
         }
         mOrientationHandler.set(this, VIEW_SCROLL_TO, newPosition);
-        mOrientationHandler.scrollerStartScroll(mScroller, newPosition);
+        mScroller.startScroll(mScroller.getCurrX(), 0, newPosition - mScroller.getCurrX(), 0);
         forceFinishScroller(true);
     }
 
@@ -420,7 +410,6 @@
      * to provide custom behavior during animation.
      */
     protected void onPageEndTransition() {
-        mWasInOverscroll = false;
         AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
         AccessibilityManagerCompat.sendCustomAccessibilityEvent(getPageAt(mCurrentPage),
                 AccessibilityEvent.TYPE_VIEW_FOCUSED, null);
@@ -442,56 +431,12 @@
         }
     }
 
-    protected int getUnboundedScroll() {
-        return mUnboundedScroll;
-    }
-
-    @Override
-    public void scrollBy(int x, int y) {
-        mOrientationHandler.delegateScrollBy(this, getUnboundedScroll(), x, y);
-    }
-
     @Override
     public void scrollTo(int x, int y) {
-        int primaryScroll = mOrientationHandler.getPrimaryValue(x, y);
-        int secondaryScroll = mOrientationHandler.getSecondaryValue(x, y);
-        mUnboundedScroll = primaryScroll;
-
-        boolean isBeforeFirstPage = mIsRtl ?
-            (primaryScroll > mMaxScroll) : (primaryScroll < mMinScroll);
-        boolean isAfterLastPage = mIsRtl ?
-            (primaryScroll < mMinScroll) : (primaryScroll > mMaxScroll);
-        if (!isBeforeFirstPage && !isAfterLastPage) {
-            mSpringOverScroll = 0;
-        }
-
-        if (isBeforeFirstPage) {
-            mOrientationHandler.delegateScrollTo(this,
-                secondaryScroll, mIsRtl ? mMaxScroll : mMinScroll);
-            if (mAllowOverScroll) {
-                mWasInOverscroll = true;
-                overScroll(primaryScroll - (mIsRtl ? mMaxScroll : mMinScroll));
-            }
-        } else if (isAfterLastPage) {
-            mOrientationHandler.delegateScrollTo(this,
-                secondaryScroll, mIsRtl ? mMinScroll : mMaxScroll);
-            if (mAllowOverScroll) {
-                mWasInOverscroll = true;
-                overScroll(primaryScroll - (mIsRtl ? mMinScroll : mMaxScroll));
-            }
-        } else {
-            if (mWasInOverscroll) {
-                overScroll(0);
-                mWasInOverscroll = false;
-            }
-            super.scrollTo(x, y);
-        }
-    }
-
-    /**
-     * Helper for {@link PagedOrientationHandler} to be able to call parent's scrollTo method
-     */
-    public void superScrollTo(int x, int y) {
+        x = Utilities.boundToRange(x,
+                mOrientationHandler.getPrimaryValue(mMinScroll, 0), mMaxScroll);
+        y = Utilities.boundToRange(y,
+                mOrientationHandler.getPrimaryValue(0, mMinScroll), mMaxScroll);
         super.scrollTo(x, y);
     }
 
@@ -524,12 +469,22 @@
     protected boolean computeScrollHelper(boolean shouldInvalidate) {
         if (mScroller.computeScrollOffset()) {
             // Don't bother scrolling if the page does not need to be moved
-            int currentScroll = mOrientationHandler.getPrimaryScroll(this);
-            if (mUnboundedScroll != mScroller.getCurrPos()
-                || currentScroll != mScroller.getCurrPos()) {
-                mOrientationHandler.set(this, VIEW_SCROLL_TO, mScroller.getCurrPos());
+            int oldPos = mOrientationHandler.getPrimaryScroll(this);
+            int newPos = mScroller.getCurrX();
+            if (oldPos != newPos) {
+                mOrientationHandler.set(this, VIEW_SCROLL_TO, mScroller.getCurrX());
             }
             if (shouldInvalidate) {
+                if (mAllowOverScroll) {
+                    if (newPos < mMinScroll && oldPos >= mMinScroll) {
+                        mEdgeGlowLeft.onAbsorb((int) mScroller.getCurrVelocity());
+                        mScroller.abortAnimation();
+                    } else if (newPos > mMaxScroll && oldPos <= mMaxScroll) {
+                        mEdgeGlowRight.onAbsorb((int) mScroller.getCurrVelocity());
+                        mScroller.abortAnimation();
+                    }
+                }
+
                 invalidate();
             }
             return true;
@@ -982,9 +937,7 @@
                 mTotalMotion = 0;
                 mAllowEasyFling = false;
                 mActivePointerId = ev.getPointerId(0);
-
-                updateIsBeingDraggedOnTouchDown();
-
+                updateIsBeingDraggedOnTouchDown(ev);
                 break;
             }
 
@@ -1009,9 +962,9 @@
     /**
      * If being flinged and user touches the screen, initiate drag; otherwise don't.
      */
-    private void updateIsBeingDraggedOnTouchDown() {
+    private void updateIsBeingDraggedOnTouchDown(MotionEvent ev) {
         // mScroller.isFinished should be false when being flinged.
-        final int xDist = Math.abs(mScroller.getFinalPos() - mScroller.getCurrPos());
+        final int xDist = Math.abs(mScroller.getFinalX() - mScroller.getCurrX());
         final boolean finishedScrolling = (mScroller.isFinished() || xDist < mPageSlop / 3);
 
         if (finishedScrolling) {
@@ -1020,9 +973,20 @@
                 setCurrentPage(getNextPage());
                 pageEndTransition();
             }
+            mIsBeingDragged = !mEdgeGlowLeft.isFinished() || !mEdgeGlowRight.isFinished();
         } else {
             mIsBeingDragged = true;
         }
+
+        // Catch the edge effect if it is active.
+        float displacement = mOrientationHandler.getSecondaryValue(ev.getX(), ev.getY())
+                / mOrientationHandler.getSecondaryValue(getWidth(), getHeight());
+        if (!mEdgeGlowLeft.isFinished()) {
+            mEdgeGlowLeft.onPullDistance(0f, 1f - displacement);
+        }
+        if (!mEdgeGlowRight.isFinished()) {
+            mEdgeGlowRight.onPullDistance(0f, displacement);
+        }
     }
 
     public boolean isHandlingTouch() {
@@ -1053,7 +1017,6 @@
             mTotalMotion += Math.abs(mLastMotion - primaryDirection);
             mLastMotion = primaryDirection;
             mLastMotionRemainder = 0;
-            onScrollInteractionBegin();
             pageBeginTransition();
             // Stop listening for things like pinches.
             requestDisallowInterceptTouchEvent(true);
@@ -1114,69 +1077,6 @@
         }
     }
 
-    @Override
-    protected void dispatchDraw(Canvas canvas) {
-        if (mScroller.isSpringing() && mSpringOverScroll != 0) {
-            int saveCount = canvas.save();
-            mOrientationHandler.set(canvas, CANVAS_TRANSLATE, -mSpringOverScroll);
-            super.dispatchDraw(canvas);
-
-            canvas.restoreToCount(saveCount);
-        } else {
-            super.dispatchDraw(canvas);
-        }
-    }
-
-    /**
-     * Returns the amount of overscroll caused by the spring in {@link OverScroller}.
-     */
-    private int getSpringOverScroll(int amount) {
-        if (mScroller.isSpringing()) {
-            return amount < 0
-                    ? mScroller.getCurrPos() - mMinScroll
-                    : Math.max(0, mScroller.getCurrPos() - mMaxScroll);
-        } else {
-            return 0;
-        }
-    }
-
-    protected void dampedOverScroll(int amount) {
-        if (amount == 0) {
-            return;
-        }
-
-        int size = mOrientationHandler.getMeasuredSize(this);
-        int overScrollAmount = OverScroll.dampedScroll(amount, size);
-        if (mScroller.isSpringing()) {
-            mSpringOverScroll = getSpringOverScroll(amount);
-            invalidate();
-            return;
-        }
-
-        int primaryScroll = mOrientationHandler.getPrimaryScroll(this);
-        int boundedScroll = Utilities.boundToRange(primaryScroll, mMinScroll, mMaxScroll);
-        mOrientationHandler.delegateScrollTo(this, boundedScroll + overScrollAmount);
-        invalidate();
-    }
-
-    protected void overScroll(int amount) {
-        if (mScroller.isSpringing()) {
-            mSpringOverScroll = getSpringOverScroll(amount);
-            invalidate();
-            return;
-        }
-
-        if (amount == 0) return;
-
-        if (mFreeScroll && !mScroller.isFinished()) {
-            int scrollAmount = amount < 0 ? mMinScroll + amount : mMaxScroll + amount;
-            mOrientationHandler.delegateScrollTo(this, scrollAmount);
-        } else {
-            dampedOverScroll(amount);
-        }
-    }
-
-
     public void setEnableFreeScroll(boolean freeScroll) {
         if (mFreeScroll == freeScroll) {
             return;
@@ -1209,7 +1109,7 @@
 
         switch (action & MotionEvent.ACTION_MASK) {
         case MotionEvent.ACTION_DOWN:
-            updateIsBeingDraggedOnTouchDown();
+            updateIsBeingDraggedOnTouchDown(ev);
 
             /*
              * If being flinged and user touches, stop the fling. isFinished
@@ -1228,7 +1128,6 @@
             mAllowEasyFling = false;
             mActivePointerId = ev.getPointerId(0);
             if (mIsBeingDragged) {
-                onScrollInteractionBegin();
                 pageBeginTransition();
             }
             break;
@@ -1245,19 +1144,62 @@
                 final int pointerIndex = ev.findPointerIndex(mActivePointerId);
 
                 if (pointerIndex == -1) return true;
+                float oldScroll = mOrientationHandler.getPrimaryScroll(this);
+                float dx = ev.getX(pointerIndex);
+                float dy = ev.getY(pointerIndex);
 
-                float direction = mOrientationHandler.getPrimaryDirection(ev, pointerIndex);
+                float direction = mOrientationHandler.getPrimaryValue(dx, dy);
                 float delta = mLastMotion + mLastMotionRemainder - direction;
+
+                int width = getWidth();
+                int height = getHeight();
+                int size = mOrientationHandler.getPrimaryValue(width, height);
+
+                final float displacement = mOrientationHandler.getSecondaryValue(dx, dy)
+                        / mOrientationHandler.getSecondaryValue(width, height);
                 mTotalMotion += Math.abs(delta);
 
+                if (mAllowOverScroll) {
+                    float consumed = 0;
+                    if (delta < 0 && mEdgeGlowRight.getDistance() != 0f) {
+                        consumed = size * mEdgeGlowRight.onPullDistance(delta / size, displacement);
+                    } else if (delta > 0 && mEdgeGlowLeft.getDistance() != 0f) {
+                        consumed = -size * mEdgeGlowLeft.onPullDistance(
+                                -delta / size, 1 - displacement);
+                    }
+                    delta -= consumed;
+                }
+
                 // Only scroll and update mLastMotionX if we have moved some discrete amount.  We
                 // keep the remainder because we are actually testing if we've moved from the last
                 // scrolled position (which is discrete).
-                if (Math.abs(delta) >= 1.0f) {
-                    mLastMotion = direction;
-                    mLastMotionRemainder = delta - (int) delta;
+                mLastMotion = direction;
+                int movedDelta = (int) delta;
+                mLastMotionRemainder = delta - movedDelta;
 
-                    mOrientationHandler.set(this, VIEW_SCROLL_BY, (int) delta);
+                if (delta != 0) {
+                    mOrientationHandler.set(this, VIEW_SCROLL_BY, movedDelta);
+
+                    if (mAllowOverScroll) {
+                        final float pulledToX = oldScroll + delta;
+
+                        if (pulledToX < mMinScroll) {
+                            mEdgeGlowLeft.onPullDistance(-delta / size, 1.f - displacement);
+                            if (!mEdgeGlowRight.isFinished()) {
+                                mEdgeGlowRight.onRelease();
+                            }
+                        } else if (pulledToX > mMaxScroll) {
+                            mEdgeGlowRight.onPullDistance(delta / size, displacement);
+                            if (!mEdgeGlowLeft.isFinished()) {
+                                mEdgeGlowLeft.onRelease();
+                            }
+                        }
+
+                        if (!mEdgeGlowLeft.isFinished() || !mEdgeGlowRight.isFinished()) {
+                            postInvalidateOnAnimation();
+                        }
+                    }
+
                 } else {
                     awakenScrollBars();
                 }
@@ -1335,45 +1277,24 @@
 
                     if (((initialScroll >= maxScroll) && (isVelocityLeft || !isFling)) ||
                         ((initialScroll <= minScroll) && (!isVelocityLeft || !isFling))) {
-                        mScroller.springBack(initialScroll, minScroll, maxScroll);
+                        mScroller.springBack(initialScroll, 0, minScroll, maxScroll, 0, 0);
                         mNextPage = getDestinationPage();
                     } else {
-                        mScroller.setInterpolator(mDefaultInterpolator);
-                        mScroller.fling(initialScroll, -velocity,
-                            minScroll, maxScroll,
-                            Math.round(getWidth() * 0.5f * OVERSCROLL_DAMP_FACTOR));
+                        int velocity1 = -velocity;
+                        // Continue a scroll or fling in progress
+                        mScroller.fling(initialScroll, 0, velocity1, 0, minScroll, maxScroll, 0, 0,
+                                Math.round(getWidth() * 0.5f * OVERSCROLL_DAMP_FACTOR), 0);
 
-                        int finalPos = mScroller.getFinalPos();
+                        int finalPos = mScroller.getFinalX();
                         mNextPage = getDestinationPage(finalPos);
-
-                        int firstPageScroll = getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1);
-                        int lastPageScroll = getScrollForPage(!mIsRtl ? getPageCount() - 1 : 0);
-                        if (snapToPageInFreeScroll() && finalPos > minScroll
-                                && finalPos < maxScroll) {
-                            // If scrolling ends in the half of the added space that is closer to
-                            // the end, settle to the end. Otherwise snap to the nearest page.
-                            // If flinging past one of the ends, don't change the velocity as it
-                            // will get stopped at the end anyway.
-                            int pageSnapped = finalPos < (firstPageScroll + minScroll) / 2
-                                ? minScroll
-                                : finalPos > (lastPageScroll + maxScroll) / 2
-                                    ? maxScroll
-                                    : getScrollForPage(mNextPage);
-
-                            mScroller.setFinalPos(pageSnapped);
-                            // Ensure the scroll/snap doesn't happen too fast;
-                            int extraScrollDuration = OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION
-                                - mScroller.getDuration();
-                            if (extraScrollDuration > 0) {
-                                mScroller.extendDuration(extraScrollDuration);
-                            }
-                        }
+                        onNotSnappingToPageInFreeScroll();
                     }
                     invalidate();
                 }
-                onScrollInteractionEnd();
             }
 
+            mEdgeGlowLeft.onRelease();
+            mEdgeGlowRight.onRelease();
             // End any intermediate reordering states
             resetTouchState();
             break;
@@ -1381,8 +1302,9 @@
         case MotionEvent.ACTION_CANCEL:
             if (mIsBeingDragged) {
                 snapToDestination();
-                onScrollInteractionEnd();
             }
+            mEdgeGlowLeft.onRelease();
+            mEdgeGlowRight.onRelease();
             resetTouchState();
             break;
 
@@ -1395,9 +1317,7 @@
         return true;
     }
 
-    protected boolean snapToPageInFreeScroll() {
-        return true;
-    }
+    protected void onNotSnappingToPageInFreeScroll() { }
 
     protected boolean shouldFlingForVelocity(int velocity) {
         float threshold = mAllowEasyFling ? mEasyFlingThresholdVelocity : mFlingThresholdVelocity;
@@ -1410,15 +1330,6 @@
         mActivePointerId = INVALID_POINTER;
     }
 
-    /**
-     * Triggered by scrolling via touch
-     */
-    protected void onScrollInteractionBegin() {
-    }
-
-    protected void onScrollInteractionEnd() {
-    }
-
     @Override
     public boolean onGenericMotionEvent(MotionEvent event) {
         if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
@@ -1554,19 +1465,7 @@
     }
 
     protected void snapToDestination() {
-        snapToPage(getDestinationPage(), getPageSnapDuration());
-    }
-
-    protected boolean isInOverScroll() {
-        int scroll = mOrientationHandler.getPrimaryScroll(this);
-        return scroll > mMaxScroll || scroll < mMinScroll;
-    }
-
-    protected int getPageSnapDuration() {
-        if (isInOverScroll()) {
-            return OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION;
-        }
-        return PAGE_SNAP_ANIMATION_DURATION;
+        snapToPage(getDestinationPage(), PAGE_SNAP_ANIMATION_DURATION);
     }
 
     // We want the duration of the page snap animation to be influenced by the distance that
@@ -1584,7 +1483,7 @@
         int halfScreenSize = mOrientationHandler.getMeasuredSize(this) / 2;
 
         final int newLoc = getScrollForPage(whichPage);
-        int delta = newLoc - getUnboundedScroll();
+        int delta = newLoc - mOrientationHandler.getPrimaryScroll(this);
         int duration = 0;
 
         if (Math.abs(velocity) < mMinFlingVelocity) {
@@ -1609,12 +1508,7 @@
         // interpolator at zero, ie. 5. We use 4 to make it a little slower.
         duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
 
-        if (QUICKSTEP_SPRINGS.get() && mCurrentPage != whichPage) {
-            return snapToPage(whichPage, delta, duration, false, null,
-                    velocity * Math.signum(delta), true);
-        } else {
-            return snapToPage(whichPage, delta, duration);
-        }
+        return snapToPage(whichPage, delta, duration);
     }
 
     public boolean snapToPage(int whichPage) {
@@ -1622,32 +1516,26 @@
     }
 
     public boolean snapToPageImmediately(int whichPage) {
-        return snapToPage(whichPage, PAGE_SNAP_ANIMATION_DURATION, true, null);
+        return snapToPage(whichPage, PAGE_SNAP_ANIMATION_DURATION, true);
     }
 
     public boolean snapToPage(int whichPage, int duration) {
-        return snapToPage(whichPage, duration, false, null);
+        return snapToPage(whichPage, duration, false);
     }
 
-    public boolean snapToPage(int whichPage, int duration, TimeInterpolator interpolator) {
-        return snapToPage(whichPage, duration, false, interpolator);
-    }
-
-    protected boolean snapToPage(int whichPage, int duration, boolean immediate,
-            TimeInterpolator interpolator) {
+    protected boolean snapToPage(int whichPage, int duration, boolean immediate) {
         whichPage = validateNewPage(whichPage);
 
         int newLoc = getScrollForPage(whichPage);
-        final int delta = newLoc - getUnboundedScroll();
-        return snapToPage(whichPage, delta, duration, immediate, interpolator, 0, false);
+        final int delta = newLoc - mOrientationHandler.getPrimaryScroll(this);
+        return snapToPage(whichPage, delta, duration, immediate);
     }
 
     protected boolean snapToPage(int whichPage, int delta, int duration) {
-        return snapToPage(whichPage, delta, duration, false, null, 0, false);
+        return snapToPage(whichPage, delta, duration, false);
     }
 
-    protected boolean snapToPage(int whichPage, int delta, int duration, boolean immediate,
-            TimeInterpolator interpolator, float velocity, boolean spring) {
+    protected boolean snapToPage(int whichPage, int delta, int duration, boolean immediate) {
         if (mFirstLayout) {
             setCurrentPage(whichPage);
             return false;
@@ -1677,18 +1565,7 @@
             abortScrollerAnimation(false);
         }
 
-        if (interpolator != null) {
-            mScroller.setInterpolator(interpolator);
-        } else {
-            mScroller.setInterpolator(mDefaultInterpolator);
-        }
-
-        if (spring && QUICKSTEP_SPRINGS.get()) {
-            mScroller.startScrollSpring(getUnboundedScroll(), delta, duration, velocity);
-        } else {
-            mScroller.startScroll(getUnboundedScroll(), delta, duration);
-        }
-
+        mScroller.startScroll(mOrientationHandler.getPrimaryScroll(this), 0, delta, 0, duration);
         updatePageIndicator();
 
         // Trigger a compute() to finish switching pages if necessary
@@ -1706,7 +1583,7 @@
             snapToPage(getNextPage() - 1);
             return true;
         }
-        return onOverscroll(-getMeasuredWidth());
+        return mAllowOverScroll;
     }
 
     public boolean scrollRight() {
@@ -1714,15 +1591,7 @@
             snapToPage(getNextPage() + 1);
             return true;
         }
-        return onOverscroll(getMeasuredWidth());
-    }
-
-    protected boolean onOverscroll(int amount) {
-        if (!mAllowOverScroll) return false;
-        onScrollInteractionBegin();
-        overScroll(amount);
-        onScrollInteractionEnd();
-        return true;
+        return mAllowOverScroll;
     }
 
     @Override
@@ -1866,4 +1735,38 @@
         mTmpIntPair[1] = rightChild;
         return mTmpIntPair;
     }
+
+    @Override
+    public void draw(Canvas canvas) {
+        super.draw(canvas);
+        drawEdgeEffect(canvas);
+    }
+
+    protected void drawEdgeEffect(Canvas canvas) {
+        if (mAllowOverScroll && (!mEdgeGlowRight.isFinished() || !mEdgeGlowLeft.isFinished())) {
+            final int width = getWidth();
+            final int height = getHeight();
+            if (!mEdgeGlowLeft.isFinished()) {
+                final int restoreCount = canvas.save();
+                canvas.rotate(-90);
+                canvas.translate(-height, Math.min(mMinScroll, getScrollX()));
+                mEdgeGlowLeft.setSize(height, width);
+                if (mEdgeGlowLeft.draw(canvas)) {
+                    postInvalidateOnAnimation();
+                }
+                canvas.restoreToCount(restoreCount);
+            }
+            if (!mEdgeGlowRight.isFinished()) {
+                final int restoreCount = canvas.save();
+                canvas.rotate(90, width, 0);
+                canvas.translate(width, -(Math.max(mMaxScroll, getScrollX())));
+
+                mEdgeGlowRight.setSize(height, width);
+                if (mEdgeGlowRight.draw(canvas)) {
+                    postInvalidateOnAnimation();
+                }
+                canvas.restoreToCount(restoreCount);
+            }
+        }
+    }
 }
diff --git a/src/com/android/launcher3/SessionCommitReceiver.java b/src/com/android/launcher3/SessionCommitReceiver.java
index 5036104..fe58da9 100644
--- a/src/com/android/launcher3/SessionCommitReceiver.java
+++ b/src/com/android/launcher3/SessionCommitReceiver.java
@@ -71,7 +71,7 @@
             return;
         }
 
-        Log.i(LOG,
+        Log.d(LOG,
                 "Adding package name to install queue. Package name: " + info.getAppPackageName()
                         + ", has app icon: " + (info.getAppIcon() != null)
                         + ", has app label: " + !TextUtils.isEmpty(info.getAppLabel()));
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 10091a1..0c3a356 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -24,7 +24,6 @@
 import static com.android.launcher3.LauncherState.FLAG_WORKSPACE_INACCESSIBLE;
 import static com.android.launcher3.LauncherState.HINT_STATE;
 import static com.android.launcher3.LauncherState.NORMAL;
-import static com.android.launcher3.LauncherState.OVERVIEW;
 import static com.android.launcher3.LauncherState.SPRING_LOADED;
 import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
 import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_OVERLAY;
@@ -96,10 +95,12 @@
 import com.android.launcher3.statemanager.StateManager.StateHandler;
 import com.android.launcher3.states.StateAnimationConfig;
 import com.android.launcher3.touch.WorkspaceTouchListener;
+import com.android.launcher3.util.EdgeEffectCompat;
 import com.android.launcher3.util.Executors;
 import com.android.launcher3.util.IntArray;
 import com.android.launcher3.util.IntSparseArrayMap;
 import com.android.launcher3.util.ItemInfoMatcher;
+import com.android.launcher3.util.OverlayEdgeEffect;
 import com.android.launcher3.util.PackageUserKey;
 import com.android.launcher3.util.Thunk;
 import com.android.launcher3.util.WallpaperOffsetInterpolator;
@@ -245,10 +246,7 @@
     private float mTransitionProgress;
 
     // State related to Launcher Overlay
-    LauncherOverlay mLauncherOverlay;
-    boolean mScrollInteractionBegan;
-    boolean mStartedSendingScrollEvents;
-    float mLastOverlayScroll = 0;
+    private OverlayEdgeEffect mOverlayEdgeEffect;
     boolean mOverlayShown = false;
     private Runnable mOnOverlayHiddenCallback;
 
@@ -945,47 +943,25 @@
         }
     }
 
-    protected void onScrollInteractionBegin() {
-        super.onScrollInteractionBegin();
-        mScrollInteractionBegan = true;
-    }
-
-    protected void onScrollInteractionEnd() {
-        super.onScrollInteractionEnd();
-        mScrollInteractionBegan = false;
-        if (mStartedSendingScrollEvents) {
-            mStartedSendingScrollEvents = false;
-            mLauncherOverlay.onScrollInteractionEnd();
-        }
-    }
-
     public void setLauncherOverlay(LauncherOverlay overlay) {
-        mLauncherOverlay = overlay;
-        // A new overlay has been set. Reset event tracking
-        mStartedSendingScrollEvents = false;
+        mOverlayEdgeEffect = overlay == null ? null : new OverlayEdgeEffect(getContext(), overlay);
+        EdgeEffectCompat newEffect = overlay == null
+                ? new EdgeEffectCompat(getContext()) : mOverlayEdgeEffect;
+        if (mIsRtl) {
+            mEdgeGlowRight = newEffect;
+        } else {
+            mEdgeGlowLeft = newEffect;
+        }
         onOverlayScrollChanged(0);
     }
 
     public boolean hasOverlay() {
-        return mLauncherOverlay != null;
-    }
-
-    private boolean isScrollingOverlay() {
-        return mLauncherOverlay != null &&
-                ((mIsRtl && getUnboundedScroll() > mMaxScroll)
-                        || (!mIsRtl && getUnboundedScroll() < mMinScroll));
+        return mOverlayEdgeEffect != null;
     }
 
     @Override
     protected void snapToDestination() {
-        // If we're overscrolling the overlay, we make sure to immediately reset the PagedView
-        // to it's baseline position instead of letting the overscroll settle. The overlay handles
-        // it's own settling, and every gesture to the overlay should be self-contained and start
-        // from 0, so we zero it out here.
-        if (isScrollingOverlay()) {
-            // We reset mWasInOverscroll so that PagedView doesn't zero out the overscroll
-            // interaction when we call snapToPageImmediately.
-            mWasInOverscroll = false;
+        if (mOverlayEdgeEffect != null && !mOverlayEdgeEffect.isFinished()) {
             snapToPageImmediately(0);
         } else {
             super.snapToDestination();
@@ -1018,38 +994,6 @@
     }
 
     @Override
-    protected void overScroll(int amount) {
-        boolean shouldScrollOverlay = mLauncherOverlay != null && !mScroller.isSpringing() &&
-                ((amount <= 0 && !mIsRtl) || (amount >= 0 && mIsRtl));
-
-        boolean shouldZeroOverlay = mLauncherOverlay != null && mLastOverlayScroll != 0 &&
-                ((amount >= 0 && !mIsRtl) || (amount <= 0 && mIsRtl));
-
-        if (shouldScrollOverlay) {
-            if (!mStartedSendingScrollEvents && mScrollInteractionBegan) {
-                mStartedSendingScrollEvents = true;
-                mLauncherOverlay.onScrollInteractionBegin();
-            }
-
-            mLastOverlayScroll = Math.abs(((float) amount) / getMeasuredWidth());
-            mLauncherOverlay.onScrollChange(mLastOverlayScroll, mIsRtl);
-        } else {
-            dampedOverScroll(amount);
-        }
-
-        if (shouldZeroOverlay) {
-            mLauncherOverlay.onScrollChange(0, mIsRtl);
-        }
-    }
-
-    @Override
-    protected boolean onOverscroll(int amount) {
-        // Enforce overscroll on -1 direction
-        if ((amount > 0 && !mIsRtl) || (amount < 0 && mIsRtl)) return false;
-        return super.onOverscroll(amount);
-    }
-
-    @Override
     protected boolean shouldFlingForVelocity(int velocityX) {
         // When the overlay is moving, the fling or settle transition is controlled by the overlay.
         return Float.compare(Math.abs(mOverlayTranslation), 0) == 0 &&
@@ -1377,10 +1321,6 @@
         mOutlineProvider = outlineProvider;
     }
 
-    public void snapToPageFromOverView(int whichPage) {
-        snapToPage(whichPage, OVERVIEW.getTransitionDuration(mLauncher), Interpolators.ZOOM_IN);
-    }
-
     private void onStartStateTransition(LauncherState state) {
         mIsSwitchingState = true;
         mTransitionProgress = 0;
@@ -2999,20 +2939,30 @@
      * Similar to {@link #getFirstMatch} but optimized to finding a suitable view for the app close
      * animation.
      *
+     * @param preferredItemId The id of the preferred item to match to if it exists.
      * @param packageName The package name of the app to match.
      * @param user The user of the app to match.
      */
-    public View getFirstMatchForAppClose(String packageName, UserHandle user) {
-        List<CellLayout> cellLayouts = new ArrayList<>(getPanelCount() + 1);
-        cellLayouts.add(getHotseat());
-        getVisiblePages().forEach(page -> cellLayouts.add((CellLayout) page));
-
-        final Workspace.ItemOperator packageAndUser = (ItemInfo info, View view) -> info != null
-                && info.getTargetComponent() != null
-                && TextUtils.equals(info.getTargetComponent().getPackageName(), packageName)
-                && info.user.equals(user);
+    public View getFirstMatchForAppClose(int preferredItemId, String packageName, UserHandle user) {
+        final Workspace.ItemOperator preferredItem = (ItemInfo info, View view) ->
+                info != null && info.id == preferredItemId;
+        final Workspace.ItemOperator preferredItemInFolder = (info, view) -> {
+            if (info instanceof FolderInfo) {
+                FolderInfo folderInfo = (FolderInfo) info;
+                for (WorkspaceItemInfo shortcutInfo : folderInfo.contents) {
+                    if (preferredItem.evaluate(shortcutInfo, view)) {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        };
         final Workspace.ItemOperator packageAndUserAndApp = (ItemInfo info, View view) ->
-                packageAndUser.evaluate(info, view) && info.itemType == ITEM_TYPE_APPLICATION;
+                info != null
+                        && info.getTargetComponent() != null
+                        && TextUtils.equals(info.getTargetComponent().getPackageName(), packageName)
+                        && info.user.equals(user)
+                        && info.itemType == ITEM_TYPE_APPLICATION;
         final Workspace.ItemOperator packageAndUserAndAppInFolder = (info, view) -> {
             if (info instanceof FolderInfo) {
                 FolderInfo folderInfo = (FolderInfo) info;
@@ -3025,13 +2975,18 @@
             return false;
         };
 
+        List<CellLayout> cellLayouts = new ArrayList<>(getPanelCount() + 1);
+        cellLayouts.add(getHotseat());
+        getVisiblePages().forEach(page -> cellLayouts.add((CellLayout) page));
+
         // Order: App icons, app in folder. Items in hotseat get returned first.
         if (ADAPTIVE_ICON_WINDOW_ANIM.get()) {
-            return getFirstMatch(cellLayouts, packageAndUserAndApp, packageAndUserAndAppInFolder);
+            return getFirstMatch(cellLayouts, preferredItem, preferredItemInFolder,
+                    packageAndUserAndApp, packageAndUserAndAppInFolder);
         } else {
             // Do not use Folder as a criteria, since it'll cause a crash when trying to draw
             // FolderAdaptiveIcon as the background.
-            return getFirstMatch(cellLayouts, packageAndUserAndApp);
+            return getFirstMatch(cellLayouts, preferredItem, packageAndUserAndApp);
         }
     }
 
@@ -3323,6 +3278,18 @@
         }
     }
 
+    /**
+     * Set the given view's pivot point to match the workspace's, so that it scales together. Since
+     * both this view and workspace can move, transform the point manually instead of using
+     * dragLayer.getDescendantCoordRelativeToSelf and related methods.
+     */
+    public void setPivotToScaleWithSelf(View sibling) {
+        sibling.setPivotY(getPivotY() + getTop()
+                - sibling.getTop() - sibling.getTranslationY());
+        sibling.setPivotX(getPivotX() + getLeft()
+                - sibling.getLeft() - sibling.getTranslationX());
+    }
+
     @Override
     public int getExpectedHeight() {
         return getMeasuredHeight() <= 0 || !mIsLayoutValid
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index f4986f4..ed854dc 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -119,7 +119,7 @@
             propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, scaleInterpolator);
         }
 
-        setPivotToScaleWithWorkspace(hotseat);
+        mWorkspace.setPivotToScaleWithSelf(hotseat);
         float hotseatScale = hotseatScaleAndTranslation.scale;
         if (shouldSpring) {
             PendingAnimation pa = (PendingAnimation) propertySetter;
@@ -156,18 +156,6 @@
         }
     }
 
-    /**
-     * Set the given view's pivot point to match the workspace's, so that it scales together. Since
-     * both this view and workspace can move, transform the point manually instead of using
-     * dragLayer.getDescendantCoordRelativeToSelf and related methods.
-     */
-    private void setPivotToScaleWithWorkspace(View sibling) {
-        sibling.setPivotY(mWorkspace.getPivotY() + mWorkspace.getTop()
-                - sibling.getTop() - sibling.getTranslationY());
-        sibling.setPivotX(mWorkspace.getPivotX() + mWorkspace.getLeft()
-                - sibling.getLeft() - sibling.getTranslationX());
-    }
-
     public void setScrim(PropertySetter propertySetter, LauncherState state,
             StateAnimationConfig config) {
         Scrim workspaceDragScrim = mLauncher.getDragLayer().getWorkspaceDragScrim();
diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java
index 7a38937..11e831e 100644
--- a/src/com/android/launcher3/anim/Interpolators.java
+++ b/src/com/android/launcher3/anim/Interpolators.java
@@ -27,7 +27,6 @@
 
 import com.android.launcher3.Utilities;
 
-
 /**
  * Common interpolators used in Launcher
  */
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 44e3138..7d5ed60 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -199,10 +199,6 @@
             "EXPANDED_SMARTSPACE", false, "Expands smartspace height to two rows. "
               + "Any apps occupying the first row will be removed from workspace.");
 
-    public static final DeviceFlag ENABLE_FOUR_COLUMNS = new DeviceFlag(
-            "ENABLE_FOUR_COLUMNS", false, "Uses 4 columns in launcher grid."
-            + "Warning: This will permanently alter your home screen items and is not reversible.");
-
     // TODO: b/172467144 Remove ENABLE_LAUNCHER_ACTIVITY_THEME_CROSSFADE feature flag.
     public static final BooleanFlag ENABLE_LAUNCHER_ACTIVITY_THEME_CROSSFADE = new DeviceFlag(
             "ENABLE_LAUNCHER_ACTIVITY_THEME_CROSSFADE", false, "Enables a "
@@ -233,6 +229,9 @@
     public static final BooleanFlag NOTIFY_CRASHES = getDebugFlag("NOTIFY_CRASHES", false,
             "Sends a notification whenever launcher encounters an uncaught exception.");
 
+    public static final BooleanFlag PROTOTYPE_APP_CLOSE = getDebugFlag(
+            "PROTOTYPE_APP_CLOSE", false, "Enables new app close");
+
     public static void initialize(Context context) {
         synchronized (sDebugFlags) {
             for (DebugFlag flag : sDebugFlags) {
@@ -242,12 +241,6 @@
         }
     }
 
-    public static void removeFlag(DebugFlag flag) {
-        synchronized (sDebugFlags) {
-            sDebugFlags.remove(flag);
-        }
-    }
-
     static List<DebugFlag> getDebugFlags() {
         synchronized (sDebugFlags) {
             return new ArrayList<>(sDebugFlags);
@@ -325,15 +318,6 @@
                     .getBoolean(key, defaultValue);
         }
 
-        /**
-         * Resets value to default value.
-         */
-        public void reset(Context context) {
-            mCurrentValue = defaultValue;
-            context.getSharedPreferences(FLAGS_PREF_NAME, Context.MODE_PRIVATE)
-                    .edit().putBoolean(key, defaultValue).apply();
-        }
-
         @Override
         protected StringBuilder appendProps(StringBuilder src) {
             return super.appendProps(src).append(", mCurrentValue=").append(mCurrentValue);
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index c1f4643..a4e8be6 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -42,7 +42,6 @@
 import com.android.launcher3.ShortcutAndWidgetContainer;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.Workspace.ItemOperator;
-import com.android.launcher3.anim.Interpolators;
 import com.android.launcher3.keyboard.ViewGroupFocusHelper;
 import com.android.launcher3.model.data.ItemInfo;
 import com.android.launcher3.model.data.WorkspaceItemInfo;
@@ -433,8 +432,7 @@
         int scroll = getScrollForPage(getNextPage()) + hint;
         int delta = scroll - getScrollX();
         if (delta != 0) {
-            mScroller.setInterpolator(Interpolators.DEACCEL);
-            mScroller.startScroll(getScrollX(), delta, Folder.SCROLL_HINT_DURATION);
+            mScroller.startScroll(getScrollX(), 0, delta, 0, Folder.SCROLL_HINT_DURATION);
             invalidate();
         }
     }
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
index fd51ba8..29287d9 100644
--- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
+++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
@@ -32,11 +32,13 @@
 import com.android.launcher3.model.data.AppInfo;
 import com.android.launcher3.model.data.FolderInfo;
 import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.model.data.ItemInfoWithIcon;
 import com.android.launcher3.model.data.LauncherAppWidgetInfo;
 import com.android.launcher3.model.data.WorkspaceItemInfo;
 import com.android.launcher3.pm.InstallSessionHelper;
 import com.android.launcher3.pm.PackageInstallInfo;
 import com.android.launcher3.util.GridOccupancy;
+import com.android.launcher3.util.IOUtils;
 import com.android.launcher3.util.IntArray;
 import com.android.launcher3.util.PackageManagerHelper;
 
@@ -126,6 +128,12 @@
                     }
                     SessionInfo sessionInfo = packageInstaller.getActiveSessionInfo(item.user,
                             packageName);
+
+                    if (!packageInstaller.verifySessionInfo(sessionInfo)) {
+                        Log.d(LOG, "Item info failed session info verification: "
+                                + workspaceInfo);
+                    }
+
                     List<LauncherActivityInfo> activities = launcherApps
                             .getActivityList(packageName, item.user);
                     boolean hasActivity = activities != null && !activities.isEmpty();
@@ -171,7 +179,15 @@
                 // Save the WorkspaceItemInfo for binding in the workspace
                 addedItemsFinal.add(itemInfo);
 
-                Log.i(LOG, "Adding item info to workspace: " + itemInfo);
+                // log bitmap and label
+                Log.d(LOG, "Adding item info to workspace: " + itemInfo);
+                if (itemInfo instanceof ItemInfoWithIcon) {
+                    ItemInfoWithIcon infoWithIcon = (ItemInfoWithIcon) itemInfo;
+
+                    Log.d(LOG, "Item info icon base 64 string: "
+                            + infoWithIcon.bitmap.icon == null
+                            ? "null" : IOUtils.toBase64String(infoWithIcon.bitmap.icon));
+                }
             }
         }
 
diff --git a/src/com/android/launcher3/model/ItemInstallQueue.java b/src/com/android/launcher3/model/ItemInstallQueue.java
index 836d804..22cb46b 100644
--- a/src/com/android/launcher3/model/ItemInstallQueue.java
+++ b/src/com/android/launcher3/model/ItemInstallQueue.java
@@ -130,6 +130,7 @@
 
         // Add the items and clear queue
         if (!installQueue.isEmpty()) {
+            // add log
             launcher.getModel().addAndBindAddedWorkspaceItems(installQueue);
         }
         mItems.clear();
@@ -184,14 +185,20 @@
     }
 
     private void queuePendingShortcutInfo(PendingInstallShortcutInfo info) {
+        final Exception stackTrace = new Exception();
+
         // Queue the item up for adding if launcher has not loaded properly yet
         MODEL_EXECUTOR.post(() -> {
             Pair<ItemInfo, Object> itemInfo = info.getItemInfo(mContext);
             if (itemInfo == null) {
-                Log.i(LOG, "Adding PendingInstallShortcutInfo with no attached info to queue.");
+                Log.d(LOG,
+                        "Adding PendingInstallShortcutInfo with no attached info to queue.",
+                        stackTrace);
             } else {
-                Log.i(LOG, "Adding PendingInstallShortcutInfo to queue. Attached info: "
-                        + itemInfo.first);
+                Log.d(LOG,
+                        "Adding PendingInstallShortcutInfo to queue. Attached info: "
+                                + itemInfo.first,
+                        stackTrace);
             }
 
             addToQueue(info);
diff --git a/src/com/android/launcher3/pm/InstallSessionHelper.java b/src/com/android/launcher3/pm/InstallSessionHelper.java
index 72f1c58..88db430 100644
--- a/src/com/android/launcher3/pm/InstallSessionHelper.java
+++ b/src/com/android/launcher3/pm/InstallSessionHelper.java
@@ -25,6 +25,7 @@
 import android.content.pm.PackageInstaller;
 import android.content.pm.PackageInstaller.SessionInfo;
 import android.content.pm.PackageManager;
+import android.graphics.Bitmap;
 import android.os.Build;
 import android.os.Process;
 import android.os.UserHandle;
@@ -40,6 +41,7 @@
 import com.android.launcher3.Utilities;
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.model.ItemInstallQueue;
+import com.android.launcher3.util.IOUtils;
 import com.android.launcher3.util.IntArray;
 import com.android.launcher3.util.IntSet;
 import com.android.launcher3.util.MainThreadInitializedObject;
@@ -215,14 +217,8 @@
     void tryQueuePromiseAppIcon(PackageInstaller.SessionInfo sessionInfo) {
         if (FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
                 && SessionCommitReceiver.isEnabled(mAppContext)
-                && verify(sessionInfo) != null
-                && sessionInfo.getInstallReason() == PackageManager.INSTALL_REASON_USER
-                && sessionInfo.getAppIcon() != null
-                && !TextUtils.isEmpty(sessionInfo.getAppLabel())
-                && !promiseIconAddedForId(sessionInfo.getSessionId())
-                && !new PackageManagerHelper(mAppContext).isAppInstalled(
-                        sessionInfo.getAppPackageName(), getUserHandle(sessionInfo))) {
-            Log.i(LOG, "Adding package name to install queue: "
+                && verifySessionInfo(sessionInfo)) {
+            Log.d(LOG, "Adding package name to install queue: "
                     + sessionInfo.getAppPackageName());
 
             ItemInstallQueue.INSTANCE.get(mAppContext)
@@ -233,6 +229,37 @@
         }
     }
 
+    public boolean verifySessionInfo(PackageInstaller.SessionInfo sessionInfo) {
+        boolean validSessionInfo = verify(sessionInfo) != null
+                && sessionInfo.getInstallReason() == PackageManager.INSTALL_REASON_USER
+                && sessionInfo.getAppIcon() != null
+                && !TextUtils.isEmpty(sessionInfo.getAppLabel())
+                && !promiseIconAddedForId(sessionInfo.getSessionId())
+                && !new PackageManagerHelper(mAppContext).isAppInstalled(
+                        sessionInfo.getAppPackageName(), getUserHandle(sessionInfo));
+
+        if (sessionInfo != null) {
+            Bitmap appIcon = sessionInfo.getAppIcon();
+
+            Log.d(LOG, String.format(
+                    "Verifying session info. Valid: %b, Session verified: %b, Install reason valid:"
+                            + " %b, App icon: %s, App label: %s, Promise icon added: %b, "
+                            + "App installed: %b.",
+                    validSessionInfo,
+                    verify(sessionInfo) != null,
+                    sessionInfo.getInstallReason() == PackageManager.INSTALL_REASON_USER,
+                    appIcon == null ? "null" : IOUtils.toBase64String(appIcon),
+                    sessionInfo.getAppLabel(),
+                    promiseIconAddedForId(sessionInfo.getSessionId()),
+                    new PackageManagerHelper(mAppContext).isAppInstalled(
+                            sessionInfo.getAppPackageName(), getUserHandle(sessionInfo))));
+        } else {
+            Log.d(LOG, "Verifying session info failed: session info null.");
+        }
+
+        return validSessionInfo;
+    }
+
     public InstallSessionTracker registerInstallTracker(InstallSessionTracker.Callback callback) {
         InstallSessionTracker tracker = new InstallSessionTracker(this, callback);
 
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index 2e54904..ce7dc07 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -180,7 +180,7 @@
                 LauncherApps launcherApps = launcher.getSystemService(LauncherApps.class);
                 try {
                     launcherApps.startPackageInstallerSessionDetailsActivity(sessionInfo, null,
-                            launcher.getActivityLaunchOptions(v).toBundle());
+                            launcher.getActivityLaunchOptions(v, item).toBundle());
                     return;
                 } catch (Exception e) {
                     Log.e(TAG, "Unable to launch market intent for package=" + packageName, e);
diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
index 18e27a4..2254ab3 100644
--- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
@@ -38,10 +38,8 @@
 import android.widget.LinearLayout;
 
 import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.PagedView;
 import com.android.launcher3.R;
 import com.android.launcher3.Utilities;
-import com.android.launcher3.util.OverScroller;
 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
 
 import java.util.Collections;
@@ -60,18 +58,23 @@
     }
 
     @Override
-    public void delegateScrollTo(PagedView pagedView, int secondaryScroll, int minMaxScroll) {
-        pagedView.superScrollTo(secondaryScroll, minMaxScroll);
+    public int getPrimaryValue(int x, int y) {
+        return y;
     }
 
     @Override
-    public void delegateScrollBy(PagedView pagedView, int unboundedScroll, int x, int y) {
-        pagedView.scrollTo(pagedView.getScrollX() + x, unboundedScroll + y);
+    public int getSecondaryValue(int x, int y) {
+        return x;
     }
 
     @Override
-    public void scrollerStartScroll(OverScroller scroller, int newPosition) {
-        scroller.startScroll(scroller.getCurrPos(), newPosition - scroller.getCurrPos());
+    public float getPrimaryValue(float x, float y) {
+        return y;
+    }
+
+    @Override
+    public float getSecondaryValue(float x, float y) {
+        return x;
     }
 
     @Override
@@ -87,11 +90,6 @@
     }
 
     @Override
-    public void delegateScrollTo(PagedView pagedView, int primaryScroll) {
-        pagedView.superScrollTo(pagedView.getScrollX(), primaryScroll);
-    }
-
-    @Override
     public <T> void set(T target, Int2DAction<T> action, int param) {
         action.call(target, 0, param);
     }
@@ -241,13 +239,13 @@
     }
 
     @Override
-    public float getTaskMenuX(float x, View thumbnailView) {
+    public float getTaskMenuX(float x, View thumbnailView, int overScroll) {
         return thumbnailView.getMeasuredWidth() + x;
     }
 
     @Override
-    public float getTaskMenuY(float y, View thumbnailView) {
-        return y;
+    public float getTaskMenuY(float y, View thumbnailView, int overScroll) {
+        return y + overScroll;
     }
 
     @Override
diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java
index 560df86..c9149ff 100644
--- a/src/com/android/launcher3/touch/PagedOrientationHandler.java
+++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java
@@ -30,8 +30,6 @@
 import android.widget.LinearLayout;
 
 import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.PagedView;
-import com.android.launcher3.util.OverScroller;
 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
 import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
 
@@ -89,16 +87,19 @@
     boolean getRecentsRtlSetting(Resources resources);
     float getDegreesRotated();
     int getRotation();
+
     <T> T getPrimaryValue(T x, T y);
     <T> T getSecondaryValue(T x, T y);
-    void delegateScrollTo(PagedView pagedView, int secondaryScroll, int primaryScroll);
-    /** Uses {@params pagedView}.getScroll[X|Y]() method for the secondary amount*/
-    void delegateScrollTo(PagedView pagedView, int primaryScroll);
-    void delegateScrollBy(PagedView pagedView, int unboundedScroll, int x, int y);
-    void scrollerStartScroll(OverScroller scroller, int newPosition);
+
+    int getPrimaryValue(int x, int y);
+    int getSecondaryValue(int x, int y);
+
+    float  getPrimaryValue(float x, float y);
+    float getSecondaryValue(float x, float y);
+
     boolean isLayoutNaturalToLauncher();
-    float getTaskMenuX(float x, View thumbnailView);
-    float getTaskMenuY(float y, View thumbnailView);
+    float getTaskMenuX(float x, View thumbnailView, int overScroll);
+    float getTaskMenuY(float y, View thumbnailView, int overScroll);
     int getTaskMenuWidth(View view);
     int getTaskMenuLayoutOrientation(boolean canRecentsActivityRotate, LinearLayout taskMenuLayout);
     void setLayoutParamsForTaskMenuOptionItem(LinearLayout.LayoutParams lp);
diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
index 86508c4..31586e7 100644
--- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
+++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
@@ -36,10 +36,8 @@
 import android.widget.LinearLayout;
 
 import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.PagedView;
 import com.android.launcher3.R;
 import com.android.launcher3.Utilities;
-import com.android.launcher3.util.OverScroller;
 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
 
 import java.util.ArrayList;
@@ -58,18 +56,23 @@
     }
 
     @Override
-    public void delegateScrollTo(PagedView pagedView, int secondaryScroll, int primaryScroll) {
-        pagedView.superScrollTo(primaryScroll, secondaryScroll);
+    public int getPrimaryValue(int x, int y) {
+        return x;
     }
 
     @Override
-    public void delegateScrollBy(PagedView pagedView, int unboundedScroll, int x, int y) {
-        pagedView.scrollTo(unboundedScroll + x, pagedView.getScrollY() + y);
+    public int getSecondaryValue(int x, int y) {
+        return y;
     }
 
     @Override
-    public void scrollerStartScroll(OverScroller scroller, int newPosition) {
-        scroller.startScroll(newPosition - scroller.getCurrPos(), scroller.getCurrPos());
+    public float getPrimaryValue(float x, float y) {
+        return x;
+    }
+
+    @Override
+    public float getSecondaryValue(float x, float y) {
+        return y;
     }
 
     @Override
@@ -83,11 +86,6 @@
     }
 
     @Override
-    public void delegateScrollTo(PagedView pagedView, int primaryScroll) {
-        pagedView.superScrollTo(primaryScroll, pagedView.getScrollY());
-    }
-
-    @Override
     public <T> void set(T target, Int2DAction<T> action, int param) {
         action.call(target, param, 0);
     }
@@ -240,12 +238,12 @@
     }
 
     @Override
-    public float getTaskMenuX(float x, View thumbnailView) {
-        return x;
+    public float getTaskMenuX(float x, View thumbnailView, int overScroll) {
+        return x + overScroll;
     }
 
     @Override
-    public float getTaskMenuY(float y, View thumbnailView) {
+    public float getTaskMenuY(float y, View thumbnailView, int overScroll) {
         return y;
     }
 
@@ -313,21 +311,31 @@
     @Override
     public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
         List<SplitPositionOption> options = new ArrayList<>(1);
+        // Add both left and right options if we're in tablet mode
         // TODO: Add in correct icons
-        if (dp.isSeascape()) { // or seascape
-            // Add left/right options
+        if (dp.isTablet && dp.isLandscape) {
             options.add(new SplitPositionOption(
                     R.drawable.ic_split_screen, R.string.split_screen_position_right,
-                    STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
-        } else if (dp.isLandscape) {
+                    STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
             options.add(new SplitPositionOption(
                     R.drawable.ic_split_screen, R.string.split_screen_position_left,
                     STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
         } else {
-            // Only add top option
-            options.add(new SplitPositionOption(
-                    R.drawable.ic_split_screen, R.string.split_screen_position_top,
-                    STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
+            if (dp.isSeascape()) {
+                // Add left/right options
+                options.add(new SplitPositionOption(
+                        R.drawable.ic_split_screen, R.string.split_screen_position_right,
+                        STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
+            } else if (dp.isLandscape) {
+                options.add(new SplitPositionOption(
+                        R.drawable.ic_split_screen, R.string.split_screen_position_left,
+                        STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
+            } else {
+                // Only add top option
+                options.add(new SplitPositionOption(
+                        R.drawable.ic_split_screen, R.string.split_screen_position_top,
+                        STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
+            }
         }
         return options;
     }
diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
index bd6e31b..893a274 100644
--- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
@@ -79,13 +79,13 @@
     }
 
     @Override
-    public float getTaskMenuX(float x, View thumbnailView) {
+    public float getTaskMenuX(float x, View thumbnailView, int overScroll) {
         return x;
     }
 
     @Override
-    public float getTaskMenuY(float y, View thumbnailView) {
-        return y + thumbnailView.getMeasuredHeight();
+    public float getTaskMenuY(float y, View thumbnailView, int overScroll) {
+        return y + thumbnailView.getMeasuredHeight() + overScroll;
     }
 
     @Override
diff --git a/src/com/android/launcher3/util/ActivityTracker.java b/src/com/android/launcher3/util/ActivityTracker.java
index 59266b4..b5b9c2f 100644
--- a/src/com/android/launcher3/util/ActivityTracker.java
+++ b/src/com/android/launcher3/util/ActivityTracker.java
@@ -75,9 +75,8 @@
     private boolean handleIntent(T activity, Intent intent, boolean alreadyOnHome) {
         if (intent != null && intent.getExtras() != null) {
             IBinder stateBinder = intent.getExtras().getBinder(EXTRA_SCHEDULER_CALLBACK);
-            if (stateBinder instanceof ObjectWrapper) {
-                SchedulerCallback<T> handler =
-                        ((ObjectWrapper<SchedulerCallback>) stateBinder).get();
+            SchedulerCallback<T> handler = ObjectWrapper.unwrap(stateBinder);
+            if (handler != null) {
                 if (!handler.init(activity, alreadyOnHome)) {
                     intent.getExtras().remove(EXTRA_SCHEDULER_CALLBACK);
                 }
diff --git a/src/com/android/launcher3/util/EdgeEffectCompat.java b/src/com/android/launcher3/util/EdgeEffectCompat.java
new file mode 100644
index 0000000..491582b
--- /dev/null
+++ b/src/com/android/launcher3/util/EdgeEffectCompat.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.util;
+
+import android.content.Context;
+import android.widget.EdgeEffect;
+
+import com.android.launcher3.Utilities;
+
+/**
+ * Extension of {@link EdgeEffect} to allow backwards compatibility
+ */
+public class EdgeEffectCompat extends EdgeEffect {
+
+    public EdgeEffectCompat(Context context) {
+        super(context);
+    }
+
+    @Override
+    public float getDistance() {
+        return Utilities.ATLEAST_S ? super.getDistance() : 0;
+    }
+
+    @Override
+    public float onPullDistance(float deltaDistance, float displacement) {
+        if (Utilities.ATLEAST_S) {
+            return super.onPullDistance(deltaDistance, displacement);
+        } else {
+            onPull(deltaDistance, displacement);
+            return deltaDistance;
+        }
+    }
+}
diff --git a/src/com/android/launcher3/util/IOUtils.java b/src/com/android/launcher3/util/IOUtils.java
index 1cec0ec..d7fa905 100644
--- a/src/com/android/launcher3/util/IOUtils.java
+++ b/src/com/android/launcher3/util/IOUtils.java
@@ -16,7 +16,9 @@
 
 package com.android.launcher3.util;
 
+import android.graphics.Bitmap;
 import android.os.FileUtils;
+import android.util.Base64;
 import android.util.Log;
 
 import com.android.launcher3.Utilities;
@@ -50,6 +52,12 @@
         return out.toByteArray();
     }
 
+    public static String toBase64String(Bitmap bitmap) {
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
+        return Base64.encodeToString(outputStream.toByteArray(), Base64.DEFAULT);
+    }
+
     public static long copy(InputStream from, OutputStream to) throws IOException {
         if (Utilities.ATLEAST_Q) {
             return FileUtils.copy(from, to);
diff --git a/src/com/android/launcher3/util/ObjectWrapper.java b/src/com/android/launcher3/util/ObjectWrapper.java
index e5b4707..a715821 100644
--- a/src/com/android/launcher3/util/ObjectWrapper.java
+++ b/src/com/android/launcher3/util/ObjectWrapper.java
@@ -42,4 +42,11 @@
     public static IBinder wrap(Object obj) {
         return new ObjectWrapper<>(obj);
     }
+
+    public static <T> T unwrap(IBinder binder) {
+        if (binder instanceof ObjectWrapper) {
+            return ((ObjectWrapper<T>) binder).get();
+        }
+        return null;
+    }
 }
diff --git a/src/com/android/launcher3/util/OverScroller.java b/src/com/android/launcher3/util/OverScroller.java
deleted file mode 100644
index 87e6986..0000000
--- a/src/com/android/launcher3/util/OverScroller.java
+++ /dev/null
@@ -1,867 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.launcher3.util;
-
-import static com.android.launcher3.anim.Interpolators.SCROLL;
-
-import android.animation.TimeInterpolator;
-import android.content.Context;
-import android.hardware.SensorManager;
-import android.util.Log;
-import android.view.ViewConfiguration;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
-
-import androidx.dynamicanimation.animation.FloatPropertyCompat;
-import androidx.dynamicanimation.animation.SpringAnimation;
-import androidx.dynamicanimation.animation.SpringForce;
-
-import com.android.launcher3.R;
-import com.android.systemui.plugins.ResourceProvider;
-
-/**
- * Based on {@link android.widget.OverScroller} supporting only 1-d scrolling and with more
- * customization options.
- */
-public class OverScroller {
-    private int mMode;
-
-    private final SplineOverScroller mScroller;
-
-    private TimeInterpolator mInterpolator;
-
-    private final boolean mFlywheel;
-
-    private static final int DEFAULT_DURATION = 250;
-    private static final int SCROLL_MODE = 0;
-    private static final int FLING_MODE = 1;
-
-    /**
-     * Creates an OverScroller with a viscous fluid scroll interpolator and flywheel.
-     * @param context
-     */
-    public OverScroller(Context context) {
-        this(context, null);
-    }
-
-    /**
-     * Creates an OverScroller with flywheel enabled.
-     * @param context The context of this application.
-     * @param interpolator The scroll interpolator. If null, a default (viscous) interpolator will
-     * be used.
-     */
-    public OverScroller(Context context, Interpolator interpolator) {
-        this(context, interpolator, true);
-    }
-
-    /**
-     * Creates an OverScroller.
-     * @param context The context of this application.
-     * @param interpolator The scroll interpolator. If null, a default (viscous) interpolator will
-     * be used.
-     * @param flywheel If true, successive fling motions will keep on increasing scroll speed.
-     */
-    public OverScroller(Context context, Interpolator interpolator, boolean flywheel) {
-        if (interpolator == null) {
-            mInterpolator = SCROLL;
-        } else {
-            mInterpolator = interpolator;
-        }
-        mFlywheel = flywheel;
-        mScroller = new SplineOverScroller(context);
-    }
-
-    public void setInterpolator(TimeInterpolator interpolator) {
-        if (interpolator == null) {
-            mInterpolator = SCROLL;
-        } else {
-            mInterpolator = interpolator;
-        }
-    }
-
-    /**
-     * The amount of friction applied to flings. The default value
-     * is {@link ViewConfiguration#getScrollFriction}.
-     *
-     * @param friction A scalar dimension-less value representing the coefficient of
-     *         friction.
-     */
-    public final void setFriction(float friction) {
-        mScroller.setFriction(friction);
-    }
-
-    /**
-     *
-     * Returns whether the scroller has finished scrolling.
-     *
-     * @return True if the scroller has finished scrolling, false otherwise.
-     */
-    public final boolean isFinished() {
-        return mScroller.mFinished;
-    }
-
-    /**
-     * Force the finished field to a particular value. Contrary to
-     * {@link #abortAnimation()}, forcing the animation to finished
-     * does NOT cause the scroller to move to the final x and y
-     * position.
-     *
-     * @param finished The new finished value.
-     */
-    public final void forceFinished(boolean finished) {
-        mScroller.mFinished = finished;
-    }
-
-    /**
-     * Returns the current offset in the scroll.
-     *
-     * @return The new offset as an absolute distance from the origin.
-     */
-    public final int getCurrPos() {
-        return mScroller.mCurrentPosition;
-    }
-
-    /**
-     * Returns the absolute value of the current velocity.
-     *
-     * @return The original velocity less the deceleration, norm of the X and Y velocity vector.
-     */
-    public float getCurrVelocity() {
-        return mScroller.mCurrVelocity;
-    }
-
-    /**
-     * Returns the start offset in the scroll.
-     *
-     * @return The start offset as an absolute distance from the origin.
-     */
-    public final int getStartPos() {
-        return mScroller.mStart;
-    }
-
-    /**
-     * Returns where the scroll will end. Valid only for "fling" scrolls.
-     *
-     * @return The final offset as an absolute distance from the origin.
-     */
-    public final int getFinalPos() {
-        return mScroller.mFinal;
-    }
-
-    /**
-     * Returns how long the scroll event will take, in milliseconds.
-     *
-     * Note that if mScroller.mState == SPRING, this duration is ignored, so can only
-     * serve as an estimate for how long the spring-controlled scroll will take.
-     *
-     * @return The duration of the scroll in milliseconds.
-     */
-    public final int getDuration() {
-        return mScroller.mDuration;
-    }
-
-    /**
-     * Extend the scroll animation. This allows a running animation to scroll
-     * further and longer, when used with {@link #setFinalPos(int)}.
-     *
-     * @param extend Additional time to scroll in milliseconds.
-     * @see #setFinalPos(int)
-     */
-    public void extendDuration(int extend) {
-        mScroller.extendDuration(extend);
-    }
-
-    /**
-     * Sets the final position for this scroller.
-     *
-     * @param newPos The new offset as an absolute distance from the origin.
-     * @see #extendDuration(int)
-     */
-    public void setFinalPos(int newPos) {
-        mScroller.setFinalPosition(newPos);
-    }
-
-    /**
-     * Call this when you want to know the new location. If it returns true, the
-     * animation is not yet finished.
-     */
-    public boolean computeScrollOffset() {
-        if (isFinished()) {
-            return false;
-        }
-
-        switch (mMode) {
-            case SCROLL_MODE:
-                if (isSpringing()) {
-                    return true;
-                }
-                long time = AnimationUtils.currentAnimationTimeMillis();
-                // Any scroller can be used for time, since they were started
-                // together in scroll mode. We use X here.
-                final long elapsedTime = time - mScroller.mStartTime;
-
-                final int duration = mScroller.mDuration;
-                if (elapsedTime < duration) {
-                    final float q = mInterpolator.getInterpolation(elapsedTime / (float) duration);
-                    mScroller.updateScroll(q);
-                } else {
-                    abortAnimation();
-                }
-                break;
-
-            case FLING_MODE:
-                if (!mScroller.mFinished) {
-                    if (!mScroller.update()) {
-                        if (!mScroller.continueWhenFinished()) {
-                            mScroller.finish();
-                        }
-                    }
-                }
-
-                break;
-        }
-
-        return true;
-    }
-
-    /**
-     * Start scrolling by providing a starting point and the distance to travel.
-     * The scroll will use the default value of 250 milliseconds for the
-     * duration.
-     *
-     * @param start Starting horizontal scroll offset in pixels. Positive
-     *        numbers will scroll the content to the left.
-     * @param delta Distance to travel. Positive numbers will scroll the
-     *        content to the left.
-     */
-    public void startScroll(int start, int delta) {
-        startScroll(start, delta, DEFAULT_DURATION);
-    }
-
-    /**
-     * Start scrolling by providing a starting point and the distance to travel.
-     *
-     * @param start Starting scroll offset in pixels. Positive
-     *        numbers will scroll the content to the left.
-     * @param delta Distance to travel. Positive numbers will scroll the
-     *        content to the left.
-     * @param duration Duration of the scroll in milliseconds.
-     */
-    public void startScroll(int start, int delta, int duration) {
-        mMode = SCROLL_MODE;
-        mScroller.startScroll(start, delta, duration);
-    }
-
-    /**
-     * Start scrolling using a spring by providing a starting point and the distance to travel.
-     *
-     * @param start Starting scroll offset in pixels. Positive
-     *        numbers will scroll the content to the left.
-     * @param delta Distance to travel. Positive numbers will scroll the
-     *        content to the left.
-     * @param duration Duration of the scroll in milliseconds.
-     * @param velocity The starting velocity for the spring in px per ms.
-     */
-    public void startScrollSpring(int start, int delta, int duration, float velocity) {
-        mMode = SCROLL_MODE;
-        mScroller.mState = mScroller.SPRING;
-        mScroller.startScroll(start, delta, duration, velocity);
-    }
-
-    /**
-     * Call this when you want to 'spring back' into a valid coordinate range.
-     *
-     * @param start Starting X coordinate
-     * @param min Minimum valid X value
-     * @param max Maximum valid X value
-     * @return true if a springback was initiated, false if startX and startY were
-     *          already within the valid range.
-     */
-    public boolean springBack(int start, int min, int max) {
-        mMode = FLING_MODE;
-        return mScroller.springback(start, min, max);
-    }
-
-    public void fling(int start, int velocity, int min, int max) {
-        fling(start, velocity, min, max, 0);
-    }
-
-    /**
-     * Start scrolling based on a fling gesture. The distance traveled will
-     * depend on the initial velocity of the fling.
-     *  @param start Starting point of the scroll (X)
-     * @param velocity Initial velocity of the fling (X) measured in pixels per
-     *            second.
-     * @param min Minimum X value. The scroller will not scroll past this point
- *            unless overX > 0. If overfling is allowed, it will use minX as
- *            a springback boundary.
-     * @param max Maximum X value. The scroller will not scroll past this point
-*            unless overX > 0. If overfling is allowed, it will use maxX as
-*            a springback boundary.
-     * @param over Overfling range. If > 0, horizontal overfling in either
-*            direction will be possible.
-     */
-    public void fling(int start, int velocity, int min, int max, int over) {
-        // Continue a scroll or fling in progress
-        if (mFlywheel && !isFinished()) {
-            float oldVelocityX = mScroller.mCurrVelocity;
-            if (Math.signum(velocity) == Math.signum(oldVelocityX)) {
-                velocity += oldVelocityX;
-            }
-        }
-
-        mMode = FLING_MODE;
-        mScroller.fling(start, velocity, min, max, over);
-    }
-
-    /**
-     * Notify the scroller that we've reached a horizontal boundary.
-     * Normally the information to handle this will already be known
-     * when the animation is started, such as in a call to one of the
-     * fling functions. However there are cases where this cannot be known
-     * in advance. This function will transition the current motion and
-     * animate from startX to finalX as appropriate.
-     *  @param start Starting/current X position
-     * @param finalPos Desired final X position
-     * @param over Magnitude of overscroll allowed. This should be the maximum
-     */
-    public void notifyEdgeReached(int start, int finalPos, int over) {
-        mScroller.notifyEdgeReached(start, finalPos, over);
-    }
-
-    /**
-     * Returns whether the current Scroller is currently returning to a valid position.
-     * Valid bounds were provided by the
-     * {@link #fling(int, int, int, int, int)} method.
-     *
-     * One should check this value before calling
-     * {@link #startScroll(int, int)} as the interpolation currently in progress
-     * to restore a valid position will then be stopped. The caller has to take into account
-     * the fact that the started scroll will start from an overscrolled position.
-     *
-     * @return true when the current position is overscrolled and in the process of
-     *         interpolating back to a valid value.
-     */
-    public boolean isOverScrolled() {
-        return (!mScroller.mFinished && mScroller.mState != SplineOverScroller.SPLINE);
-    }
-
-    /**
-     * Stops the animation. Contrary to {@link #forceFinished(boolean)},
-     * aborting the animating causes the scroller to move to the final x and y
-     * positions.
-     *
-     * @see #forceFinished(boolean)
-     */
-    public void abortAnimation() {
-        mScroller.finish();
-    }
-
-    /**
-     * Returns the time elapsed since the beginning of the scrolling.
-     *
-     * @return The elapsed time in milliseconds.
-     *
-     * @hide
-     */
-    public int timePassed() {
-        final long time = AnimationUtils.currentAnimationTimeMillis();
-        return (int) (time - mScroller.mStartTime);
-    }
-
-    public boolean isSpringing() {
-        return mScroller.mState == SplineOverScroller.SPRING && !isFinished();
-    }
-
-    static class SplineOverScroller {
-        // Initial position
-        private int mStart;
-
-        // Current position
-        private int mCurrentPosition;
-
-        // Final position
-        private int mFinal;
-
-        // Initial velocity
-        private int mVelocity;
-
-        // Current velocity
-        private float mCurrVelocity;
-
-        // Constant current deceleration
-        private float mDeceleration;
-
-        // Animation starting time, in system milliseconds
-        private long mStartTime;
-
-        // Animation duration, in milliseconds
-        private int mDuration;
-
-        // Duration to complete spline component of animation
-        private int mSplineDuration;
-
-        // Distance to travel along spline animation
-        private int mSplineDistance;
-
-        // Whether the animation is currently in progress
-        private boolean mFinished;
-
-        // The allowed overshot distance before boundary is reached.
-        private int mOver;
-
-        // Fling friction
-        private float mFlingFriction = ViewConfiguration.getScrollFriction();
-
-        // Current state of the animation.
-        private int mState = SPLINE;
-
-        private Context mContext;
-        private SpringAnimation mSpring;
-
-        // Constant gravity value, used in the deceleration phase.
-        private static final float GRAVITY = 2000.0f;
-
-        // A context-specific coefficient adjusted to physical values.
-        private float mPhysicalCoeff;
-
-        private static float DECELERATION_RATE = (float) (Math.log(0.78) / Math.log(0.9));
-        private static final float INFLEXION = 0.35f; // Tension lines cross at (INFLEXION, 1)
-        private static final float START_TENSION = 0.5f;
-        private static final float END_TENSION = 1.0f;
-        private static final float P1 = START_TENSION * INFLEXION;
-        private static final float P2 = 1.0f - END_TENSION * (1.0f - INFLEXION);
-
-        private static final int NB_SAMPLES = 100;
-        private static final float[] SPLINE_POSITION = new float[NB_SAMPLES + 1];
-        private static final float[] SPLINE_TIME = new float[NB_SAMPLES + 1];
-
-        private static final int SPLINE = 0;
-        private static final int CUBIC = 1;
-        private static final int BALLISTIC = 2;
-        private static final int SPRING = 3;
-
-        private static final FloatPropertyCompat<SplineOverScroller> SPRING_PROPERTY =
-                new FloatPropertyCompat<SplineOverScroller>("splineOverScrollerSpring") {
-                    @Override
-                    public float getValue(SplineOverScroller scroller) {
-                        return scroller.mCurrentPosition;
-                    }
-
-                    @Override
-                    public void setValue(SplineOverScroller scroller, float value) {
-                        scroller.mCurrentPosition = (int) value;
-                    }
-                };
-
-        static {
-            float x_min = 0.0f;
-            float y_min = 0.0f;
-            for (int i = 0; i < NB_SAMPLES; i++) {
-                final float alpha = (float) i / NB_SAMPLES;
-
-                float x_max = 1.0f;
-                float x, tx, coef;
-                while (true) {
-                    x = x_min + (x_max - x_min) / 2.0f;
-                    coef = 3.0f * x * (1.0f - x);
-                    tx = coef * ((1.0f - x) * P1 + x * P2) + x * x * x;
-                    if (Math.abs(tx - alpha) < 1E-5) break;
-                    if (tx > alpha) x_max = x;
-                    else x_min = x;
-                }
-                SPLINE_POSITION[i] = coef * ((1.0f - x) * START_TENSION + x) + x * x * x;
-
-                float y_max = 1.0f;
-                float y, dy;
-                while (true) {
-                    y = y_min + (y_max - y_min) / 2.0f;
-                    coef = 3.0f * y * (1.0f - y);
-                    dy = coef * ((1.0f - y) * START_TENSION + y) + y * y * y;
-                    if (Math.abs(dy - alpha) < 1E-5) break;
-                    if (dy > alpha) y_max = y;
-                    else y_min = y;
-                }
-                SPLINE_TIME[i] = coef * ((1.0f - y) * P1 + y * P2) + y * y * y;
-            }
-            SPLINE_POSITION[NB_SAMPLES] = SPLINE_TIME[NB_SAMPLES] = 1.0f;
-        }
-
-        void setFriction(float friction) {
-            mFlingFriction = friction;
-        }
-
-        SplineOverScroller(Context context) {
-            mContext = context;
-            mFinished = true;
-            final float ppi = context.getResources().getDisplayMetrics().density * 160.0f;
-            mPhysicalCoeff = SensorManager.GRAVITY_EARTH // g (m/s^2)
-                    * 39.37f // inch/meter
-                    * ppi
-                    * 0.84f; // look and feel tuning
-        }
-
-        void updateScroll(float q) {
-            if (mState == SPRING) {
-                return;
-            }
-            mCurrentPosition = mStart + Math.round(q * (mFinal - mStart));
-        }
-
-        /*
-         * Get a signed deceleration that will reduce the velocity.
-         */
-        static private float getDeceleration(int velocity) {
-            return velocity > 0 ? -GRAVITY : GRAVITY;
-        }
-
-        /*
-         * Modifies mDuration to the duration it takes to get from start to newFinal using the
-         * spline interpolation. The previous duration was needed to get to oldFinal.
-         */
-        private void adjustDuration(int start, int oldFinal, int newFinal) {
-            final int oldDistance = oldFinal - start;
-            final int newDistance = newFinal - start;
-            final float x = Math.abs((float) newDistance / oldDistance);
-            final int index = (int) (NB_SAMPLES * x);
-            if (index < NB_SAMPLES) {
-                final float x_inf = (float) index / NB_SAMPLES;
-                final float x_sup = (float) (index + 1) / NB_SAMPLES;
-                final float t_inf = SPLINE_TIME[index];
-                final float t_sup = SPLINE_TIME[index + 1];
-                final float timeCoef = t_inf + (x - x_inf) / (x_sup - x_inf) * (t_sup - t_inf);
-                mDuration *= timeCoef;
-            }
-        }
-
-        void startScroll(int start, int distance, int duration) {
-            startScroll(start, distance, duration, 0);
-        }
-
-        void startScroll(int start, int distance, int duration, float velocity) {
-            mFinished = false;
-
-            mCurrentPosition = mStart = start;
-            mFinal = start + distance;
-
-            mStartTime = AnimationUtils.currentAnimationTimeMillis();
-            mDuration = duration;
-
-            if (mSpring != null) {
-                mSpring.cancel();
-            }
-
-            if (mState == SPRING) {
-                mSpring = new SpringAnimation(this, SPRING_PROPERTY);
-
-                ResourceProvider rp = DynamicResource.provider(mContext);
-                float stiffness = rp.getFloat(R.dimen.horizontal_spring_stiffness);
-                float damping = rp.getFloat(R.dimen.horizontal_spring_damping_ratio);
-                mSpring.setSpring(new SpringForce(mFinal)
-                        .setStiffness(stiffness)
-                        .setDampingRatio(damping));
-                mSpring.setStartVelocity(velocity);
-                mSpring.animateToFinalPosition(mFinal);
-                mSpring.addEndListener((animation, canceled, value, velocity1) -> {
-                    mSpring = null;
-                    finish();
-                    mState = SPLINE;
-                });
-            }
-            // Unused
-            mDeceleration = 0.0f;
-            mVelocity = 0;
-        }
-
-        void finish() {
-            if (mSpring != null && mSpring.isRunning()) mSpring.cancel();
-
-            mCurrentPosition = mFinal;
-            // Not reset since WebView relies on this value for fast fling.
-            // TODO: restore when WebView uses the fast fling implemented in this class.
-            // mCurrVelocity = 0.0f;
-            mFinished = true;
-        }
-
-        void setFinalPosition(int position) {
-            mFinal = position;
-            if (mState == SPRING && mSpring != null) {
-                mSpring.animateToFinalPosition(mFinal);
-            }
-            mSplineDistance = mFinal - mStart;
-            mFinished = false;
-        }
-
-        void extendDuration(int extend) {
-            final long time = AnimationUtils.currentAnimationTimeMillis();
-            final int elapsedTime = (int) (time - mStartTime);
-            mDuration  = mSplineDuration = elapsedTime + extend;
-            mFinished = false;
-        }
-
-        boolean springback(int start, int min, int max) {
-            mFinished = true;
-
-            mCurrentPosition = mStart = mFinal = start;
-            mVelocity = 0;
-
-            mStartTime = AnimationUtils.currentAnimationTimeMillis();
-            mDuration = 0;
-
-            if (start < min) {
-                startSpringback(start, min, 0);
-            } else if (start > max) {
-                startSpringback(start, max, 0);
-            }
-
-            return !mFinished;
-        }
-
-        private void startSpringback(int start, int end, int velocity) {
-            // mStartTime has been set
-            mFinished = false;
-            mState = CUBIC;
-            mCurrentPosition = mStart = start;
-            mFinal = end;
-            final int delta = start - end;
-            mDeceleration = getDeceleration(delta);
-            // TODO take velocity into account
-            mVelocity = -delta; // only sign is used
-            mOver = Math.abs(delta);
-            mDuration = (int) (1000.0 * Math.sqrt(-2.0 * delta / mDeceleration));
-        }
-
-        void fling(int start, int velocity, int min, int max, int over) {
-            mOver = over;
-            mFinished = false;
-            mCurrVelocity = mVelocity = velocity;
-            mDuration = mSplineDuration = 0;
-            mStartTime = AnimationUtils.currentAnimationTimeMillis();
-            mCurrentPosition = mStart = start;
-
-            if (start > max || start < min) {
-                startAfterEdge(start, min, max, velocity);
-                return;
-            }
-
-            mState = SPLINE;
-            double totalDistance = 0.0;
-
-            if (velocity != 0) {
-                mDuration = mSplineDuration = getSplineFlingDuration(velocity);
-                totalDistance = getSplineFlingDistance(velocity);
-            }
-
-            mSplineDistance = (int) (totalDistance * Math.signum(velocity));
-            mFinal = start + mSplineDistance;
-
-            // Clamp to a valid final position
-            if (mFinal < min) {
-                adjustDuration(mStart, mFinal, min);
-                mFinal = min;
-            }
-
-            if (mFinal > max) {
-                adjustDuration(mStart, mFinal, max);
-                mFinal = max;
-            }
-        }
-
-        private double getSplineDeceleration(int velocity) {
-            return Math.log(INFLEXION * Math.abs(velocity) / (mFlingFriction * mPhysicalCoeff));
-        }
-
-        private double getSplineFlingDistance(int velocity) {
-            final double l = getSplineDeceleration(velocity);
-            final double decelMinusOne = DECELERATION_RATE - 1.0;
-            return mFlingFriction * mPhysicalCoeff * Math.exp(DECELERATION_RATE / decelMinusOne * l);
-        }
-
-        /* Returns the duration, expressed in milliseconds */
-        private int getSplineFlingDuration(int velocity) {
-            final double l = getSplineDeceleration(velocity);
-            final double decelMinusOne = DECELERATION_RATE - 1.0;
-            return (int) (1000.0 * Math.exp(l / decelMinusOne));
-        }
-
-        private void fitOnBounceCurve(int start, int end, int velocity) {
-            // Simulate a bounce that started from edge
-            final float durationToApex = - velocity / mDeceleration;
-            // The float cast below is necessary to avoid integer overflow.
-            final float velocitySquared = (float) velocity * velocity;
-            final float distanceToApex = velocitySquared / 2.0f / Math.abs(mDeceleration);
-            final float distanceToEdge = Math.abs(end - start);
-            final float totalDuration = (float) Math.sqrt(
-                    2.0 * (distanceToApex + distanceToEdge) / Math.abs(mDeceleration));
-            mStartTime -= (int) (1000.0f * (totalDuration - durationToApex));
-            mCurrentPosition = mStart = end;
-            mVelocity = (int) (- mDeceleration * totalDuration);
-        }
-
-        private void startBounceAfterEdge(int start, int end, int velocity) {
-            mDeceleration = getDeceleration(velocity == 0 ? start - end : velocity);
-            fitOnBounceCurve(start, end, velocity);
-            onEdgeReached();
-        }
-
-        private void startAfterEdge(int start, int min, int max, int velocity) {
-            if (start > min && start < max) {
-                Log.e("OverScroller", "startAfterEdge called from a valid position");
-                mFinished = true;
-                return;
-            }
-            final boolean positive = start > max;
-            final int edge = positive ? max : min;
-            final int overDistance = start - edge;
-            boolean keepIncreasing = overDistance * velocity >= 0;
-            if (keepIncreasing) {
-                // Will result in a bounce or a to_boundary depending on velocity.
-                startBounceAfterEdge(start, edge, velocity);
-            } else {
-                final double totalDistance = getSplineFlingDistance(velocity);
-                if (totalDistance > Math.abs(overDistance)) {
-                    fling(start, velocity, positive ? min : start, positive ? start : max, mOver);
-                } else {
-                    startSpringback(start, edge, velocity);
-                }
-            }
-        }
-
-        void notifyEdgeReached(int start, int end, int over) {
-            // mState is used to detect successive notifications
-            if (mState == SPLINE) {
-                mOver = over;
-                mStartTime = AnimationUtils.currentAnimationTimeMillis();
-                // We were in fling/scroll mode before: current velocity is such that distance to
-                // edge is increasing. This ensures that startAfterEdge will not start a new fling.
-                startAfterEdge(start, end, end, (int) mCurrVelocity);
-            }
-        }
-
-        private void onEdgeReached() {
-            // mStart, mVelocity and mStartTime were adjusted to their values when edge was reached.
-            // The float cast below is necessary to avoid integer overflow.
-            final float velocitySquared = (float) mVelocity * mVelocity;
-            float distance = velocitySquared / (2.0f * Math.abs(mDeceleration));
-            final float sign = Math.signum(mVelocity);
-
-            if (distance > mOver) {
-                // Default deceleration is not sufficient to slow us down before boundary
-                mDeceleration = - sign * velocitySquared / (2.0f * mOver);
-                distance = mOver;
-            }
-
-            mOver = (int) distance;
-            mState = BALLISTIC;
-            mFinal = mStart + (int) (mVelocity > 0 ? distance : -distance);
-            mDuration = - (int) (1000.0f * mVelocity / mDeceleration);
-        }
-
-        boolean continueWhenFinished() {
-            switch (mState) {
-                case SPLINE:
-                    // Duration from start to null velocity
-                    if (mDuration < mSplineDuration) {
-                        // If the animation was clamped, we reached the edge
-                        mCurrentPosition = mStart = mFinal;
-                        // TODO Better compute speed when edge was reached
-                        mVelocity = (int) mCurrVelocity;
-                        mDeceleration = getDeceleration(mVelocity);
-                        mStartTime += mDuration;
-                        onEdgeReached();
-                    } else {
-                        // Normal stop, no need to continue
-                        return false;
-                    }
-                    break;
-                case BALLISTIC:
-                    mStartTime += mDuration;
-                    startSpringback(mFinal, mStart, 0);
-                    break;
-                case CUBIC:
-                    return false;
-            }
-
-            update();
-            return true;
-        }
-
-        /*
-         * Update the current position and velocity for current time. Returns
-         * true if update has been done and false if animation duration has been
-         * reached.
-         */
-        boolean update() {
-            if (mState == SPRING) {
-                return mFinished;
-            }
-
-            final long time = AnimationUtils.currentAnimationTimeMillis();
-            final long currentTime = time - mStartTime;
-
-            if (currentTime == 0) {
-                // Skip work but report that we're still going if we have a nonzero duration.
-                return mDuration > 0;
-            }
-            if (currentTime > mDuration) {
-                return false;
-            }
-
-            double distance = 0.0;
-            switch (mState) {
-                case SPLINE: {
-                    final float t = (float) currentTime / mSplineDuration;
-                    final int index = (int) (NB_SAMPLES * t);
-                    float distanceCoef = 1.f;
-                    float velocityCoef = 0.f;
-                    if (index < NB_SAMPLES) {
-                        final float t_inf = (float) index / NB_SAMPLES;
-                        final float t_sup = (float) (index + 1) / NB_SAMPLES;
-                        final float d_inf = SPLINE_POSITION[index];
-                        final float d_sup = SPLINE_POSITION[index + 1];
-                        velocityCoef = (d_sup - d_inf) / (t_sup - t_inf);
-                        distanceCoef = d_inf + (t - t_inf) * velocityCoef;
-                    }
-
-                    distance = distanceCoef * mSplineDistance;
-                    mCurrVelocity = velocityCoef * mSplineDistance / mSplineDuration * 1000.0f;
-                    break;
-                }
-
-                case BALLISTIC: {
-                    final float t = currentTime / 1000.0f;
-                    mCurrVelocity = mVelocity + mDeceleration * t;
-                    distance = mVelocity * t + mDeceleration * t * t / 2.0f;
-                    break;
-                }
-
-                case CUBIC: {
-                    final float t = (float) (currentTime) / mDuration;
-                    final float t2 = t * t;
-                    final float sign = Math.signum(mVelocity);
-                    distance = sign * mOver * (3.0f * t2 - 2.0f * t * t2);
-                    mCurrVelocity = sign * mOver * 6.0f * (- t + t2);
-                    break;
-                }
-            }
-
-            mCurrentPosition = mStart + (int) Math.round(distance);
-
-            return true;
-        }
-    }
-}
\ No newline at end of file
diff --git a/src/com/android/launcher3/util/OverlayEdgeEffect.java b/src/com/android/launcher3/util/OverlayEdgeEffect.java
new file mode 100644
index 0000000..8d455c6
--- /dev/null
+++ b/src/com/android/launcher3/util/OverlayEdgeEffect.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.util;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.widget.EdgeEffect;
+
+import com.android.launcher3.Utilities;
+import com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlay;
+
+/**
+ * Extension of {@link EdgeEffect} which shows the Launcher overlay
+ */
+public class OverlayEdgeEffect extends EdgeEffectCompat {
+
+    private final LauncherOverlay mOverlay;
+    private final boolean mIsRtl;
+
+    private float mDistance;
+    private boolean mIsScrolling;
+
+    public OverlayEdgeEffect(Context context, LauncherOverlay overlay) {
+        super(context);
+        mOverlay = overlay;
+        mIsRtl = Utilities.isRtl(context.getResources());
+
+    }
+
+    @Override
+    public float getDistance() {
+        return mDistance;
+    }
+
+    public float onPullDistance(float deltaDistance, float displacement) {
+        mDistance = Math.max(0f, deltaDistance + mDistance);
+        if (!mIsScrolling) {
+            mOverlay.onScrollInteractionBegin();
+            mIsScrolling = true;
+        }
+        mOverlay.onScrollChange(mDistance, mIsRtl);
+        return mDistance > 0 ? deltaDistance : 0;
+    }
+
+    @Override
+    public void onAbsorb(int velocity) { }
+
+    @Override
+    public boolean isFinished() {
+        return mDistance <= 0;
+    }
+
+    @Override
+    public void onRelease() {
+        if (mIsScrolling) {
+            mDistance = 0;
+            mOverlay.onScrollInteractionEnd();
+            mIsScrolling = false;
+        }
+    }
+
+    @Override
+    public boolean draw(Canvas canvas) {
+        return false;
+    }
+
+    public void finish() {
+        mDistance = 0;
+    }
+}
diff --git a/src/com/android/launcher3/util/TranslateEdgeEffect.java b/src/com/android/launcher3/util/TranslateEdgeEffect.java
new file mode 100644
index 0000000..8fdc8df
--- /dev/null
+++ b/src/com/android/launcher3/util/TranslateEdgeEffect.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.util;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.RenderNode;
+import android.widget.EdgeEffect;
+
+/**
+ * Extension of {@link EdgeEffect} which translates the content instead of the default
+ * platform implementation
+ */
+@SuppressWarnings("NewApi")
+public class TranslateEdgeEffect extends EdgeEffectCompat {
+
+    private final RenderNode mNode;
+
+    public TranslateEdgeEffect(Context context) {
+        super(context);
+        mNode = new RenderNode("TranslateEdgeEffect");
+    }
+
+    @Override
+    public boolean draw(Canvas canvas) {
+        return false;
+    }
+
+    public boolean getTranslationShift(float[] out) {
+        Canvas c = mNode.beginRecording(1, 1);
+        boolean result = super.draw(c);
+        mNode.endRecording();
+
+        out[0] = getDistance();
+        return result;
+    }
+}
diff --git a/src/com/android/launcher3/views/ClipIconView.java b/src/com/android/launcher3/views/ClipIconView.java
index 4e82336..a66b3f9 100644
--- a/src/com/android/launcher3/views/ClipIconView.java
+++ b/src/com/android/launcher3/views/ClipIconView.java
@@ -15,10 +15,13 @@
  */
 package com.android.launcher3.views;
 
+import static com.android.launcher3.Utilities.boundToRange;
 import static com.android.launcher3.Utilities.mapToRange;
 import static com.android.launcher3.anim.Interpolators.LINEAR;
 import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
 
+import static java.lang.Math.max;
+
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.animation.ValueAnimator;
@@ -143,10 +146,9 @@
     /**
      * Update the icon UI to match the provided parameters during an animation frame
      */
-    public void update(RectF rect, float progress, float shapeProgressStart,
-            float cornerRadius, boolean isOpening, View container,
-            DeviceProfile dp, boolean isVerticalBarLayout) {
-
+    public void update(RectF rect, float progress, float shapeProgressStart, float cornerRadius,
+            int fgIconAlpha, boolean isOpening, View container, DeviceProfile dp,
+            boolean isVerticalBarLayout) {
         MarginLayoutParams lp = (MarginLayoutParams) container.getLayoutParams();
 
         float dX = mIsRtl
@@ -166,7 +168,7 @@
             return;
         }
 
-        update(rect, progress, shapeProgressStart, cornerRadius, isOpening, scale,
+        update(rect, progress, shapeProgressStart, cornerRadius, fgIconAlpha, isOpening, scale,
                 minSize, lp, isVerticalBarLayout, dp);
 
         container.setPivotX(0);
@@ -178,8 +180,8 @@
     }
 
     private void update(RectF rect, float progress, float shapeProgressStart, float cornerRadius,
-            boolean isOpening, float scale, float minSize, MarginLayoutParams parentLp,
-            boolean isVerticalBarLayout, DeviceProfile dp) {
+            int fgIconAlpha, boolean isOpening, float scale, float minSize,
+            MarginLayoutParams parentLp, boolean isVerticalBarLayout, DeviceProfile dp) {
         float dX = mIsRtl
                 ? rect.left - (dp.widthPx - parentLp.getMarginStart() - parentLp.width)
                 : rect.left - parentLp.getMarginStart();
@@ -187,9 +189,9 @@
 
         // shapeRevealProgress = 1 when progress = shapeProgressStart + SHAPE_PROGRESS_DURATION
         float toMax = isOpening ? 1 / SHAPE_PROGRESS_DURATION : 1f;
-        float shapeRevealProgress = Utilities.boundToRange(mapToRange(
-                Math.max(shapeProgressStart, progress), shapeProgressStart, 1f, 0, toMax,
-                LINEAR), 0, 1);
+
+        float shapeRevealProgress = boundToRange(mapToRange(max(shapeProgressStart, progress),
+                shapeProgressStart, 1f, 0, toMax, LINEAR), 0, 1);
 
         if (isVerticalBarLayout) {
             mOutline.right = (int) (rect.width() / scale);
@@ -231,6 +233,8 @@
                 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);
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 96268ce..d49320b 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -100,6 +100,8 @@
     private ListenerView mListenerView;
     private Runnable mFastFinishRunnable;
 
+    private float mIconOffsetY;
+
     public FloatingIconView(Context context) {
         this(context, null);
     }
@@ -136,16 +138,18 @@
 
     /**
      * Positions this view to match the size and location of {@param rect}.
-     * @param alpha The alpha to set this view.
+     * @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(RectF rect, float alpha, float progress, float shapeProgressStart,
-            float cornerRadius, boolean isOpening) {
+    public void update(float alpha, int fgIconAlpha, RectF rect, float progress,
+            float shapeProgressStart, float cornerRadius, boolean isOpening) {
         setAlpha(alpha);
-        mClipIconView.update(rect, progress, shapeProgressStart, cornerRadius, isOpening,
-                this, mLauncher.getDeviceProfile(), mIsVerticalBarLayout);
+        mClipIconView.update(rect, progress, shapeProgressStart, cornerRadius, fgIconAlpha,
+                isOpening, this, mLauncher.getDeviceProfile(), mIsVerticalBarLayout);
     }
 
     @Override
@@ -478,11 +482,19 @@
     @Override
     public void onAnimationRepeat(Animator animator) {}
 
+    /**
+     * Offsets and updates the position of this view by {@param y}.
+     */
+    public void setPositionOffsetY(float y) {
+        mIconOffsetY = y;
+        onGlobalLayout();
+    }
+
     @Override
     public void onGlobalLayout() {
-        if (mOriginalIcon.isAttachedToWindow() && mPositionOut != null) {
-            getLocationBoundsForView(mLauncher, mOriginalIcon, mIsOpening,
-                    sTmpRectF);
+        if (mOriginalIcon != null && mOriginalIcon.isAttachedToWindow() && mPositionOut != null) {
+            getLocationBoundsForView(mLauncher, mOriginalIcon, mIsOpening, sTmpRectF);
+            sTmpRectF.offset(0, mIconOffsetY);
             if (!sTmpRectF.equals(mPositionOut)) {
                 updatePosition(sTmpRectF, (InsettableFrameLayout.LayoutParams) getLayoutParams());
                 if (mOnTargetChangeRunnable != null) {
@@ -617,6 +629,7 @@
         mClipIconView.recycle();
         mBtvDrawable.setBackground(null);
         mFastFinishRunnable = null;
+        mIconOffsetY = 0;
     }
 
     private static class IconLoadResult {
diff --git a/src/com/android/launcher3/views/FloatingSurfaceView.java b/src/com/android/launcher3/views/FloatingSurfaceView.java
index f13484f..e2e3be7 100644
--- a/src/com/android/launcher3/views/FloatingSurfaceView.java
+++ b/src/com/android/launcher3/views/FloatingSurfaceView.java
@@ -158,7 +158,7 @@
         if (mContract == null) {
             return;
         }
-        View icon = mLauncher.getWorkspace().getFirstMatchForAppClose(
+        View icon = mLauncher.getWorkspace().getFirstMatchForAppClose(-1,
                 mContract.componentName.getPackageName(), mContract.user);
 
         boolean iconChanged = mIcon != icon;
diff --git a/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java b/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java
index 1aefe41..18f1be3 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsRecommendationTableLayout.java
@@ -43,6 +43,7 @@
     private static final float DOWN_SCALE_RATIO = 0.9f;
     private static final float MAX_DOWN_SCALE_RATIO = 0.5f;
     private final float mWidgetCellTextViewsHeight;
+    private final float mWidgetPreviewPadding;
 
     private float mRecommendationTableMaxHeight = Float.MAX_VALUE;
     @Nullable private OnLongClickListener mWidgetCellOnLongClickListener;
@@ -57,6 +58,8 @@
         super(context, attrs);
         // There are 1 row for title, 1 row for dimension and 2 rows for description.
         mWidgetCellTextViewsHeight = 4 * getResources().getDimension(R.dimen.widget_cell_font_size);
+        mWidgetPreviewPadding = 2 * getResources()
+                .getDimensionPixelSize(R.dimen.widget_preview_shortcut_padding);
     }
 
     /** Sets a {@link android.view.View.OnLongClickListener} for all widget cells in this table. */
@@ -147,7 +150,7 @@
             float rowHeight = 0;
             for (int j = 0; j < widgetItems.size(); j++) {
                 float previewHeight = widgetItems.get(j).spanY * deviceProfile.cellHeightPx
-                        * previewScale;
+                        * previewScale + mWidgetPreviewPadding;
                 rowHeight = Math.max(rowHeight, previewHeight + mWidgetCellTextViewsHeight);
             }
             totalHeight += rowHeight;