Merge "Reset force-minimized split state when in live tile mode" into sc-dev
diff --git a/quickstep/res/layout/overview_clear_all_button.xml b/quickstep/res/layout/overview_clear_all_button.xml
index c61610a..1ee726e 100644
--- a/quickstep/res/layout/overview_clear_all_button.xml
+++ b/quickstep/res/layout/overview_clear_all_button.xml
@@ -21,5 +21,5 @@
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:text="@string/recents_clear_all"
-    android:textColor="?attr/workspaceTextColor"
+    android:textColor="?android:attr/textColorPrimary"
     android:textSize="14sp" />
\ No newline at end of file
diff --git a/quickstep/res/layout/overview_panel.xml b/quickstep/res/layout/overview_panel.xml
index 394e880..d7bcd9e 100644
--- a/quickstep/res/layout/overview_panel.xml
+++ b/quickstep/res/layout/overview_panel.xml
@@ -19,8 +19,7 @@
         android:id="@+id/split_placeholder"
         android:layout_width="match_parent"
         android:layout_height="@dimen/split_placeholder_size"
-        android:background="@android:color/white"
-        android:alpha=".8"
+        android:background="@android:color/darker_gray"
         android:visibility="gone" />
 
     <com.android.quickstep.views.LauncherRecentsView
@@ -30,7 +29,6 @@
         android:accessibilityPaneTitle="@string/accessibility_recent_apps"
         android:clipChildren="false"
         android:clipToPadding="false"
-        android:theme="@style/HomeScreenElementTheme"
         android:visibility="invisible" />
 
     <include
diff --git a/quickstep/res/layout/scrim_view.xml b/quickstep/res/layout/scrim_view.xml
deleted file mode 100644
index 2cc37f9..0000000
--- a/quickstep/res/layout/scrim_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<com.android.quickstep.views.ShelfScrimView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:id="@+id/scrim_view" />
\ No newline at end of file
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 1603321..2a06830 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -59,7 +59,7 @@
     <string name="all_apps_prediction_tip">Your predicted apps</string>
 
     <!-- Content description for a close button. [CHAR LIMIT=NONE] -->
-    <string  name="gesture_tutorial_close_button_content_description" translatable="false">Close</string>
+    <string name="gesture_tutorial_close_button_content_description" translatable="false">Close</string>
 
     <!-- Hotseat educational strings for users who don't qualify for migration -->
     <string name="hotseat_edu_title_migrate">Get app suggestions on the bottom row of your Home screen</string>
@@ -91,14 +91,6 @@
     <!-- content description for hotseat items -->
     <string name="hotseat_prediction_content_description">Predicted app: <xliff:g id="title" example="Chrome">%1$s</xliff:g></string>
 
-    <!-- primary educational text shown for first time search users -->
-    <string name="search_edu_primary">Search your phone for apps, people, settings and more!</string>
-    <!-- secondary educational text shown for first time search users -->
-    <string name="search_edu_secondary">Tap keyboard search button to launch the first search
-        result.</string>
-
-    <!-- Dismiss button string for search education view -->
-    <string name="search_edu_dismiss">Got it.</string>
     <!-- Feedback shown during interactive parts of Back gesture tutorial for left edge when the gesture is too far from the edge. [CHAR LIMIT=100] -->
     <string name="back_gesture_feedback_swipe_too_far_from_left_edge">Make sure you swipe from the far-left edge.</string>
     <!-- Feedback shown during interactive parts of Back gesture tutorial for left edge when the gesture is cancelled. [CHAR LIMIT=100] -->
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index 085db6d..e9ded8a 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -92,6 +92,7 @@
     private final TaskbarStateHandler mTaskbarStateHandler = new TaskbarStateHandler(this);
     // Will be updated when dragging from taskbar.
     private @Nullable DragOptions mNextWorkspaceDragOptions = null;
+    private SplitPlaceholderView mSplitPlaceholderView;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -215,12 +216,12 @@
 
         SysUINavigationMode.INSTANCE.get(this).updateMode();
         mActionsView = findViewById(R.id.overview_actions_view);
-        SplitPlaceholderView splitPlaceholderView = findViewById(R.id.split_placeholder);
+        mSplitPlaceholderView = findViewById(R.id.split_placeholder);
         RecentsView overviewPanel = (RecentsView) getOverviewPanel();
-        splitPlaceholderView.init(
+        mSplitPlaceholderView.init(
                 new SplitSelectStateController(SystemUiProxy.INSTANCE.get(this))
         );
-        overviewPanel.init(mActionsView, splitPlaceholderView);
+        overviewPanel.init(mActionsView, mSplitPlaceholderView);
         mActionsView.updateVerticalMargin(SysUINavigationMode.getMode(this));
 
         mAppTransitionManager = new QuickstepTransitionManager(this);
@@ -256,6 +257,10 @@
         return (T) mActionsView;
     }
 
+    public SplitPlaceholderView getSplitPlaceholderView() {
+        return mSplitPlaceholderView;
+    }
+
     @Override
     protected void closeOpenViews(boolean animate) {
         super.closeOpenViews(animate);
diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
index 8e92b59..cc3ccea 100644
--- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
@@ -237,7 +237,9 @@
             setTranslationY(scroll);
         }
         setAlpha(mScrolledOut ? 0 : 1);
-        AlphaUpdateListener.updateVisibility(this);
+        if (getVisibility() != GONE) {
+            AlphaUpdateListener.updateVisibility(this);
+        }
     }
 
     @Override
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarContainerView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarContainerView.java
index 5202d91..ccf6b41 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarContainerView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarContainerView.java
@@ -27,7 +27,6 @@
 import androidx.annotation.Nullable;
 
 import com.android.launcher3.R;
-import com.android.launcher3.anim.AlphaUpdateListener;
 import com.android.launcher3.util.TouchController;
 import com.android.launcher3.views.BaseDragLayer;
 import com.android.systemui.shared.system.ViewTreeObserverWrapper;
@@ -83,18 +82,13 @@
 
     private ViewTreeObserverWrapper.OnComputeInsetsListener createTaskbarInsetsComputer() {
         return insetsInfo -> {
-            if (getAlpha() < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD
-                    || mTaskbarView.getVisibility() != VISIBLE || mTaskbarView.isDraggingItem()) {
-                // We're invisible or dragging out of taskbar, let touches pass through us.
+            if (mControllerCallbacks.isTaskbarTouchable()) {
+                 // Accept touches anywhere in our bounds.
+                insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME);
+            } else {
+                // Let touches pass through us.
                 insetsInfo.touchableRegion.setEmpty();
                 insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION);
-                // TODO(b/182234653): Shouldn't need to do this, but for the meantime, reporting
-                // that visibleInsets is empty allows DragEvents through. Setting them as completely
-                // empty reverts to default behavior, so set 1 px instead.
-                insetsInfo.visibleInsets.set(0, 0, 0, 1);
-            } else {
-                 // We're visible again, accept touches anywhere in our bounds.
-                insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME);
             }
 
             // TaskbarContainerView provides insets to other apps based on contentInsets. These
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java
index de23ad2..559ede1 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarController.java
@@ -42,6 +42,7 @@
 import com.android.launcher3.LauncherState;
 import com.android.launcher3.QuickstepTransitionManager;
 import com.android.launcher3.R;
+import com.android.launcher3.anim.AlphaUpdateListener;
 import com.android.launcher3.anim.PendingAnimation;
 import com.android.launcher3.folder.Folder;
 import com.android.launcher3.folder.FolderIcon;
@@ -88,7 +89,6 @@
 
     private @Nullable Animator mAnimator;
     private boolean mIsAnimatingToLauncher;
-    private boolean mIsAnimatingToApp;
 
     public TaskbarController(BaseQuickstepLauncher launcher,
             TaskbarContainerView taskbarContainerView, TaskbarView taskbarViewOnHome) {
@@ -141,6 +141,13 @@
                     setTaskbarWindowFullscreen(false);
                 }
             }
+
+            @Override
+            public boolean isTaskbarTouchable() {
+                return mTaskbarContainerView.getAlpha() > AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD
+                        && mTaskbarViewInApp.getVisibility() == View.VISIBLE
+                        && !mIsAnimatingToLauncher;
+            }
         };
     }
 
@@ -250,7 +257,9 @@
         mHotseatController.init();
         mRecentsController.init();
 
-        updateWhichTaskbarViewIsVisible();
+        setWhichTaskbarViewIsVisible(mLauncher.hasBeenResumed()
+                ? mTaskbarViewOnHome
+                : mTaskbarViewInApp);
     }
 
     private TaskbarStateHandlerCallbacks createTaskbarStateHandlerCallbacks() {
@@ -284,6 +293,8 @@
         mTaskbarAnimationController.cleanup();
         mHotseatController.cleanup();
         mRecentsController.cleanup();
+
+        setWhichTaskbarViewIsVisible(null);
     }
 
     private void removeFromWindowManager() {
@@ -364,7 +375,7 @@
             @Override
             public void onAnimationEnd(Animator animation) {
                 mIsAnimatingToLauncher = false;
-                updateWhichTaskbarViewIsVisible();
+                setWhichTaskbarViewIsVisible(mTaskbarViewOnHome);
             }
         });
 
@@ -377,14 +388,12 @@
         anim.addListener(new AnimatorListenerAdapter() {
             @Override
             public void onAnimationStart(Animator animation) {
-                mIsAnimatingToApp = true;
                 mTaskbarViewInApp.updateHotseatItemsVisibility();
-                updateWhichTaskbarViewIsVisible();
+                setWhichTaskbarViewIsVisible(mTaskbarViewInApp);
             }
 
             @Override
             public void onAnimationEnd(Animator animation) {
-                mIsAnimatingToApp = false;
             }
         });
         return anim.buildAnim();
@@ -487,18 +496,12 @@
                 mTaskbarViewOnHome.getHeight() - hotseatBounds.bottom);
     }
 
-    private void updateWhichTaskbarViewIsVisible() {
-        boolean isInApp = !mLauncher.hasBeenResumed() || mIsAnimatingToLauncher
-                || mIsAnimatingToApp;
-        if (isInApp) {
-            mTaskbarViewInApp.setVisibility(View.VISIBLE);
-            mTaskbarViewOnHome.setVisibility(View.INVISIBLE);
-            mLauncher.getHotseat().setIconsAlpha(0);
-        } else {
-            mTaskbarViewInApp.setVisibility(View.INVISIBLE);
-            mTaskbarViewOnHome.setVisibility(View.VISIBLE);
-            mLauncher.getHotseat().setIconsAlpha(1);
-        }
+    private void setWhichTaskbarViewIsVisible(@Nullable TaskbarView visibleTaskbar) {
+        mTaskbarViewInApp.setVisibility(visibleTaskbar == mTaskbarViewInApp
+                ? View.VISIBLE : View.INVISIBLE);
+        mTaskbarViewOnHome.setVisibility(visibleTaskbar == mTaskbarViewOnHome
+                ? View.VISIBLE : View.INVISIBLE);
+        mLauncher.getHotseat().setIconsAlpha(visibleTaskbar != mTaskbarViewInApp ? 1f : 0f);
     }
 
     /**
@@ -549,6 +552,7 @@
      */
     protected interface TaskbarContainerViewCallbacks {
         void onViewRemoved();
+        boolean isTaskbarTouchable();
     }
 
     /**
diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
index d36af09..01616d4 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java
@@ -18,12 +18,9 @@
 
 import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT;
 import static com.android.launcher3.anim.Interpolators.LINEAR;
-import static com.android.launcher3.graphics.OverviewScrim.SCRIM_MULTIPLIER;
-import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS;
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MODAL;
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
-import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE;
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
 import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
@@ -40,7 +37,6 @@
 import com.android.launcher3.BaseQuickstepLauncher;
 import com.android.launcher3.LauncherState;
 import com.android.launcher3.anim.PendingAnimation;
-import com.android.launcher3.graphics.OverviewScrim;
 import com.android.launcher3.statemanager.StateManager.StateHandler;
 import com.android.launcher3.states.StateAnimationConfig;
 import com.android.launcher3.touch.PagedOrientationHandler;
@@ -70,9 +66,6 @@
         TASK_SECONDARY_TRANSLATION.set(mRecentsView, 0f);
 
         getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0);
-        OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim();
-        SCRIM_PROGRESS.set(scrim, state.getOverviewScrimAlpha(mLauncher));
-        SCRIM_MULTIPLIER.set(scrim, 1f);
         getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness());
         RECENTS_GRID_PROGRESS.set(mRecentsView,
                 state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f);
@@ -111,11 +104,6 @@
 
         setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0,
                 config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT));
-        OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim();
-        setter.setFloat(scrim, SCRIM_PROGRESS, toState.getOverviewScrimAlpha(mLauncher),
-                config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR));
-        setter.setFloat(scrim, SCRIM_MULTIPLIER, 1f,
-                config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR));
 
         setter.setFloat(
                 mRecentsView, getTaskModalnessProperty(),
diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index 6929b5d..9097c8b 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) ?
-                1 : 0;
+                0.7f : 0;
         propertySetter.setFloat(mRecentsView.getSplitPlaceholder(), ALPHA_FLOAT,
                 splitPlaceholderAlpha, LINEAR);
     }
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index b2f8a40..4e03971 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -90,4 +90,9 @@
     public LauncherState getHistoryForState(LauncherState previousState) {
         return previousState == OVERVIEW ? OVERVIEW : NORMAL;
     }
+
+    @Override
+    public float getWorkspaceScrimAlpha(Launcher launcher) {
+        return 1;
+    }
 }
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
index 95a855a..6cdeb0f 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -103,7 +103,7 @@
     }
 
     @Override
-    public float getOverviewScrimAlpha(Launcher launcher) {
+    public float getWorkspaceScrimAlpha(Launcher launcher) {
         return 1f;
     }
 
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
index a990f3e..b8caf81 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
@@ -44,7 +44,6 @@
 import com.android.launcher3.anim.PendingAnimation;
 import com.android.launcher3.compat.AccessibilityManagerCompat;
 import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.graphics.OverviewScrim;
 import com.android.launcher3.states.StateAnimationConfig;
 import com.android.launcher3.touch.SingleAxisSwipeDetector;
 import com.android.launcher3.util.TouchController;
@@ -141,10 +140,6 @@
             AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher,
                     builder);
 
-            builder.setFloat(mLauncher.getDragLayer().getOverviewScrim(),
-                    OverviewScrim.SCRIM_MULTIPLIER, OVERVIEW_TO_HOME_SCRIM_MULTIPLIER,
-                    PULLBACK_INTERPOLATOR);
-
             if (LIVE_TILE.get()) {
                 builder.addOnFrameCallback(recentsView::redrawLiveTile);
             }
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
index 0921ad3..74a253e 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
@@ -16,6 +16,7 @@
 
 package com.android.launcher3.uioverrides.touchcontrollers;
 
+import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
 import static com.android.launcher3.LauncherAnimUtils.newCancelListener;
 import static com.android.launcher3.LauncherState.ALL_APPS;
 import static com.android.launcher3.LauncherState.HINT_STATE;
@@ -45,7 +46,6 @@
 import com.android.launcher3.Utilities;
 import com.android.launcher3.anim.AnimatorPlaybackController;
 import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.graphics.OverviewScrim;
 import com.android.launcher3.states.StateAnimationConfig;
 import com.android.launcher3.util.VibratorWrapper;
 import com.android.quickstep.SystemUiProxy;
@@ -111,7 +111,7 @@
         float progressMultiplier = super.initCurrentAnimation();
         if (mToState == HINT_STATE) {
             // Track the drag across the entire height of the screen.
-            progressMultiplier = -1 / getShiftRange();
+            progressMultiplier = -1f / mLauncher.getDeviceProfile().heightPx;
         }
         return progressMultiplier;
     }
@@ -128,10 +128,10 @@
 
         if (mFromState == NORMAL && mToState == HINT_STATE) {
             mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofFloat(
-                    mLauncher.getDragLayer().getOverviewScrim(),
-                    OverviewScrim.SCRIM_PROGRESS,
-                    mFromState.getOverviewScrimAlpha(mLauncher),
-                    mToState.getOverviewScrimAlpha(mLauncher));
+                    mLauncher.getScrimView(),
+                    VIEW_ALPHA,
+                    mFromState.getWorkspaceScrimAlpha(mLauncher),
+                    mToState.getWorkspaceScrimAlpha(mLauncher));
         }
         mStartedOverview = false;
         mReachedOverview = false;
@@ -182,13 +182,13 @@
         }
         mNormalToHintOverviewScrimAnimator = null;
         mCurrentAnimation.getTarget().addListener(newCancelListener(() ->
-            mLauncher.getStateManager().goToState(OVERVIEW, true, () -> {
-                mOverviewResistYAnim = AnimatorControllerWithResistance
-                        .createRecentsResistanceFromOverviewAnim(mLauncher, null)
-                        .createPlaybackController();
-                mReachedOverview = true;
-                maybeSwipeInteractionToOverviewComplete();
-            })));
+                mLauncher.getStateManager().goToState(OVERVIEW, true, () -> {
+                    mOverviewResistYAnim = AnimatorControllerWithResistance
+                            .createRecentsResistanceFromOverviewAnim(mLauncher, null)
+                            .createPlaybackController();
+                    mReachedOverview = true;
+                    maybeSwipeInteractionToOverviewComplete();
+                })));
 
         mCurrentAnimation.getTarget().removeListener(mClearStateOnCancelListener);
         mCurrentAnimation.dispatchOnCancel();
@@ -239,7 +239,7 @@
     private void goToOverviewOrHomeOnDragEnd(float velocity) {
         boolean goToHomeInsteadOfOverview = !mMotionPauseDetector.isPaused();
         if (goToHomeInsteadOfOverview) {
-            new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL))
+            new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(NORMAL))
                     .animateWithVelocity(velocity);
         }
         if (mReachedOverview) {
@@ -275,17 +275,14 @@
             LauncherState fromState, LauncherState toState) {
         if (fromState == NORMAL && toState == ALL_APPS) {
             StateAnimationConfig builder = new StateAnimationConfig();
-            // Fade in prediction icons quickly, then rest of all apps after reaching overview.
-            float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher)
-                    - OVERVIEW.getVerticalProgress(mLauncher);
             builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(
                     ACCEL,
                     0,
-                    ALL_APPS_CONTENT_FADE_THRESHOLD));
+                    ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
             builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(
                     ACCEL,
-                    progressToReachOverview,
-                    progressToReachOverview + ALL_APPS_CONTENT_FADE_THRESHOLD));
+                    ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD,
+                    ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
 
             // Get workspace out of the way quickly, to prepare for potential pause.
             builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3);
@@ -294,15 +291,14 @@
             return builder;
         } else if (fromState == ALL_APPS && toState == NORMAL) {
             StateAnimationConfig builder = new StateAnimationConfig();
-            // Keep all apps/predictions opaque until the very end of the transition.
-            float progressToReachOverview = OVERVIEW.getVerticalProgress(mLauncher);
+
             builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(
                     DEACCEL,
-                    progressToReachOverview - ALL_APPS_CONTENT_FADE_THRESHOLD,
-                    progressToReachOverview));
+                    1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
+                    1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
             builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(
                     DEACCEL,
-                    1 - ALL_APPS_CONTENT_FADE_THRESHOLD,
+                    1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
                     1));
             return builder;
         }
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
index 61cd13b..697516d 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
@@ -15,6 +15,7 @@
  */
 package com.android.launcher3.uioverrides.touchcontrollers;
 
+import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
 import static com.android.launcher3.LauncherAnimUtils.newCancelListener;
 import static com.android.launcher3.LauncherState.NORMAL;
 import static com.android.launcher3.LauncherState.OVERVIEW;
@@ -59,7 +60,6 @@
 import com.android.launcher3.Utilities;
 import com.android.launcher3.anim.AnimatorPlaybackController;
 import com.android.launcher3.anim.PendingAnimation;
-import com.android.launcher3.graphics.OverviewScrim;
 import com.android.launcher3.states.StateAnimationConfig;
 import com.android.launcher3.touch.BaseSwipeDetector;
 import com.android.launcher3.touch.BothAxesSwipeDetector;
@@ -231,8 +231,8 @@
         //   - OverviewScrim
         PendingAnimation xAnim = new PendingAnimation((long) (mXRange * 2));
         xAnim.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1], LINEAR);
-        xAnim.setFloat(mLauncher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_PROGRESS,
-                toState.getOverviewScrimAlpha(mLauncher), LINEAR);
+        xAnim.setFloat(mLauncher.getScrimView(), VIEW_ALPHA,
+                toState.getWorkspaceScrimAlpha(mLauncher), LINEAR);
         mXOverviewAnim = xAnim.createPlaybackController();
         mXOverviewAnim.dispatchOnStart();
 
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
index 1af9685..b8f9452 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
@@ -49,9 +49,15 @@
     private static final String TAG = "PortraitStatesTouchCtrl";
 
     /**
-     * The progress at which all apps content will be fully visible when swiping up from overview.
+     * The progress at which all apps content will be fully visible.
      */
-    protected static final float ALL_APPS_CONTENT_FADE_THRESHOLD = 0.08f;
+    protected static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f;
+
+    /**
+     * Minimum clamping progress for fading in all apps content
+     */
+    protected static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.4f;
+
 
     /**
      * The progress at which recents will begin fading out when swiping up from overview.
@@ -116,14 +122,14 @@
     private StateAnimationConfig getNormalToAllAppsAnimation() {
         StateAnimationConfig builder = new StateAnimationConfig();
         builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(ACCEL,
-                0, ALL_APPS_CONTENT_FADE_THRESHOLD));
+                0, ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
         return builder;
     }
 
     private StateAnimationConfig getAllAppsToNormalAnimation() {
         StateAnimationConfig builder = new StateAnimationConfig();
         builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL,
-                1 - ALL_APPS_CONTENT_FADE_THRESHOLD, 1));
+                1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, 1));
         return builder;
     }
 
@@ -135,7 +141,7 @@
             config = getNormalToAllAppsAnimation();
         } else if (fromState == ALL_APPS && toState == NORMAL) {
             config = getAllAppsToNormalAnimation();
-        }  else {
+        } else {
             config = new StateAnimationConfig();
         }
         return config;
@@ -198,7 +204,7 @@
      * Whether the motion event is over the hotseat.
      *
      * @param launcher the launcher activity
-     * @param ev the event to check
+     * @param ev       the event to check
      * @return true if the event is over the hotseat
      */
     static boolean isTouchOverHotseat(Launcher launcher, MotionEvent ev) {
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index b7c6743..2a903eb 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -217,6 +217,8 @@
 
     // Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise
     private RunningWindowAnim mRunningWindowAnim;
+    // Possible second animation running at the same time as mRunningWindowAnim
+    private Animator mParallelRunningAnim;
     private boolean mIsMotionPaused;
     private boolean mHasMotionEverBeenPaused;
 
@@ -317,9 +319,9 @@
         mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
                 this::invalidateHandlerWithLauncher);
         mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_RESUME_LAST_TASK,
-                this::notifyTransitionCancelled);
+                this::resetStateForAnimationCancel);
         mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_FINISH_WITH_NO_END,
-                this::notifyTransitionCancelled);
+                this::resetStateForAnimationCancel);
 
         if (!LIVE_TILE.get()) {
             mStateCallback.addChangeListener(STATE_APP_CONTROLLER_RECEIVED | STATE_LAUNCHER_PRESENT
@@ -798,6 +800,13 @@
                 mRunningWindowAnim.end();
             }
         }
+        if (mParallelRunningAnim != null) {
+            if (cancel) {
+                mParallelRunningAnim.cancel();
+            } else {
+                mParallelRunningAnim.end();
+            }
+        }
     }
 
     private void onSettledOnEndTarget() {
@@ -1060,7 +1069,11 @@
             ActivityManagerWrapper.getInstance().registerTaskStackListener(
                     mActivityRestartListener);
 
-            mActivityInterface.onAnimateToLauncher(mGestureState.getEndTarget(), duration);
+            mParallelRunningAnim = mActivityInterface.getParallelAnimationToLauncher(
+                    mGestureState.getEndTarget(), duration);
+            if (mParallelRunningAnim != null) {
+                mParallelRunningAnim.start();
+            }
         }
 
         if (mGestureState.getEndTarget() == HOME) {
@@ -1370,10 +1383,6 @@
         mActivity.getRootView().setOnApplyWindowInsetsListener(null);
     }
 
-    private void notifyTransitionCancelled() {
-        mAnimationFactory.onTransitionCancelled();
-    }
-
     private void resetStateForAnimationCancel() {
         boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted;
         mActivityInterface.onTransitionCancelled(wasVisible);
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index 3afffc1..147297a 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -347,7 +347,9 @@
      * Called when the gesture ends and the animation starts towards the given target. No-op by
      * default, but subclasses can override to add an additional animation with the same duration.
      */
-    public void onAnimateToLauncher(GestureState.GestureEndTarget endTarget, long duration) {
+    public @Nullable Animator getParallelAnimationToLauncher(
+            GestureState.GestureEndTarget endTarget, long duration) {
+        return null;
     }
 
     /**
@@ -366,8 +368,6 @@
 
         void createActivityInterface(long transitionLength);
 
-        default void onTransitionCancelled() { }
-
         /**
          * @param attached Whether to show RecentsView alongside the app window. If false, recents
          *                 will be hidden by some property we can animate, e.g. alpha.
@@ -434,11 +434,6 @@
         }
 
         @Override
-        public void onTransitionCancelled() {
-            mActivity.getStateManager().goToState(mStartState, false /* animate */);
-        }
-
-        @Override
         public void setRecentsAttachedToAppWindow(boolean attached, boolean animate) {
             if (mIsAttachedToWindow == attached && animate) {
                 return;
diff --git a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
index 98b96b2..878f5c9 100644
--- a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java
@@ -22,6 +22,7 @@
 import static com.android.launcher3.anim.Interpolators.LINEAR;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING;
 
+import android.animation.Animator;
 import android.content.Context;
 import android.graphics.Rect;
 import android.view.MotionEvent;
@@ -267,13 +268,14 @@
     }
 
     @Override
-    public void onAnimateToLauncher(GestureEndTarget endTarget, long duration) {
+    public @Nullable Animator getParallelAnimationToLauncher(GestureEndTarget endTarget,
+            long duration) {
         TaskbarController taskbarController = getTaskbarController();
         if (taskbarController == null) {
-            return;
+            return null;
         }
         LauncherState toState = stateFromGestureEndTarget(endTarget);
-        taskbarController.createAnimToLauncher(toState, duration).start();
+        return taskbarController.createAnimToLauncher(toState, duration);
     }
 
     @Override
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 79db842..558230b 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -183,7 +183,6 @@
         boolean parallaxCenterAndAdjacentTask =
                 taskIndex != recentsView.getCurrentPage() && !(dp.isTablet
                         && FeatureFlags.ENABLE_OVERVIEW_GRID.get());
-        float gridProgress = recentsView.getGridProgress();
         float gridTranslationSecondary = recentsView.getGridTranslationSecondary(taskIndex);
         int startScroll = recentsView.getScrollOffset(taskIndex);
 
@@ -216,7 +215,8 @@
                     AnimatedFloat.VALUE, tsv.getFullScreenScale(), TOUCH_RESPONSE_INTERPOLATOR);
             out.setFloat(tsv.taskSecondaryTranslation, AnimatedFloat.VALUE, 0,
                     TOUCH_RESPONSE_INTERPOLATOR_ACCEL_DEACCEL);
-            out.setInt(tsv, TaskViewSimulator.SCROLL, 0, TOUCH_RESPONSE_INTERPOLATOR);
+            out.setFloat(tsv.recentsViewScroll, AnimatedFloat.VALUE, 0,
+                    TOUCH_RESPONSE_INTERPOLATOR);
 
             TaskViewSimulator finalTsv = tsv;
             TransformParams finalParams = params;
@@ -374,7 +374,8 @@
                     AnimatedFloat.VALUE, 1, TOUCH_RESPONSE_INTERPOLATOR);
             out.setFloat(tvs.recentsViewScale,
                     AnimatedFloat.VALUE, tvs.getFullScreenScale(), TOUCH_RESPONSE_INTERPOLATOR);
-            out.setInt(tvs, TaskViewSimulator.SCROLL, 0, TOUCH_RESPONSE_INTERPOLATOR);
+            out.setFloat(tvs.recentsViewScroll,
+                    AnimatedFloat.VALUE, 0, TOUCH_RESPONSE_INTERPOLATOR);
 
             TaskViewSimulator finalTsv = tvs;
             TransformParams finalParams = params;
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 1fb9465..e9d2eb4 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -239,8 +239,9 @@
         @BinderThread
         public void onSystemUiStateChanged(int stateFlags) {
             MAIN_EXECUTOR.execute(() -> {
+                int lastFlags = mDeviceState.getSystemUiStateFlags();
                 mDeviceState.setSystemUiFlags(stateFlags);
-                TouchInteractionService.this.onSystemUiFlagsChanged();
+                TouchInteractionService.this.onSystemUiFlagsChanged(lastFlags);
             });
         }
 
@@ -362,7 +363,7 @@
         mResetGestureInputConsumer = new ResetGestureInputConsumer(mTaskAnimationManager);
         mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer();
         mInputConsumer.registerInputConsumer();
-        onSystemUiFlagsChanged();
+        onSystemUiFlagsChanged(mDeviceState.getSystemUiStateFlags());
         onAssistantVisibilityChanged();
 
         // Temporarily disable model preload
@@ -414,7 +415,7 @@
     }
 
     @UiThread
-    private void onSystemUiFlagsChanged() {
+    private void onSystemUiFlagsChanged(int lastSysUIFlags) {
         if (mDeviceState.isUserUnlocked()) {
             int systemUiStateFlags = mDeviceState.getSystemUiStateFlags();
             SystemUiProxy.INSTANCE.get(this).setLastSystemUiStateFlags(systemUiStateFlags);
@@ -422,14 +423,17 @@
             mOverviewComponentObserver.getActivityInterface().onSystemUiFlagsChanged(
                     systemUiStateFlags);
 
-            // Update the tracing state
-            if ((systemUiStateFlags & SYSUI_STATE_TRACING_ENABLED) != 0) {
-                Log.d(TAG, "Starting tracing.");
-                ProtoTracer.INSTANCE.get(this).start();
-            } else {
-                Log.d(TAG, "Stopping tracing. Dumping to file="
-                    + ProtoTracer.INSTANCE.get(this).getTraceFile());
-                ProtoTracer.INSTANCE.get(this).stop();
+            if ((lastSysUIFlags & SYSUI_STATE_TRACING_ENABLED) !=
+                    (systemUiStateFlags & SYSUI_STATE_TRACING_ENABLED)) {
+                // Update the tracing state
+                if ((systemUiStateFlags & SYSUI_STATE_TRACING_ENABLED) != 0) {
+                    Log.d(TAG, "Starting tracing.");
+                    ProtoTracer.INSTANCE.get(this).start();
+                } else {
+                    Log.d(TAG, "Stopping tracing. Dumping to file="
+                            + ProtoTracer.INSTANCE.get(this).getTraceFile());
+                    ProtoTracer.INSTANCE.get(this).stop();
+                }
             }
         }
     }
diff --git a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java
index 0f2d778..2285d74 100644
--- a/quickstep/src/com/android/quickstep/util/ImageActionUtils.java
+++ b/quickstep/src/com/android/quickstep/util/ImageActionUtils.java
@@ -19,9 +19,12 @@
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
 
+import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
 import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
 import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
 
+import android.app.Activity;
+import android.app.ActivityOptions;
 import android.app.prediction.AppTarget;
 import android.content.ClipData;
 import android.content.ClipDescription;
@@ -37,11 +40,13 @@
 import android.graphics.RectF;
 import android.net.Uri;
 import android.util.Log;
+import android.view.View;
 
 import androidx.annotation.UiThread;
 import androidx.annotation.WorkerThread;
 import androidx.core.content.FileProvider;
 
+import com.android.internal.app.ChooserActivity;
 import com.android.launcher3.BuildConfig;
 import com.android.quickstep.SystemUiProxy;
 import com.android.systemui.shared.recents.model.Task;
@@ -126,6 +131,22 @@
     }
 
     /**
+     * Launch the activity to share image with shared element transition.
+     */
+    @UiThread
+    public static void startShareActivity(Context context, Supplier<Bitmap> bitmapSupplier,
+            Rect crop, Intent intent, String tag, View sharedElement) {
+        if (bitmapSupplier.get() == null) {
+            Log.e(tag, "No snapshot available, not starting share.");
+            return;
+        }
+
+        UI_HELPER_EXECUTOR.execute(() -> persistBitmapAndStartActivity(context,
+                bitmapSupplier.get(), crop, intent, ImageActionUtils::getShareIntentForImageUri,
+                tag, sharedElement));
+    }
+
+    /**
      * Starts activity based on given intent created from image uri.
      */
     @WorkerThread
@@ -142,6 +163,30 @@
     }
 
     /**
+     * Starts activity based on given intent created from image uri with shared element transition.
+     */
+    @WorkerThread
+    public static void persistBitmapAndStartActivity(Context context, Bitmap bitmap, Rect crop,
+            Intent intent, BiFunction<Uri, Intent, Intent[]> uriToIntentMap, String tag,
+            View scaledImage) {
+        Intent[] intents = uriToIntentMap.apply(getImageUri(bitmap, crop, context, tag), intent);
+
+        // Work around b/159412574
+        if (intents.length == 1) {
+            MAIN_EXECUTOR.execute(() -> context.startActivity(intents[0],
+                    ActivityOptions.makeSceneTransitionAnimation((Activity) context, scaledImage,
+                            ChooserActivity.FIRST_IMAGE_PREVIEW_TRANSITION_NAME).toBundle()));
+
+        } else {
+            MAIN_EXECUTOR.execute(() -> context.startActivities(intents,
+                    ActivityOptions.makeSceneTransitionAnimation((Activity) context, scaledImage,
+                            ChooserActivity.FIRST_IMAGE_PREVIEW_TRANSITION_NAME).toBundle()));
+        }
+    }
+
+
+
+    /**
      * Converts image bitmap to Uri by temporarily saving bitmap to cache, and creating Uri pointing
      * to that location. Used to be able to share an image with another app.
      *
diff --git a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java
index 1544f00..6d6e802 100644
--- a/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java
+++ b/quickstep/src/com/android/quickstep/util/QuickstepOnboardingPrefs.java
@@ -26,6 +26,7 @@
 import android.content.SharedPreferences;
 
 import com.android.launcher3.LauncherState;
+import com.android.launcher3.Utilities;
 import com.android.launcher3.Workspace;
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.hybridhotseat.HotseatPredictionController;
@@ -63,7 +64,8 @@
             });
         }
 
-        if (!hasReachedMaxCount(HOTSEAT_DISCOVERY_TIP_COUNT)) {
+        if (!Utilities.IS_RUNNING_IN_TEST_HARNESS
+                && !hasReachedMaxCount(HOTSEAT_DISCOVERY_TIP_COUNT)) {
             stateManager.addStateListener(new StateListener<LauncherState>() {
                 boolean mFromAllApps = false;
 
diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 6757e4c..c12bd9b 100644
--- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -18,7 +18,6 @@
 import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
 import static com.android.launcher3.LauncherState.BACKGROUND_APP;
 import static com.android.launcher3.LauncherState.NORMAL;
-import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
 import static com.android.launcher3.anim.Interpolators.LINEAR;
 import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
 import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
@@ -42,9 +41,7 @@
 import com.android.launcher3.ShortcutAndWidgetContainer;
 import com.android.launcher3.Workspace;
 import com.android.launcher3.anim.PendingAnimation;
-import com.android.launcher3.anim.PropertySetter;
 import com.android.launcher3.anim.SpringAnimationBuilder;
-import com.android.launcher3.graphics.OverviewScrim;
 import com.android.launcher3.statehandlers.DepthController;
 import com.android.launcher3.states.StateAnimationConfig;
 import com.android.launcher3.util.DynamicResource;
@@ -134,7 +131,8 @@
 
         if (animateOverviewScrim) {
             PendingAnimation pendingAnimation = new PendingAnimation(DURATION_MS);
-            addScrimAnimationForState(launcher, NORMAL, pendingAnimation);
+            launcher.getWorkspace().getStateTransitionAnimation()
+                    .setScrim(pendingAnimation, NORMAL, new StateAnimationConfig());
             mAnimators.play(pendingAnimation.buildAnim());
         }
 
@@ -192,7 +190,8 @@
         launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true);
 
         if (animateOverviewScrim) {
-            addScrimAnimationForState(launcher, BACKGROUND_APP, NO_ANIM_PROPERTY_SETTER);
+            launcher.getWorkspace().getStateTransitionAnimation()
+                    .setScrim(NO_ANIM_PROPERTY_SETTER, BACKGROUND_APP, config);
         }
     }
 
@@ -263,16 +262,6 @@
         mAnimators.play(alpha);
     }
 
-    private void addScrimAnimationForState(Launcher launcher, LauncherState state,
-            PropertySetter setter) {
-        launcher.getWorkspace().getStateTransitionAnimation().setScrim(setter, state);
-        setter.setFloat(
-                launcher.getDragLayer().getOverviewScrim(),
-                OverviewScrim.SCRIM_PROGRESS,
-                state.getOverviewScrimAlpha(launcher),
-                ACCEL_DEACCEL);
-    }
-
     private void addDepthAnimationForState(Launcher launcher, LauncherState state, long duration) {
         if (!(launcher instanceof BaseQuickstepLauncher)) {
             return;
diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
index 3c8a12c..e63f8bb 100644
--- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
+++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
@@ -30,17 +30,14 @@
 import android.graphics.PointF;
 import android.graphics.Rect;
 import android.graphics.RectF;
-import android.util.IntProperty;
 
 import androidx.annotation.NonNull;
 
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.anim.PendingAnimation;
-import com.android.launcher3.touch.PagedOrientationHandler;
 import com.android.quickstep.AnimatedFloat;
 import com.android.quickstep.BaseActivityInterface;
-import com.android.quickstep.views.RecentsView.ScrollState;
 import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
 import com.android.quickstep.views.TaskView.FullscreenDrawParams;
 import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -52,19 +49,6 @@
  */
 public class TaskViewSimulator implements TransformParams.BuilderProxy {
 
-    public static final IntProperty<TaskViewSimulator> SCROLL =
-            new IntProperty<TaskViewSimulator>("scroll") {
-                @Override
-                public void setValue(TaskViewSimulator simulator, int scroll) {
-                    simulator.setScroll(scroll);
-                }
-
-                @Override
-                public Integer get(TaskViewSimulator simulator) {
-                    return simulator.mScrollState.scroll;
-                }
-            };
-
     private final Rect mTmpCropRect = new Rect();
     private final RectF mTempRectF = new RectF();
     private final float[] mTempPoint = new float[2];
@@ -101,11 +85,10 @@
     public final AnimatedFloat fullScreenProgress = new AnimatedFloat();
     public final AnimatedFloat recentsViewSecondaryTranslation = new AnimatedFloat();
     public final AnimatedFloat recentsViewPrimaryTranslation = new AnimatedFloat();
-    private final ScrollState mScrollState = new ScrollState();
+    public final AnimatedFloat recentsViewScroll = new AnimatedFloat();
 
     // Cached calculations
     private boolean mLayoutValid = false;
-    private boolean mScrollValid = false;
     private int mOrientationStateId;
 
     public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
@@ -172,11 +155,8 @@
     /**
      * Updates the scroll for RecentsView
      */
-    public void setScroll(int scroll) {
-        if (mScrollState.scroll != scroll) {
-            mScrollState.scroll = scroll;
-            mScrollValid = false;
-        }
+    public void setScroll(float scroll) {
+        recentsViewScroll.value = scroll;
     }
 
     public void setDrawsBelowRecents(boolean drawsBelowRecents) {
@@ -268,20 +248,6 @@
                     mTaskRect.width(), mTaskRect.height(),
                     mDp, mOrientationState.getRecentsActivityRotation(), isRtlEnabled);
             mPositionHelper.getMatrix().invert(mInversePositionMatrix);
-
-            PagedOrientationHandler poh = mOrientationState.getOrientationHandler();
-            mScrollState.halfPageSize =
-                    poh.getPrimaryValue(mTaskRect.width(), mTaskRect.height()) / 2;
-            mScrollState.halfScreenSize = poh.getPrimaryValue(mDp.widthPx, mDp.heightPx) / 2;
-            mScrollValid = false;
-        }
-
-        if (!mScrollValid) {
-            mScrollValid = true;
-            int start = mOrientationState.getOrientationHandler()
-                    .getPrimaryValue(mTaskRect.left, mTaskRect.top);
-            mScrollState.screenCenter = start + mScrollState.scroll + mScrollState.halfPageSize;
-            mScrollState.updateInterpolation(mDp, start);
         }
 
         float fullScreenProgress = Utilities.boundToRange(this.fullScreenProgress.value, 0, 1);
@@ -306,7 +272,7 @@
         mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
                 taskSecondaryTranslation.value);
         mOrientationState.getOrientationHandler().set(
-                mMatrix, MATRIX_POST_TRANSLATE, mScrollState.scroll);
+                mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
 
         // Apply RecentsView matrix
         mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y);
diff --git a/quickstep/src/com/android/quickstep/views/ClearAllButton.java b/quickstep/src/com/android/quickstep/views/ClearAllButton.java
index d616f7c..4300329 100644
--- a/quickstep/src/com/android/quickstep/views/ClearAllButton.java
+++ b/quickstep/src/com/android/quickstep/views/ClearAllButton.java
@@ -23,10 +23,8 @@
 
 import com.android.launcher3.statemanager.StatefulActivity;
 import com.android.launcher3.touch.PagedOrientationHandler;
-import com.android.quickstep.views.RecentsView.PageCallbacks;
-import com.android.quickstep.views.RecentsView.ScrollState;
 
-public class ClearAllButton extends Button implements PageCallbacks {
+public class ClearAllButton extends Button {
 
     public static final FloatProperty<ClearAllButton> VISIBILITY_ALPHA =
             new FloatProperty<ClearAllButton>("visibilityAlpha") {
@@ -99,8 +97,7 @@
         }
     }
 
-    @Override
-    public void onPageScroll(ScrollState scrollState, boolean gridEnabled) {
+    public void onRecentsViewScroll(int scrollFromEdge, boolean gridEnabled) {
         RecentsView recentsView = getRecentsView();
         if (recentsView == null) {
             return;
@@ -113,7 +110,7 @@
         }
 
         int leftEdgeScroll = recentsView.getLeftMostChildScroll();
-        float adjustedScrollFromEdge = scrollState.scrollFromEdge - leftEdgeScroll;
+        int adjustedScrollFromEdge = scrollFromEdge - leftEdgeScroll;
         float shift = Math.min(adjustedScrollFromEdge, orientationSize);
         mNormalTranslationPrimary = mIsRtl ? -shift : shift;
         if (!gridEnabled) {
diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
index 25ae055..7c8041c 100644
--- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
+++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
@@ -30,6 +30,7 @@
 import android.content.pm.LauncherApps;
 import android.content.pm.LauncherApps.AppUsageLimit;
 import android.graphics.Outline;
+import android.graphics.Paint;
 import android.icu.text.MeasureFormat;
 import android.icu.text.MeasureFormat.FormatWidth;
 import android.icu.util.Measure;
@@ -48,6 +49,7 @@
 import com.android.launcher3.BaseActivity;
 import com.android.launcher3.BaseDraggingActivity;
 import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
 import com.android.systemui.shared.recents.model.Task;
 
 import java.time.Duration;
@@ -70,7 +72,6 @@
     private View mBanner;
     private ViewOutlineProvider mOldBannerOutlineProvider;
     private float mBannerOffsetPercentage;
-    private float mBannerAlpha = 1f;
     private float mVerticalOffset = 0f;
 
     public DigitalWellBeingToast(BaseDraggingActivity activity, TaskView taskView) {
@@ -97,10 +98,6 @@
 
         mTaskView.setContentDescription(
                 getContentDescriptionForTask(mTask, appUsageLimitTimeMs, appRemainingTimeMs));
-        RecentsView rv = mTaskView.getRecentsView();
-        if (rv != null) {
-            rv.onDigitalWellbeingToastShown();
-        }
     }
 
     public String getText() {
@@ -266,7 +263,6 @@
         layoutParams.bottomMargin = ((ViewGroup.MarginLayoutParams)
                 mTaskView.getThumbnail().getLayoutParams()).bottomMargin;
         mBanner.setTranslationY(mBannerOffsetPercentage * mBanner.getHeight());
-        mBanner.setAlpha(mBannerAlpha);
         mTaskView.addView(mBanner);
     }
 
@@ -291,10 +287,16 @@
         }
     }
 
-    void updateBannerAlpha(float alpha) {
-        if (mBanner != null && mBannerAlpha != alpha) {
-            mBannerAlpha = alpha;
-            mBanner.setAlpha(alpha);
+    void setBannerColorTint(int color, float amount) {
+        if (mBanner == null) {
+            return;
         }
+        if (amount == 0) {
+            mBanner.setLayerType(View.LAYER_TYPE_NONE, null);
+        }
+        Paint layerPaint = new Paint();
+        layerPaint.setColorFilter(Utilities.makeColorTintingColorFilter(color, amount));
+        mBanner.setLayerType(View.LAYER_TYPE_HARDWARE, layerPaint);
+        mBanner.setLayerPaint(layerPaint);
     }
 }
diff --git a/quickstep/src/com/android/quickstep/views/IconView.java b/quickstep/src/com/android/quickstep/views/IconView.java
index ed642df..5b0ade0 100644
--- a/quickstep/src/com/android/quickstep/views/IconView.java
+++ b/quickstep/src/com/android/quickstep/views/IconView.java
@@ -21,6 +21,8 @@
 import android.util.AttributeSet;
 import android.view.View;
 
+import com.android.launcher3.Utilities;
+
 /**
  * A view which draws a drawable stretched to fit its size. Unlike ImageView, it avoids relayout
  * when the drawable changes.
@@ -102,4 +104,16 @@
             setVisibility(INVISIBLE);
         }
     }
+
+    /**
+     * Set the tint color of the icon, useful for scrimming or dimming.
+     *
+     * @param color to blend in.
+     * @param amount [0,1] 0 no tint, 1 full tint
+     */
+    public void setIconColorTint(int color, float amount) {
+        if (mDrawable != null) {
+            mDrawable.setColorFilter(Utilities.makeColorTintingColorFilter(color, amount));
+        }
+    }
 }
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index 896d1ae..f5a8ff8 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -149,9 +149,10 @@
     }
 
     @Override
-    protected boolean shouldStealTouchFromSiblingsBelow(MotionEvent ev) {
-        return mActivity.getStateManager().getState().overviewUi
-                && super.shouldStealTouchFromSiblingsBelow(ev);
+    public boolean onTouchEvent(MotionEvent ev) {
+        boolean result = super.onTouchEvent(ev);
+        // Do not let touch escape to siblings below this view.
+        return result || mActivity.getStateManager().getState().overviewUi;
     }
 
     @Override
diff --git a/quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java b/quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java
index 1ea6d4a..16bc3bc 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsExtraViewContainer.java
@@ -23,7 +23,7 @@
 /**
  * Empty view to house recents overview extra card
  */
-public class RecentsExtraViewContainer extends FrameLayout implements RecentsView.PageCallbacks {
+public class RecentsExtraViewContainer extends FrameLayout {
 
     private boolean mScrollable = false;
 
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 29dd0b4..66d621e 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -20,6 +20,8 @@
 import static android.view.View.MeasureSpec.EXACTLY;
 import static android.view.View.MeasureSpec.makeMeasureSpec;
 
+import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU;
+import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
 import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
 import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS;
 import static com.android.launcher3.LauncherAnimUtils.SUCCESS_TRANSITION_PROGRESS;
@@ -114,7 +116,6 @@
 import com.android.launcher3.statemanager.StatefulActivity;
 import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.touch.PagedOrientationHandler;
-import com.android.launcher3.touch.PagedOrientationHandler.CurveProperties;
 import com.android.launcher3.util.DynamicResource;
 import com.android.launcher3.util.IntSet;
 import com.android.launcher3.util.MultiValueAlpha;
@@ -167,8 +168,6 @@
         InvariantDeviceProfile.OnIDPChangeListener, TaskVisualsChangeListener,
         SplitScreenBounds.OnChangeListener {
 
-    private static final String TAG = RecentsView.class.getSimpleName();
-
     public static final FloatProperty<RecentsView> CONTENT_ALPHA =
             new FloatProperty<RecentsView>("contentAlpha") {
                 @Override
@@ -332,7 +331,6 @@
      */
     private boolean mGestureActive;
 
-    private final ScrollState mScrollState = new ScrollState();
     // Keeps track of the previously known visible tasks for purposes of loading/unloading task data
     private final SparseBooleanArray mHasVisibleTaskData = new SparseBooleanArray();
 
@@ -342,7 +340,6 @@
 
     private final TaskOverlayFactory mTaskOverlayFactory;
 
-    private boolean mDwbToastShown;
     protected boolean mDisallowScrollToClearAll;
     private boolean mOverlayEnabled;
     protected boolean mFreezeViewVisibility;
@@ -559,6 +556,7 @@
                 .getDimension(R.dimen.recents_empty_message_text_size));
         mEmptyMessagePaint.setTypeface(Typeface.create(Themes.getDefaultBodyFont(context),
                 Typeface.NORMAL));
+        mEmptyMessagePaint.setAntiAlias(true);
         mEmptyMessagePadding = getResources()
                 .getDimensionPixelSize(R.dimen.recents_empty_message_text_padding);
         setWillNotDraw(false);
@@ -863,12 +861,6 @@
         }
     }
 
-    public void onDigitalWellbeingToastShown() {
-        if (!mDwbToastShown) {
-            mDwbToastShown = true;
-        }
-    }
-
     /**
      * Whether the Clear All button is hidden or fully visible. Used to determine if center
      * displayed page is a task or the Clear All button.
@@ -961,9 +953,7 @@
                 break;
         }
 
-
-        // Do not let touch escape to siblings below this view.
-        return isHandlingTouch() || shouldStealTouchFromSiblingsBelow(ev);
+        return isHandlingTouch();
     }
 
     @Override
@@ -978,9 +968,6 @@
             super.determineScrollingStart(ev, touchSlopScale);
         }
     }
-    protected boolean shouldStealTouchFromSiblingsBelow(MotionEvent ev) {
-        return true;
-    }
 
     protected void applyLoadPlan(ArrayList<Task> tasks) {
         if (TestProtocol.sDebugTracing) {
@@ -1332,17 +1319,9 @@
         if (getPageCount() == 0 || getPageAt(0).getMeasuredWidth() == 0) {
             return;
         }
-        mOrientationHandler.getCurveProperties(this, mInsets, mScrollState);
-        mScrollState.scrollFromEdge =
-                mIsRtl ? mScrollState.scroll : (mMaxScroll - mScrollState.scroll);
-
-        final int pageCount = getPageCount();
-        for (int i = 0; i < pageCount; i++) {
-            View page = getPageAt(i);
-            mScrollState.updateInterpolation(mActivity.getDeviceProfile(),
-                    mOrientationHandler.getChildStartWithTranslation(page));
-            ((PageCallbacks) page).onPageScroll(mScrollState, mOverviewGridEnabled);
-        }
+        int scroll = mOrientationHandler.getPrimaryScroll(this);
+        int scrollFromEdge = mIsRtl ? scroll : (mMaxScroll - scroll);
+        mClearAllButton.onRecentsViewScroll(scrollFromEdge, mOverviewGridEnabled);
     }
 
     @Override
@@ -1483,7 +1462,6 @@
 
         unloadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
         setCurrentPage(0);
-        mDwbToastShown = false;
         mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0);
         LayoutUtils.setViewEnabled(mActionsView, true);
         if (mOrientationState.setGestureActive(false)) {
@@ -1598,6 +1576,10 @@
         for (int i = 0; i < getTaskViewCount(); i++) {
             getTaskViewAt(i).setOrientationState(mOrientationState);
         }
+        TaskMenuView tv = (TaskMenuView) getTopOpenViewWithType(mActivity, TYPE_TASK_MENU);
+        if (tv != null) {
+            tv.onRotationChanged();
+        }
     }
 
     /**
@@ -1950,7 +1932,7 @@
                     // When the unpinned task is added, snap to first page and disable transitions
                     if (view instanceof TaskView) {
                         snapToPage(0);
-                        disableLayoutTransitions();
+                        setLayoutTransition(null);
                     }
 
                 }
@@ -1959,10 +1941,6 @@
         setLayoutTransition(mLayoutTransition);
     }
 
-    private void disableLayoutTransitions() {
-        setLayoutTransition(null);
-    }
-
     public void setSwipeDownShouldLaunchApp(boolean swipeDownShouldLaunchApp) {
         mSwipeDownShouldLaunchApp = swipeDownShouldLaunchApp;
     }
@@ -1971,44 +1949,6 @@
         return mSwipeDownShouldLaunchApp;
     }
 
-    public interface PageCallbacks {
-
-        /**
-         * Updates the page UI based on scroll params.
-         *
-         * @param gridEnabled whether Overveiw is currently showing as 2 rows grid
-         */
-        default void onPageScroll(ScrollState scrollState, boolean gridEnabled) {}
-    }
-
-    public static class ScrollState extends CurveProperties {
-
-        /**
-         * The progress from 0 to 1, where 0 is the center
-         * of the screen and 1 is the edge of the screen.
-         */
-        public float linearInterpolation;
-
-        /**
-         * The amount by which all the content is scrolled relative to the end of the list.
-         */
-        public float scrollFromEdge;
-
-        /**
-         * Updates linearInterpolation for the provided child position
-         */
-        public void updateInterpolation(DeviceProfile deviceProfile, float childStart) {
-            float pageCenter = childStart + halfPageSize;
-            float distanceFromScreenCenter = screenCenter - pageCenter;
-            // How far the page has to move from the center to be offscreen, taking into account
-            // the EDGE_SCALE_DOWN_FACTOR that will be applied at that position.
-            float distanceToReachEdge = halfScreenSize
-                    + halfPageSize * (1 - TaskView.getEdgeScaleDownFactor(deviceProfile));
-            linearInterpolation = Math.min(1,
-                    Math.abs(distanceFromScreenCenter) / distanceToReachEdge);
-        }
-    }
-
     public void setIgnoreResetTask(int taskId) {
         mIgnoreResetTaskId = taskId;
     }
@@ -2545,9 +2485,7 @@
         mTempRectF.set(mLastComputedTaskSize);
         RectF taskPosition = mTempRectF;
         float desiredLeft = getWidth();
-        float distanceToOffscreen = desiredLeft - taskPosition.left;
         // Used to calculate the scale of the task view based on its new offset.
-        float centerToOffscreenProgress = Math.abs(offsetProgress);
         if (midpointIndex > -1) {
             // When there is a midpoint reference task, adjacent tasks have less distance to travel
             // to reach offscreen. Offset the task position to the task's starting point.
@@ -2557,10 +2495,8 @@
                     - mOrientationHandler.getChildStart(midpointChild)
                     + getDisplacementFromScreenCenter(midpointIndex));
             taskPosition.offset(distanceFromMidpoint, 0);
-            centerToOffscreenProgress = Utilities.mapRange(centerToOffscreenProgress,
-                    distanceFromMidpoint / distanceToOffscreen, 1);
         }
-        distanceToOffscreen = desiredLeft - taskPosition.left;
+        float distanceToOffscreen = desiredLeft - taskPosition.left;
         // Finally, we need to account for RecentsView scale, because it moves tasks based on its
         // pivot. To do this, we move the task position to where it would be offscreen at scale = 1
         // (computed above), then we apply the scale via getMatrix() to determine how much that
@@ -3177,15 +3113,6 @@
                 taskView.getGridTranslationY());
     }
 
-    /**
-     * Returns the progress of forming a grid from carousel.
-     *
-     * @return A float from 0 to 1 where 0 is a carousel and 1 is a 2 row grid.
-     */
-    public float getGridProgress() {
-        return mGridProgress;
-    }
-
     public Consumer<MotionEvent> getEventDispatcher(float navbarRotation) {
         float degreesRotated;
         if (navbarRotation == 0) {
@@ -3318,6 +3245,16 @@
         return mSizeStrategy;
     }
 
+    /**
+     * Set all the task views to color tint scrim mode, dimming or tinting them all. Allows the
+     * tasks to be dimmed while other elements in the recents view are left alone.
+     */
+    public void showForegroundScrim(boolean show) {
+        for (int i = 0; i < getTaskViewCount(); i++) {
+            getTaskViewAt(i).showColorTint(show);
+        }
+    }
+
     private boolean showAsGrid() {
         return mOverviewGridEnabled || (mCurrentGestureEndTarget != null
                 && mSizeStrategy.stateFromGestureEndTarget(
diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
deleted file mode 100644
index db04fc0..0000000
--- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2018 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.views;
-
-import static com.android.launcher3.LauncherState.OVERVIEW;
-import static com.android.launcher3.anim.Interpolators.ACCEL;
-import static com.android.launcher3.anim.Interpolators.ACCEL_2;
-import static com.android.launcher3.anim.Interpolators.LINEAR;
-import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
-import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Path;
-import android.graphics.Path.Direction;
-import android.graphics.Path.Op;
-import android.util.AttributeSet;
-import android.view.animation.Interpolator;
-
-import com.android.launcher3.BaseQuickstepLauncher;
-import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
-import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.uioverrides.states.OverviewState;
-import com.android.launcher3.util.Themes;
-import com.android.launcher3.views.ScrimView;
-import com.android.quickstep.SysUINavigationMode;
-import com.android.quickstep.SysUINavigationMode.Mode;
-import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener;
-
-/**
- * Scrim used for all-apps and shelf in Overview
- * In transposed layout, it behaves as a simple color scrim.
- * In portrait layout, it draws a rounded rect such that
- *    From normal state to overview state, the shelf just fades in and does not move
- *    From overview state to all-apps state the shelf moves up and fades in to cover the screen
- */
-public class ShelfScrimView extends ScrimView<BaseQuickstepLauncher>
-        implements NavigationModeChangeListener {
-
-    // If the progress is more than this, shelf follows the finger, otherwise it moves faster to
-    // cover the whole screen
-    private static final float SCRIM_CATCHUP_THRESHOLD = 0.2f;
-
-    // Temporarily needed until android.R.attr.bottomDialogCornerRadius becomes public
-    private static final float BOTTOM_CORNER_RADIUS_RATIO = 2f;
-
-    // In transposed layout, we simply draw a flat color.
-    private boolean mDrawingFlatColor;
-
-    // For shelf mode
-    private final int mEndAlpha;
-    private final float mRadius;
-    private final int mMaxScrimAlpha;
-    private final Paint mPaint;
-
-    // Mid point where the alpha changes
-    private int mMidAlpha;
-    private float mMidProgress;
-
-    private Interpolator mBeforeMidProgressColorInterpolator = ACCEL;
-    private Interpolator mAfterMidProgressColorInterpolator = ACCEL;
-
-    private float mShiftRange;
-
-    private float mTopOffset;
-    private float mShelfTop;
-    private float mShelfTopAtThreshold;
-
-    private int mShelfColor;
-    private int mRemainingScreenColor;
-
-    private final Path mTempPath = new Path();
-    private final Path mRemainingScreenPath = new Path();
-    private boolean mRemainingScreenPathValid = false;
-
-    private Mode mSysUINavigationMode;
-
-    public ShelfScrimView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        mMaxScrimAlpha = Math.round(OVERVIEW.getOverviewScrimAlpha(mLauncher) * 255);
-
-        mEndAlpha = Color.alpha(mEndScrim);
-        mRadius = BOTTOM_CORNER_RADIUS_RATIO * Themes.getDialogCornerRadius(context);
-        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
-
-        // Just assume the easiest UI for now, until we have the proper layout information.
-        mDrawingFlatColor = true;
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
-        super.onSizeChanged(w, h, oldw, oldh);
-        mRemainingScreenPathValid = false;
-    }
-
-    @Override
-    protected void onAttachedToWindow() {
-        super.onAttachedToWindow();
-        onNavigationModeChanged(SysUINavigationMode.INSTANCE.get(getContext())
-                .addModeChangeListener(this));
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        super.onDetachedFromWindow();
-        SysUINavigationMode.INSTANCE.get(getContext()).removeModeChangeListener(this);
-    }
-
-    @Override
-    public void onNavigationModeChanged(Mode newMode) {
-        mSysUINavigationMode = newMode;
-        // Note that these interpolators are inverted because progress goes 1 to 0.
-        if (mSysUINavigationMode == Mode.NO_BUTTON) {
-            // Show the shelf more quickly before reaching overview progress.
-            mBeforeMidProgressColorInterpolator = ACCEL_2;
-            mAfterMidProgressColorInterpolator = ACCEL;
-        } else {
-            mBeforeMidProgressColorInterpolator = ACCEL;
-            mAfterMidProgressColorInterpolator = Interpolators.clampToProgress(ACCEL, 0.5f, 1f);
-        }
-    }
-
-    @Override
-    public void reInitUi() {
-        DeviceProfile dp = mLauncher.getDeviceProfile();
-        mDrawingFlatColor = dp.isVerticalBarLayout();
-
-        if (!mDrawingFlatColor) {
-            mRemainingScreenPathValid = false;
-            mShiftRange = mLauncher.getAllAppsController().getShiftRange();
-
-            // Fade in all apps background quickly to distinguish from swiping from nav bar.
-            mMidAlpha = Themes.getAttrInteger(getContext(), R.attr.allAppsInterimScrimAlpha);
-            mMidProgress = 1 - (OverviewState.getDefaultSwipeHeight(mLauncher)
-                    / mLauncher.getAllAppsController().getShiftRange());
-
-            mTopOffset = dp.getInsets().top;
-            mShelfTopAtThreshold = mShiftRange * SCRIM_CATCHUP_THRESHOLD + mTopOffset;
-        }
-        updateColors();
-        updateSysUiColors();
-        invalidate();
-    }
-
-    @Override
-    public void updateColors() {
-        super.updateColors();
-        if (mDrawingFlatColor) {
-            return;
-        }
-
-        if (mProgress >= SCRIM_CATCHUP_THRESHOLD) {
-            mShelfTop = mShiftRange * mProgress + mTopOffset;
-        } else {
-            mShelfTop = Utilities.mapRange(mProgress / SCRIM_CATCHUP_THRESHOLD, -mRadius,
-                    mShelfTopAtThreshold);
-        }
-
-        if (mProgress >= 1) {
-            mRemainingScreenColor = 0;
-            mShelfColor = 0;
-        } else if (mProgress >= mMidProgress) {
-            mRemainingScreenColor = 0;
-
-            int alpha = Math.round(Utilities.mapToRange(
-                    mProgress, mMidProgress, 1, mMidAlpha, 0, mBeforeMidProgressColorInterpolator));
-            mShelfColor = setColorAlphaBound(mEndScrim, alpha);
-        } else {
-            // Note that these ranges and interpolators are inverted because progress goes 1 to 0.
-            int alpha = Math.round(
-                    Utilities.mapToRange(mProgress, (float) 0, mMidProgress, (float) mEndAlpha,
-                            (float) mMidAlpha, mAfterMidProgressColorInterpolator));
-            mShelfColor = setColorAlphaBound(mEndScrim, alpha);
-
-            int remainingScrimAlpha = Math.round(
-                    Utilities.mapToRange(mProgress, (float) 0, mMidProgress, mMaxScrimAlpha,
-                            (float) 0, LINEAR));
-            mRemainingScreenColor = setColorAlphaBound(mScrimColor, remainingScrimAlpha);
-        }
-    }
-
-    @Override
-    protected void updateSysUiColors() {
-        if (mDrawingFlatColor) {
-            super.updateSysUiColors();
-        } else {
-            // Use a light system UI (dark icons) if all apps is behind at least half of the
-            // status bar.
-            boolean forceChange = mShelfTop <= mLauncher.getDeviceProfile().getInsets().top / 2f;
-            if (forceChange) {
-                mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !mIsScrimDark);
-            } else {
-                mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, 0);
-            }
-        }
-    }
-
-    @Override
-    protected void onDraw(Canvas canvas) {
-        if (mDrawingFlatColor) {
-            if (mCurrentFlatColor != 0) {
-                canvas.drawColor(mCurrentFlatColor);
-            }
-            return;
-        }
-
-        if (Color.alpha(mShelfColor) == 0) {
-            return;
-        } else if (mProgress <= 0) {
-            canvas.drawColor(mShelfColor);
-            return;
-        }
-
-        int height = getHeight();
-        int width = getWidth();
-        // Draw the scrim over the remaining screen if needed.
-        if (mRemainingScreenColor != 0) {
-            if (!mRemainingScreenPathValid) {
-                mTempPath.reset();
-                // Using a arbitrary '+10' in the bottom to avoid any left-overs at the
-                // corners due to rounding issues.
-                mTempPath.addRoundRect(0, height - mRadius, width, height + mRadius + 10,
-                        mRadius, mRadius, Direction.CW);
-                mRemainingScreenPath.reset();
-                mRemainingScreenPath.addRect(0, 0, width, height, Direction.CW);
-                mRemainingScreenPath.op(mTempPath, Op.DIFFERENCE);
-            }
-
-            float offset = height - mRadius - mShelfTop;
-            canvas.translate(0, -offset);
-            mPaint.setColor(mRemainingScreenColor);
-            canvas.drawPath(mRemainingScreenPath, mPaint);
-            canvas.translate(0, offset);
-        }
-
-        mPaint.setColor(mShelfColor);
-        canvas.drawRoundRect(0, mShelfTop, width, height + mRadius, mRadius, mRadius, mPaint);
-    }
-}
diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
index a46daf3..658d71d 100644
--- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java
@@ -31,6 +31,7 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewOutlineProvider;
+import android.view.ViewTreeObserver.OnScrollChangedListener;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
@@ -51,7 +52,7 @@
 /**
  * Contains options for a recent task when long-pressing its icon.
  */
-public class TaskMenuView extends AbstractFloatingView {
+public class TaskMenuView extends AbstractFloatingView implements OnScrollChangedListener {
 
     private static final Rect sTempRect = new Rect();
 
@@ -120,7 +121,8 @@
         };
     }
 
-    public void setPosition(float x, float y, PagedOrientationHandler pagedOrientationHandler) {
+    private void setPosition(float x, float y) {
+        PagedOrientationHandler pagedOrientationHandler = mTaskView.getPagedOrientationHandler();
         int taskTopMargin = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
         float adjustedY = y + taskTopMargin;
         // Changing pivot to make computations easier
@@ -150,11 +152,11 @@
         }
     }
 
-    public static TaskMenuView showForTask(TaskView taskView) {
+    public static boolean showForTask(TaskView taskView) {
         BaseDraggingActivity activity = BaseDraggingActivity.fromContext(taskView.getContext());
         final TaskMenuView taskMenuView = (TaskMenuView) activity.getLayoutInflater().inflate(
                         R.layout.task_menu, activity.getDragLayer(), false);
-        return taskMenuView.populateAndShowForTask(taskView) ? taskMenuView : null;
+        return taskMenuView.populateAndShowForTask(taskView);
     }
 
     private boolean populateAndShowForTask(TaskView taskView) {
@@ -167,9 +169,16 @@
             return false;
         }
         post(this::animateOpen);
+        mActivity.getRootView().getViewTreeObserver().addOnScrollChangedListener(this);
         return true;
     }
 
+    @Override
+    public void onScrollChanged() {
+        RecentsView rv = mTaskView.getRecentsView();
+        setPosition(mTaskView.getX() - rv.getScrollX(), mTaskView.getY() - rv.getScrollY());
+    }
+
     /** @return true if successfully able to populate task view menu, false otherwise */
     private boolean populateAndLayoutMenu() {
         if (mTaskView.getTask().icon == null) {
@@ -227,8 +236,7 @@
             .mOrientationState.isRecentsActivityRotationAllowed();
         mOptionLayout.setOrientation(orientationHandler
                 .getTaskMenuLayoutOrientation(canActivityRotate, mOptionLayout));
-        setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top,
-            taskView.getPagedOrientationHandler());
+        setPosition(sTempRect.left - insets.left, sTempRect.top - insets.top);
     }
 
     private void animateOpen() {
@@ -249,9 +257,11 @@
         final Animator revealAnimator = createOpenCloseOutlineProvider()
                 .createRevealAnimator(this, closing);
         revealAnimator.setInterpolator(Interpolators.DEACCEL);
-        mOpenCloseAnimator.play(revealAnimator);
-        mOpenCloseAnimator.play(ObjectAnimator.ofFloat(mTaskView.getThumbnail(), DIM_ALPHA,
-                closing ? 0 : TaskView.MAX_PAGE_SCRIM_ALPHA));
+        mOpenCloseAnimator.playTogether(revealAnimator,
+                ObjectAnimator.ofFloat(
+                        mTaskView.getThumbnail(), DIM_ALPHA,
+                        closing ? 0 : TaskView.MAX_PAGE_SCRIM_ALPHA),
+                ObjectAnimator.ofFloat(this, ALPHA, closing ? 0 : 1));
         mOpenCloseAnimator.addListener(new AnimationSuccessListener() {
             @Override
             public void onAnimationStart(Animator animation) {
@@ -265,7 +275,6 @@
                 }
             }
         });
-        mOpenCloseAnimator.play(ObjectAnimator.ofFloat(this, ALPHA, closing ? 0 : 1));
         mOpenCloseAnimator.setDuration(closing ? REVEAL_CLOSE_DURATION: REVEAL_OPEN_DURATION);
         mOpenCloseAnimator.start();
     }
@@ -273,6 +282,7 @@
     private void closeComplete() {
         mIsOpen = false;
         mActivity.getDragLayer().removeView(this);
+        mActivity.getRootView().getViewTreeObserver().removeOnScrollChangedListener(this);
     }
 
     private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
index af62582..685f725 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -28,8 +28,6 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.ColorFilter;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
 import android.graphics.Insets;
 import android.graphics.Matrix;
 import android.graphics.Paint;
@@ -46,10 +44,10 @@
 import android.view.View;
 
 import androidx.annotation.RequiresApi;
+import androidx.core.graphics.ColorUtils;
 
 import com.android.launcher3.BaseActivity;
 import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.R;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
@@ -67,10 +65,6 @@
  * A task in the Recents view.
  */
 public class TaskThumbnailView extends View implements PluginListener<OverviewScreenshotActions> {
-
-    private static final ColorMatrix COLOR_MATRIX = new ColorMatrix();
-    private static final ColorMatrix SATURATION_COLOR_MATRIX = new ColorMatrix();
-
     private static final MainThreadInitializedObject<FullscreenDrawParams> TEMP_PARAMS =
             new MainThreadInitializedObject<>(FullscreenDrawParams::new);
 
@@ -89,11 +83,11 @@
 
     private final BaseActivity mActivity;
     private TaskOverlay mOverlay;
-    private final boolean mIsDarkTextTheme;
     private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
     private final Paint mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
     private final Paint mClearPaint = new Paint();
     private final Paint mDimmingPaintAfterClearing = new Paint();
+    private final int mDimColor;
 
     // Contains the portion of the thumbnail that is clipped when fullscreen progress = 0.
     private final Rect mPreviewRect = new Rect();
@@ -104,9 +98,8 @@
     private ThumbnailData mThumbnailData;
     protected BitmapShader mBitmapShader;
 
-    private float mDimAlpha = 1f;
-    private float mDimAlphaMultiplier = 1f;
-    private float mSaturation = 1f;
+    /** How much this thumbnail is dimmed, 0 not dimmed at all, 1 totally dimmed. */
+    private float mDimAlpha = 0f;
 
     private boolean mOverlayEnabled;
     private OverviewScreenshotActions mOverviewScreenshotActionsPlugin;
@@ -124,11 +117,12 @@
         mPaint.setFilterBitmap(true);
         mBackgroundPaint.setColor(Color.WHITE);
         mClearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
-        mDimmingPaintAfterClearing.setColor(Color.BLACK);
         mActivity = BaseActivity.fromContext(context);
-        mIsDarkTextTheme = Themes.getAttrBoolean(mActivity, R.attr.isWorkspaceDarkText);
         // Initialize with placeholder value. It is overridden later by TaskView
         mFullscreenParams = TEMP_PARAMS.get(context);
+
+        mDimColor = Themes.getColorBackgroundFloating(context);
+        mDimmingPaintAfterClearing.setColor(mDimColor);
     }
 
     /**
@@ -186,15 +180,12 @@
         updateThumbnailPaintFilter();
     }
 
-    public void setDimAlphaMultipler(float dimAlphaMultipler) {
-        mDimAlphaMultiplier = dimAlphaMultipler;
-        setDimAlpha(mDimAlpha);
-    }
-
     /**
      * Sets the alpha of the dim layer on top of this view.
      * <p>
-     * If dimAlpha is 0, no dimming is applied; if dimAlpha is 1, the thumbnail will be black.
+     * If dimAlpha is 0, no dimming is applied; if dimAlpha is 1, the thumbnail will be the
+     * extracted background color.
+     *
      */
     public void setDimAlpha(float dimAlpha) {
         mDimAlpha = dimAlpha;
@@ -359,15 +350,15 @@
     }
 
     private void updateThumbnailPaintFilter() {
-        int mul = (int) ((1 - mDimAlpha * mDimAlphaMultiplier) * 255);
-        ColorFilter filter = getColorFilter(mul, mIsDarkTextTheme, mSaturation);
+        ColorFilter filter = getColorFilter(mDimAlpha);
         mBackgroundPaint.setColorFilter(filter);
-        mDimmingPaintAfterClearing.setAlpha(255 - mul);
+        int alpha = (int) (mDimAlpha * 255);
+        mDimmingPaintAfterClearing.setAlpha(alpha);
         if (mBitmapShader != null) {
             mPaint.setColorFilter(filter);
         } else {
             mPaint.setColorFilter(null);
-            mPaint.setColor(Color.argb(255, mul, mul, mul));
+            mPaint.setColor(ColorUtils.blendARGB(Color.BLACK, mDimColor, alpha));
         }
         invalidate();
     }
@@ -401,35 +392,8 @@
         updateThumbnailMatrix();
     }
 
-    /**
-     * @param intensity multiplier for color values. 0 - make black (white if shouldLighten), 255 -
-     *                  leave unchanged.
-     */
-    private static ColorFilter getColorFilter(int intensity, boolean shouldLighten,
-            float saturation) {
-        intensity = Utilities.boundToRange(intensity, 0, 255);
-
-        if (intensity == 255 && saturation == 1) {
-            return null;
-        }
-
-        final float intensityScale = intensity / 255f;
-        COLOR_MATRIX.setScale(intensityScale, intensityScale, intensityScale, 1);
-
-        if (saturation != 1) {
-            SATURATION_COLOR_MATRIX.setSaturation(saturation);
-            COLOR_MATRIX.postConcat(SATURATION_COLOR_MATRIX);
-        }
-
-        if (shouldLighten) {
-            final float[] colorArray = COLOR_MATRIX.getArray();
-            final int colorAdd = 255 - intensity;
-            colorArray[4] = colorAdd;
-            colorArray[9] = colorAdd;
-            colorArray[14] = colorAdd;
-        }
-
-        return new ColorMatrixColorFilter(COLOR_MATRIX);
+    private ColorFilter getColorFilter(float dimAmount) {
+        return Utilities.makeColorTintingColorFilter(mDimColor, dimAmount);
     }
 
     public Bitmap getThumbnail() {
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 5fe0567..3cd9175 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -27,6 +27,7 @@
 import static android.view.Surface.ROTATION_90;
 import static android.widget.Toast.LENGTH_SHORT;
 
+import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU;
 import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
 import static com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION;
 import static com.android.launcher3.Utilities.comp;
@@ -72,6 +73,7 @@
 import androidx.annotation.IntDef;
 import androidx.annotation.NonNull;
 
+import com.android.launcher3.AbstractFloatingView;
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.LauncherSettings;
 import com.android.launcher3.R;
@@ -89,6 +91,7 @@
 import com.android.launcher3.util.ComponentKey;
 import com.android.launcher3.util.RunnableList;
 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
+import com.android.launcher3.util.Themes;
 import com.android.launcher3.util.TransformingTouchDelegate;
 import com.android.launcher3.util.ViewPool.Reusable;
 import com.android.quickstep.RecentsModel;
@@ -102,8 +105,6 @@
 import com.android.quickstep.util.CancellableTask;
 import com.android.quickstep.util.RecentsOrientedState;
 import com.android.quickstep.util.TaskCornerRadius;
-import com.android.quickstep.views.RecentsView.PageCallbacks;
-import com.android.quickstep.views.RecentsView.ScrollState;
 import com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper;
 import com.android.systemui.shared.recents.model.Task;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -118,7 +119,7 @@
 /**
  * A task in the Recents view.
  */
-public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
+public class TaskView extends FrameLayout implements Reusable {
 
     private static final String TAG = TaskView.class.getSimpleName();
 
@@ -135,10 +136,7 @@
     @IntDef({FLAG_UPDATE_ALL, FLAG_UPDATE_ICON, FLAG_UPDATE_THUMBNAIL})
     public @interface TaskDataChanges {}
 
-    /**
-     * The alpha of a black scrim on a page in the carousel as it leaves the screen.
-     * In the resting position of the carousel, the adjacent pages have about half this scrim.
-     */
+    /** The maximum amount that a task view can be scrimmed, dimmed or tinted. */
     public static final float MAX_PAGE_SCRIM_ALPHA = 0.4f;
 
     /**
@@ -255,18 +253,16 @@
                 }
             };
 
-    private final OnAttachStateChangeListener mTaskMenuStateListener =
-            new OnAttachStateChangeListener() {
+    private static final FloatProperty<TaskView> COLOR_TINT =
+            new FloatProperty<TaskView>("colorTint") {
                 @Override
-                public void onViewAttachedToWindow(View view) {
+                public void setValue(TaskView taskView, float v) {
+                    taskView.setColorTint(v);
                 }
 
                 @Override
-                public void onViewDetachedFromWindow(View view) {
-                    if (mMenuView != null) {
-                        mMenuView.removeOnAttachStateChangeListener(this);
-                        mMenuView = null;
-                    }
+                public Float get(TaskView taskView) {
+                    return taskView.getColorTint();
                 }
             };
 
@@ -274,7 +270,6 @@
 
     private Task mTask;
     private TaskThumbnailView mSnapshotView;
-    private TaskMenuView mMenuView;
     private IconView mIconView;
     private final DigitalWellBeingToast mDigitalWellBeingToast;
     private float mFullscreenProgress;
@@ -315,6 +310,11 @@
     private final float[] mIconCenterCoords = new float[2];
     private final float[] mChipCenterCoords = new float[2];
 
+    // Colored tint for the task view and all its supplementary views (like the task icon and well
+    // being banner.
+    private final int mTintingColor;
+    private float mTintAmount;
+
     private boolean mIsClickableAsLiveTile = true;
 
     public TaskView(Context context) {
@@ -336,6 +336,8 @@
         mOutlineProvider = new TaskOutlineProvider(getContext(), mCurrentFullscreenParams,
                 mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx);
         setOutlineProvider(mOutlineProvider);
+
+        mTintingColor = Themes.getColorBackgroundFloating(context);
     }
 
     /**
@@ -430,10 +432,6 @@
                         + mCurrentFullscreenParams.mCurrentDrawnInsets.bottom);
     }
 
-    public TaskMenuView getMenuView() {
-        return mMenuView;
-    }
-
     public DigitalWellBeingToast getDigitalWellBeingToast() {
         return mDigitalWellBeingToast;
     }
@@ -647,15 +645,12 @@
 
         if (!getRecentsView().isClearAllHidden()) {
             getRecentsView().snapToPage(getRecentsView().indexOfChild(this));
+            return false;
         } else {
-            mMenuView = TaskMenuView.showForTask(this);
             mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
                     .log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS);
-            if (mMenuView != null) {
-                mMenuView.addOnAttachStateChangeListener(mTaskMenuStateListener);
-            }
+            return TaskMenuView.showForTask(this);
         }
-        return mMenuView != null;
     }
 
     private void setIcon(Drawable icon) {
@@ -714,10 +709,6 @@
         mIconView.setRotation(orientationHandler.getDegreesRotated());
         snapshotParams.topMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
         mSnapshotView.setLayoutParams(snapshotParams);
-
-        if (mMenuView != null) {
-            mMenuView.onRotationChanged();
-        }
     }
 
     private void setIconAndDimTransitionProgress(float progress, boolean invert) {
@@ -725,7 +716,6 @@
             progress = 1 - progress;
         }
         mFocusTransitionProgress = progress;
-        mSnapshotView.setDimAlphaMultipler(0);
         float iconScalePercentage = (float) SCALE_ICON_DURATION / DIM_ANIM_DURATION;
         float lowerClamp = invert ? 1f - iconScalePercentage : 0;
         float upperClamp = invert ? 1 : iconScalePercentage;
@@ -784,6 +774,7 @@
         setTranslationZ(0);
         setAlpha(mStableAlpha);
         setIconScaleAndDim(1);
+        setColorTint(0);
     }
 
     public void setStableAlpha(float parentAlpha) {
@@ -802,27 +793,6 @@
         onTaskListVisibilityChanged(false);
     }
 
-    @Override
-    public void onPageScroll(ScrollState scrollState, boolean gridEnabled) {
-        // Don't do anything if it's modal.
-        if (mModalness > 0) {
-            return;
-        }
-
-        float dwbBannerAlpha = Utilities.boundToRange(1.0f - 2 * scrollState.linearInterpolation,
-                0f, 1f);
-        mDigitalWellBeingToast.updateBannerAlpha(dwbBannerAlpha);
-
-        if (mMenuView != null) {
-            PagedOrientationHandler pagedOrientationHandler = getPagedOrientationHandler();
-            RecentsView recentsView = getRecentsView();
-            mMenuView.setPosition(getX() - recentsView.getScrollX(),
-                    getY() - recentsView.getScrollY(), pagedOrientationHandler);
-            mMenuView.setScaleX(getScaleX());
-            mMenuView.setScaleY(getScaleY());
-        }
-    }
-
     /**
      * Sets the contextual chip.
      *
@@ -1322,9 +1292,28 @@
     }
 
     public void initiateSplitSelect(SplitPositionOption splitPositionOption) {
-        RecentsView rv = getRecentsView();
-        getMenuView().close(false);
-        rv.initiateSplitSelect(this, splitPositionOption);
+        AbstractFloatingView.closeOpenViews(mActivity, false, TYPE_TASK_MENU);
+        getRecentsView().initiateSplitSelect(this, splitPositionOption);
+    }
+
+    private void setColorTint(float amount) {
+        mSnapshotView.setDimAlpha(amount);
+        mIconView.setIconColorTint(mTintingColor, amount);
+        mDigitalWellBeingToast.setBannerColorTint(mTintingColor, amount);
+    }
+
+    private float getColorTint() {
+        return mTintAmount;
+    }
+
+    /**
+     * Show the task view with a color tint (animates value).
+     */
+    public void showColorTint(boolean enable) {
+        ObjectAnimator tintAnimator = ObjectAnimator.ofFloat(
+                this, COLOR_TINT, enable ? MAX_PAGE_SCRIM_ALPHA : 0);
+        tintAnimator.setAutoCancel(true);
+        tintAnimator.start();
     }
 
     /**
diff --git a/res/layout/launcher.xml b/res/layout/launcher.xml
index 8451b77..f34e685 100644
--- a/res/layout/launcher.xml
+++ b/res/layout/launcher.xml
@@ -62,9 +62,12 @@
             android:id="@+id/drop_target_bar"
             layout="@layout/drop_target_bar" />
 
-        <include
+        <com.android.launcher3.views.ScrimView
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
             android:id="@+id/scrim_view"
-            layout="@layout/scrim_view" />
+            android:background="?attr/allAppsScrimColor"
+            android:alpha="0" />
 
         <include
             android:id="@+id/apps_view"
diff --git a/res/layout/scrim_view.xml b/res/layout/scrim_view.xml
deleted file mode 100644
index a604d56..0000000
--- a/res/layout/scrim_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<com.android.launcher3.views.ScrimView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:id="@+id/scrim_view" />
\ No newline at end of file
diff --git a/res/layout/widget_cell_content.xml b/res/layout/widget_cell_content.xml
index 30bd8b1..0f6fc6c 100644
--- a/res/layout/widget_cell_content.xml
+++ b/res/layout/widget_cell_content.xml
@@ -17,16 +17,31 @@
     android:layout_width="wrap_content"
     android:layout_height="wrap_content">
 
-    <!-- The image of the widget. This view does not support padding. Any placement adjustment
-         should be done using margins. Width & height are set at runtime after scaling the preview
-         image. -->
-    <com.android.launcher3.widget.WidgetImageView
-        android:id="@+id/widget_preview"
+    <com.android.launcher3.widget.WidgetCellPreview
+        android:id="@+id/widget_preview_container"
         android:layout_width="0dp"
         android:layout_height="0dp"
         android:layout_weight="1"
         android:importantForAccessibility="no"
-        android:layout_marginVertical="8dp" />
+        android:layout_marginVertical="8dp">
+        <!-- The image of the widget. This view does not support padding. Any placement adjustment
+             should be done using margins. Width & height are set at runtime after scaling the
+             preview image. -->
+        <com.android.launcher3.widget.WidgetImageView
+            android:id="@+id/widget_preview"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:importantForAccessibility="no"
+            android:layout_gravity="fill"/>
+
+        <ImageView
+            android:id="@+id/widget_badge"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:importantForAccessibility="no"
+            android:layout_gravity="end|bottom"
+            android:layout_margin="@dimen/profile_badge_margin"/>
+    </com.android.launcher3.widget.WidgetCellPreview>
 
     <!-- The name of the widget. -->
     <TextView
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 1fccdf3..51dddab 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -84,6 +84,7 @@
     <dimen name="fastscroll_end_margin">-26dp</dimen>
 
     <!-- All Apps -->
+    <dimen name="all_apps_open_vertical_translate">96dp</dimen>
     <dimen name="all_apps_search_bar_field_height">48dp</dimen>
     <dimen name="all_apps_search_bar_bottom_padding">30dp</dimen>
     <dimen name="all_apps_empty_search_message_top_offset">40dp</dimen>
diff --git a/res/xml/size_limits_80x104.xml b/res/xml/size_limits_80x104.xml
index e11bc5e..f375549 100644
--- a/res/xml/size_limits_80x104.xml
+++ b/res/xml/size_limits_80x104.xml
@@ -36,11 +36,11 @@
             launcher:a="0"
             launcher:b="16dp"/>
         <workspaceBottomPadding
-            launcher:a="0.50"
+            launcher:a="0.56"
             launcher:b="0"
             launcher:c="16dp"/>
         <hotseatBottomPadding
-            launcher:a="0.50"
+            launcher:a="0.44"
             launcher:b="0"
             launcher:c="16dp"/>
     </device-padding>
diff --git a/robolectric_tests/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchAlgorithmTest.java b/robolectric_tests/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchAlgorithmTest.java
index c2bf1ae..36b6f01 100644
--- a/robolectric_tests/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchAlgorithmTest.java
+++ b/robolectric_tests/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchAlgorithmTest.java
@@ -18,64 +18,197 @@
 
 import static android.os.Looper.getMainLooper;
 
+import static org.junit.Assert.assertEquals;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.argThat;
 import static org.mockito.ArgumentMatchers.matches;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.verify;
 import static org.robolectric.Shadows.shadowOf;
 
+import android.appwidget.AppWidgetProviderInfo;
+import android.content.ComponentName;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.os.UserHandle;
+
+import com.android.launcher3.InvariantDeviceProfile;
+import com.android.launcher3.icons.BitmapInfo;
+import com.android.launcher3.icons.ComponentWithLabel;
+import com.android.launcher3.icons.IconCache;
+import com.android.launcher3.model.WidgetItem;
+import com.android.launcher3.model.data.PackageItemInfo;
+import com.android.launcher3.popup.PopupDataProvider;
 import com.android.launcher3.search.SearchCallback;
+import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
 import com.android.launcher3.widget.model.WidgetsListBaseEntry;
+import com.android.launcher3.widget.model.WidgetsListContentEntry;
+import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
+import com.android.launcher3.widget.model.WidgetsListSearchHeaderEntry;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.shadows.ShadowPackageManager;
+import org.robolectric.util.ReflectionHelpers;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
-import java.util.function.Consumer;
 
 @RunWith(RobolectricTestRunner.class)
 public class SimpleWidgetsSearchAlgorithmTest {
 
+    @Mock private IconCache mIconCache;
+
+    private InvariantDeviceProfile mTestProfile;
+    private WidgetsListHeaderEntry mCalendarHeaderEntry;
+    private WidgetsListContentEntry mCalendarContentEntry;
+    private WidgetsListHeaderEntry mCameraHeaderEntry;
+    private WidgetsListContentEntry mCameraContentEntry;
+    private WidgetsListHeaderEntry mClockHeaderEntry;
+    private WidgetsListContentEntry mClockContentEntry;
+    private Context mContext;
+
     private SimpleWidgetsSearchAlgorithm mSimpleWidgetsSearchAlgorithm;
     @Mock
-    private WidgetsPickerSearchPipeline mSearchPipeline;
+    private PopupDataProvider mDataProvider;
     @Mock
     private SearchCallback<WidgetsListBaseEntry> mSearchCallback;
-    @Captor
-    private ArgumentCaptor<Consumer<List<WidgetsListBaseEntry>>> mConsumerCaptor;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mSimpleWidgetsSearchAlgorithm = new SimpleWidgetsSearchAlgorithm(mSearchPipeline);
+        doAnswer(invocation -> {
+            ComponentWithLabel componentWithLabel = (ComponentWithLabel) invocation.getArgument(0);
+            return componentWithLabel.getComponent().getShortClassName();
+        }).when(mIconCache).getTitleNoCache(any());
+        mTestProfile = new InvariantDeviceProfile();
+        mTestProfile.numRows = 5;
+        mTestProfile.numColumns = 5;
+        mContext = RuntimeEnvironment.application;
+
+        mCalendarHeaderEntry =
+                createWidgetsHeaderEntry("com.example.android.Calendar", "Calendar", 2);
+        mCalendarContentEntry =
+                createWidgetsContentEntry("com.example.android.Calendar", "Calendar", 2);
+        mCameraHeaderEntry = createWidgetsHeaderEntry("com.example.android.Camera", "Camera", 11);
+        mCameraContentEntry = createWidgetsContentEntry("com.example.android.Camera", "Camera", 11);
+        mClockHeaderEntry = createWidgetsHeaderEntry("com.example.android.Clock", "Clock", 3);
+        mClockContentEntry = createWidgetsContentEntry("com.example.android.Clock", "Clock", 3);
+
+
+        mSimpleWidgetsSearchAlgorithm = new SimpleWidgetsSearchAlgorithm(mDataProvider);
+        doReturn(Collections.EMPTY_LIST).when(mDataProvider).getAllWidgets();
     }
 
     @Test
-    public void doSearch_shouldQueryPipeline() {
-        mSimpleWidgetsSearchAlgorithm.doSearch("abc", mSearchCallback);
+    public void filter_shouldMatchOnAppName() {
+        doReturn(List.of(mCalendarHeaderEntry, mCalendarContentEntry, mCameraHeaderEntry,
+                mCameraContentEntry, mClockHeaderEntry, mClockContentEntry))
+                .when(mDataProvider)
+                .getAllWidgets();
 
-        verify(mSearchPipeline).query(eq("abc"), any());
+        assertEquals(List.of(
+                new WidgetsListSearchHeaderEntry(
+                        mCalendarHeaderEntry.mPkgItem,
+                        mCalendarHeaderEntry.mTitleSectionName,
+                        mCalendarHeaderEntry.mWidgets),
+                mCalendarContentEntry,
+                new WidgetsListSearchHeaderEntry(
+                        mCameraHeaderEntry.mPkgItem,
+                        mCameraHeaderEntry.mTitleSectionName,
+                        mCameraHeaderEntry.mWidgets),
+                mCameraContentEntry),
+                SimpleWidgetsSearchAlgorithm.getFilteredWidgets(mDataProvider, "Ca"));
     }
 
     @Test
-    public void doSearch_shouldInformSearchCallbackOnQueryResult() {
-        ArrayList<WidgetsListBaseEntry> baseEntries = new ArrayList<>();
+    public void filter_shouldMatchOnWidgetLabel() {
+        doReturn(List.of(mCalendarHeaderEntry, mCalendarContentEntry, mCameraHeaderEntry,
+                mCameraContentEntry))
+                .when(mDataProvider)
+                .getAllWidgets();
 
-        mSimpleWidgetsSearchAlgorithm.doSearch("abc", mSearchCallback);
+        assertEquals(List.of(
+                new WidgetsListSearchHeaderEntry(
+                        mCalendarHeaderEntry.mPkgItem,
+                        mCalendarHeaderEntry.mTitleSectionName,
+                        mCalendarHeaderEntry.mWidgets.subList(1, 2)),
+                new WidgetsListContentEntry(
+                        mCalendarHeaderEntry.mPkgItem,
+                        mCalendarHeaderEntry.mTitleSectionName,
+                        mCalendarHeaderEntry.mWidgets.subList(1, 2)),
+                new WidgetsListSearchHeaderEntry(
+                        mCameraHeaderEntry.mPkgItem,
+                        mCameraHeaderEntry.mTitleSectionName,
+                        mCameraHeaderEntry.mWidgets.subList(1, 3)),
+                new WidgetsListContentEntry(
+                        mCameraHeaderEntry.mPkgItem,
+                        mCameraHeaderEntry.mTitleSectionName,
+                        mCameraHeaderEntry.mWidgets.subList(1, 3))),
+                SimpleWidgetsSearchAlgorithm.getFilteredWidgets(mDataProvider, "Widget1"));
+    }
 
-        verify(mSearchPipeline).query(eq("abc"), mConsumerCaptor.capture());
-        mConsumerCaptor.getValue().accept(baseEntries);
+    @Test
+    public void doSearch_shouldInformCallback() {
+        doReturn(List.of(mCalendarHeaderEntry, mCalendarContentEntry, mCameraHeaderEntry,
+                mCameraContentEntry, mClockHeaderEntry, mClockContentEntry))
+                .when(mDataProvider)
+                .getAllWidgets();
+        mSimpleWidgetsSearchAlgorithm.doSearch("Ca", mSearchCallback);
         shadowOf(getMainLooper()).idle();
-        // Verify SearchCallback#onSearchResult receives a query token along with the search
-        // results. The query token is the original query string concatenated with the query
-        // timestamp.
-        verify(mSearchCallback).onSearchResult(matches("abc\t\\d*"), eq(baseEntries));
+        verify(mSearchCallback).onSearchResult(
+                matches("Ca"), argThat(a -> a != null && !a.isEmpty()));
+    }
+
+    private WidgetsListHeaderEntry createWidgetsHeaderEntry(String packageName, String appName,
+            int numOfWidgets) {
+        List<WidgetItem> widgetItems = generateWidgetItems(packageName, numOfWidgets);
+        PackageItemInfo pInfo = createPackageItemInfo(packageName, appName,
+                widgetItems.get(0).user);
+
+        return new WidgetsListHeaderEntry(pInfo, /* titleSectionName= */ "", widgetItems);
+    }
+
+    private WidgetsListContentEntry createWidgetsContentEntry(String packageName, String appName,
+            int numOfWidgets) {
+        List<WidgetItem> widgetItems = generateWidgetItems(packageName, numOfWidgets);
+        PackageItemInfo pInfo = createPackageItemInfo(packageName, appName,
+                widgetItems.get(0).user);
+
+        return new WidgetsListContentEntry(pInfo, /* titleSectionName= */ "", widgetItems);
+    }
+
+    private PackageItemInfo createPackageItemInfo(String packageName, String appName,
+            UserHandle userHandle) {
+        PackageItemInfo pInfo = new PackageItemInfo(packageName);
+        pInfo.title = appName;
+        pInfo.user = userHandle;
+        pInfo.bitmap = BitmapInfo.of(Bitmap.createBitmap(10, 10, Bitmap.Config.ALPHA_8), 0);
+        return pInfo;
+    }
+
+    private List<WidgetItem> generateWidgetItems(String packageName, int numOfWidgets) {
+        ShadowPackageManager packageManager = shadowOf(mContext.getPackageManager());
+        ArrayList<WidgetItem> widgetItems = new ArrayList<>();
+        for (int i = 0; i < numOfWidgets; i++) {
+            ComponentName cn = ComponentName.createRelative(packageName, ".SampleWidget" + i);
+            AppWidgetProviderInfo widgetInfo = new AppWidgetProviderInfo();
+            widgetInfo.provider = cn;
+            ReflectionHelpers.setField(widgetInfo, "providerInfo",
+                    packageManager.addReceiverIfNotPresent(cn));
+
+            WidgetItem widgetItem = new WidgetItem(
+                    LauncherAppWidgetProviderInfo.fromProviderInfo(mContext, widgetInfo),
+                    mTestProfile, mIconCache);
+            widgetItems.add(widgetItem);
+        }
+        return widgetItems;
     }
 }
diff --git a/robolectric_tests/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchPipelineTest.java b/robolectric_tests/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchPipelineTest.java
deleted file mode 100644
index 17ededd..0000000
--- a/robolectric_tests/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchPipelineTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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.widget.picker.search;
-
-import static android.os.Looper.getMainLooper;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.robolectric.Shadows.shadowOf;
-
-import android.appwidget.AppWidgetProviderInfo;
-import android.content.ComponentName;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.UserHandle;
-
-import com.android.launcher3.InvariantDeviceProfile;
-import com.android.launcher3.icons.BitmapInfo;
-import com.android.launcher3.icons.ComponentWithLabel;
-import com.android.launcher3.icons.IconCache;
-import com.android.launcher3.model.WidgetItem;
-import com.android.launcher3.model.data.PackageItemInfo;
-import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
-import com.android.launcher3.widget.model.WidgetsListContentEntry;
-import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
-import com.android.launcher3.widget.model.WidgetsListSearchHeaderEntry;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.shadows.ShadowPackageManager;
-import org.robolectric.util.ReflectionHelpers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class SimpleWidgetsSearchPipelineTest {
-    @Mock private IconCache mIconCache;
-
-    private InvariantDeviceProfile mTestProfile;
-    private WidgetsListHeaderEntry mCalendarHeaderEntry;
-    private WidgetsListContentEntry mCalendarContentEntry;
-    private WidgetsListHeaderEntry mCameraHeaderEntry;
-    private WidgetsListContentEntry mCameraContentEntry;
-    private WidgetsListHeaderEntry mClockHeaderEntry;
-    private WidgetsListContentEntry mClockContentEntry;
-    private Context mContext;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        doAnswer(invocation -> {
-            ComponentWithLabel componentWithLabel = (ComponentWithLabel) invocation.getArgument(0);
-            return componentWithLabel.getComponent().getShortClassName();
-        }).when(mIconCache).getTitleNoCache(any());
-        mTestProfile = new InvariantDeviceProfile();
-        mTestProfile.numRows = 5;
-        mTestProfile.numColumns = 5;
-        mContext = RuntimeEnvironment.application;
-
-        mCalendarHeaderEntry =
-                createWidgetsHeaderEntry("com.example.android.Calendar", "Calendar", 2);
-        mCalendarContentEntry =
-                createWidgetsContentEntry("com.example.android.Calendar", "Calendar", 2);
-        mCameraHeaderEntry = createWidgetsHeaderEntry("com.example.android.Camera", "Camera", 11);
-        mCameraContentEntry = createWidgetsContentEntry("com.example.android.Camera", "Camera", 11);
-        mClockHeaderEntry = createWidgetsHeaderEntry("com.example.android.Clock", "Clock", 3);
-        mClockContentEntry = createWidgetsContentEntry("com.example.android.Clock", "Clock", 3);
-    }
-
-    @Test
-    public void query_shouldMatchOnAppName() {
-        SimpleWidgetsSearchPipeline pipeline = new SimpleWidgetsSearchPipeline(
-                List.of(mCalendarHeaderEntry, mCalendarContentEntry, mCameraHeaderEntry,
-                        mCameraContentEntry, mClockHeaderEntry, mClockContentEntry));
-
-        pipeline.query("Ca", results ->
-                assertEquals(results,
-                        List.of(
-                                new WidgetsListSearchHeaderEntry(
-                                        mCalendarHeaderEntry.mPkgItem,
-                                        mCalendarHeaderEntry.mTitleSectionName,
-                                        mCalendarHeaderEntry.mWidgets),
-                                mCalendarContentEntry,
-                                new WidgetsListSearchHeaderEntry(
-                                        mCameraHeaderEntry.mPkgItem,
-                                        mCameraHeaderEntry.mTitleSectionName,
-                                        mCameraHeaderEntry.mWidgets),
-                                mCameraContentEntry)));
-        shadowOf(getMainLooper()).idle();
-    }
-
-    @Test
-    public void query_shouldMatchOnWidgetLabel() {
-        SimpleWidgetsSearchPipeline pipeline = new SimpleWidgetsSearchPipeline(
-                List.of(mCalendarHeaderEntry, mCalendarContentEntry, mCameraHeaderEntry,
-                        mCameraContentEntry));
-
-        pipeline.query("Widget1", results ->
-                assertEquals(results,
-                        List.of(
-                                new WidgetsListSearchHeaderEntry(
-                                        mCalendarHeaderEntry.mPkgItem,
-                                        mCalendarHeaderEntry.mTitleSectionName,
-                                        mCalendarHeaderEntry.mWidgets.subList(1, 2)),
-                                new WidgetsListContentEntry(
-                                        mCalendarHeaderEntry.mPkgItem,
-                                        mCalendarHeaderEntry.mTitleSectionName,
-                                        mCalendarHeaderEntry.mWidgets.subList(1, 2)),
-                                new WidgetsListSearchHeaderEntry(
-                                        mCameraHeaderEntry.mPkgItem,
-                                        mCameraHeaderEntry.mTitleSectionName,
-                                        mCameraHeaderEntry.mWidgets.subList(1, 3)),
-                                new WidgetsListContentEntry(
-                                        mCameraHeaderEntry.mPkgItem,
-                                        mCameraHeaderEntry.mTitleSectionName,
-                                        mCameraHeaderEntry.mWidgets.subList(1, 3)))));
-        shadowOf(getMainLooper()).idle();
-    }
-
-    private WidgetsListHeaderEntry createWidgetsHeaderEntry(String packageName, String appName,
-            int numOfWidgets) {
-        List<WidgetItem> widgetItems = generateWidgetItems(packageName, numOfWidgets);
-        PackageItemInfo pInfo = createPackageItemInfo(packageName, appName,
-                widgetItems.get(0).user);
-
-        return new WidgetsListHeaderEntry(pInfo, /* titleSectionName= */ "", widgetItems);
-    }
-
-    private WidgetsListContentEntry createWidgetsContentEntry(String packageName, String appName,
-            int numOfWidgets) {
-        List<WidgetItem> widgetItems = generateWidgetItems(packageName, numOfWidgets);
-        PackageItemInfo pInfo = createPackageItemInfo(packageName, appName,
-                widgetItems.get(0).user);
-
-        return new WidgetsListContentEntry(pInfo, /* titleSectionName= */ "", widgetItems);
-    }
-
-    private PackageItemInfo createPackageItemInfo(String packageName, String appName,
-            UserHandle userHandle) {
-        PackageItemInfo pInfo = new PackageItemInfo(packageName);
-        pInfo.title = appName;
-        pInfo.user = userHandle;
-        pInfo.bitmap = BitmapInfo.of(Bitmap.createBitmap(10, 10, Bitmap.Config.ALPHA_8), 0);
-        return pInfo;
-    }
-
-    private List<WidgetItem> generateWidgetItems(String packageName, int numOfWidgets) {
-        ShadowPackageManager packageManager = shadowOf(mContext.getPackageManager());
-        ArrayList<WidgetItem> widgetItems = new ArrayList<>();
-        for (int i = 0; i < numOfWidgets; i++) {
-            ComponentName cn = ComponentName.createRelative(packageName, ".SampleWidget" + i);
-            AppWidgetProviderInfo widgetInfo = new AppWidgetProviderInfo();
-            widgetInfo.provider = cn;
-            ReflectionHelpers.setField(widgetInfo, "providerInfo",
-                    packageManager.addReceiverIfNotPresent(cn));
-
-            WidgetItem widgetItem = new WidgetItem(
-                    LauncherAppWidgetProviderInfo.fromProviderInfo(mContext, widgetInfo),
-                    mTestProfile, mIconCache);
-            widgetItems.add(widgetItem);
-        }
-        return widgetItems;
-    }
-}
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index a29eab7..aea38a0 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -147,6 +147,7 @@
     public final int hotseatBarSidePaddingEndPx;
 
     // All apps
+    public int allAppsOpenVerticalTranslate;
     public int allAppsCellHeightPx;
     public int allAppsCellWidthPx;
     public int allAppsIconSizePx;
@@ -248,6 +249,10 @@
                 : res.getDimensionPixelSize(R.dimen.dynamic_grid_left_right_margin);
         desiredWorkspaceLeftRightOriginalPx = desiredWorkspaceLeftRightMarginPx;
 
+
+        allAppsOpenVerticalTranslate = res.getDimensionPixelSize(
+                R.dimen.all_apps_open_vertical_translate);
+
         folderLabelTextScale = res.getFloat(R.dimen.folder_label_text_scale);
         folderContentPaddingLeftRight =
                 res.getDimensionPixelSize(R.dimen.folder_content_padding_left_right);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ecaff7a..5091543 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -60,6 +60,10 @@
 import android.animation.ObjectAnimator;
 import android.animation.ValueAnimator;
 import android.annotation.TargetApi;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
 import android.appwidget.AppWidgetHostView;
 import android.appwidget.AppWidgetManager;
 import android.content.ActivityNotFoundException;
@@ -373,6 +377,44 @@
                     .build());
         }
 
+        if (Utilities.IS_DEBUG_DEVICE && FeatureFlags.NOTIFY_CRASHES.get()) {
+            final String notificationChannelId = "com.android.launcher3.Debug";
+            final String notificationChannelName = "Debug";
+            final String notificationTag = "Debug";
+            final int notificationId = 0;
+
+            NotificationManager notificationManager = getSystemService(NotificationManager.class);
+            notificationManager.createNotificationChannel(new NotificationChannel(
+                    notificationChannelId, notificationChannelName,
+                    NotificationManager.IMPORTANCE_HIGH));
+
+            Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> {
+                String stackTrace = Log.getStackTraceString(throwable);
+
+                Intent shareIntent = new Intent(Intent.ACTION_SEND);
+                shareIntent.setType("text/plain");
+                shareIntent.putExtra(Intent.EXTRA_TEXT, stackTrace);
+                shareIntent = Intent.createChooser(shareIntent, null);
+                PendingIntent sharePendingIntent = PendingIntent.getActivity(
+                        this, 0, shareIntent, PendingIntent.FLAG_UPDATE_CURRENT
+                );
+
+                Notification notification = new Notification.Builder(this, notificationChannelId)
+                        .setSmallIcon(android.R.drawable.ic_menu_close_clear_cancel)
+                        .setContentTitle("Launcher crash detected!")
+                        .setStyle(new Notification.BigTextStyle().bigText(stackTrace))
+                        .addAction(android.R.drawable.ic_menu_share, "Share", sharePendingIntent)
+                        .build();
+                notificationManager.notify(notificationTag, notificationId, notification);
+
+                Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler =
+                        Thread.getDefaultUncaughtExceptionHandler();
+                if (defaultUncaughtExceptionHandler != null) {
+                    defaultUncaughtExceptionHandler.uncaughtException(thread, throwable);
+                }
+            });
+        }
+
         super.onCreate(savedInstanceState);
 
         LauncherAppState app = LauncherAppState.getInstance(this);
@@ -1149,8 +1191,7 @@
 
         // Setup the drag controller (drop targets have to be added in reverse order in priority)
         mDropTargetBar.setup(mDragController);
-
-        mAllAppsController.setupViews(mAppsView, mScrimView);
+        mAllAppsController.setupViews(mAppsView);
     }
 
     /**
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 1003958..0c509a1 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -209,11 +209,11 @@
         return 1f;
     }
 
-    public float getWorkspaceScrimAlpha(Launcher launcher) {
+    public float getWorkspaceBackgroundAlpha(Launcher launcher) {
         return 0;
     }
 
-    public float getOverviewScrimAlpha(Launcher launcher) {
+    public float getWorkspaceScrimAlpha(Launcher launcher) {
         return 0;
     }
 
diff --git a/src/com/android/launcher3/SessionCommitReceiver.java b/src/com/android/launcher3/SessionCommitReceiver.java
index 1bbbb2b..5036104 100644
--- a/src/com/android/launcher3/SessionCommitReceiver.java
+++ b/src/com/android/launcher3/SessionCommitReceiver.java
@@ -24,6 +24,7 @@
 import android.content.pm.PackageManager;
 import android.os.UserHandle;
 import android.text.TextUtils;
+import android.util.Log;
 
 import androidx.annotation.WorkerThread;
 
@@ -36,6 +37,8 @@
  */
 public class SessionCommitReceiver extends BroadcastReceiver {
 
+    private static final String LOG = "SessionCommitReceiver";
+
     // Preference key for automatically adding icon to homescreen.
     public static final String ADD_ICON_PREFERENCE_KEY = "pref_add_icon_to_home";
 
@@ -68,6 +71,11 @@
             return;
         }
 
+        Log.i(LOG,
+                "Adding package name to install queue. Package name: " + info.getAppPackageName()
+                        + ", has app icon: " + (info.getAppIcon() != null)
+                        + ", has app label: " + !TextUtils.isEmpty(info.getAppLabel()));
+
         ItemInstallQueue.INSTANCE.get(context)
                 .queueItem(info.getAppPackageName(), user);
     }
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 8825710..1776777 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -37,6 +37,8 @@
 import android.database.ContentObserver;
 import android.graphics.Bitmap;
 import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.LightingColorFilter;
 import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.Point;
@@ -64,6 +66,7 @@
 import android.view.ViewConfiguration;
 import android.view.animation.Interpolator;
 
+import androidx.core.graphics.ColorUtils;
 import androidx.core.os.BuildCompat;
 
 import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
@@ -732,6 +735,23 @@
         }
     }
 
+    /**
+     * Make a color filter that blends a color into the destination based on a scalable amout.
+     *
+     * @param color to blend in.
+     * @param tintAmount [0-1] 0 no tinting, 1 full color.
+     * @return ColorFilter for tinting, or {@code null} if no filter is needed.
+     */
+    public static ColorFilter makeColorTintingColorFilter(int color, float tintAmount) {
+        if (tintAmount == 0f) {
+            return null;
+        }
+        return new LightingColorFilter(
+                // This isn't blending in white, its making a multiplication mask for the base color
+                ColorUtils.blendARGB(Color.WHITE, 0, tintAmount),
+                ColorUtils.blendARGB(0, color, tintAmount));
+    }
+
     private static class FixedSizeEmptyDrawable extends ColorDrawable {
 
         private final int mSize;
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index e0a4d4a..24de19f 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -38,6 +38,7 @@
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
+import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCRIM_FADE;
 import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
 
 import android.animation.ValueAnimator;
@@ -150,7 +151,7 @@
         propertySetter.setFloat(mWorkspace.getPageIndicator(), VIEW_TRANSLATE_Y,
                 hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
 
-        setScrim(propertySetter, state);
+        setScrim(propertySetter, state, config);
     }
 
     /**
@@ -165,14 +166,19 @@
                 - sibling.getLeft() - sibling.getTranslationX());
     }
 
-    public void setScrim(PropertySetter propertySetter, LauncherState state) {
+    public void setScrim(PropertySetter propertySetter, LauncherState state,
+            StateAnimationConfig config) {
         WorkspaceDragScrim workspaceDragScrim = mLauncher.getDragLayer().getWorkspaceDragScrim();
         propertySetter.setFloat(workspaceDragScrim, SCRIM_PROGRESS,
-                state.getWorkspaceScrimAlpha(mLauncher), LINEAR);
+                state.getWorkspaceBackgroundAlpha(mLauncher), LINEAR);
 
         SysUiScrim sysUiScrim = mLauncher.getDragLayer().getSysUiScrim();
         propertySetter.setFloat(sysUiScrim, SYSUI_PROGRESS,
                 state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);
+
+        propertySetter.setViewAlpha(mLauncher.getScrimView(),
+                state.getWorkspaceScrimAlpha(mLauncher),
+                config.getInterpolator(ANIM_WORKSPACE_SCRIM_FADE, LINEAR));
     }
 
     public void applyChildState(LauncherState state, CellLayout cl, int childIndex) {
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index db7fd3f..a5852ba 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -265,7 +265,7 @@
             List<OptionItem> actions = getSupportedResizeActions(host, info);
             Rect pos = new Rect();
             mLauncher.getDragLayer().getDescendantRectRelativeToSelf(host, pos);
-            ArrowPopup popup = OptionsPopupView.show(mLauncher, new RectF(pos), actions);
+            ArrowPopup popup = OptionsPopupView.show(mLauncher, new RectF(pos), actions, false);
             popup.requestFocus();
             popup.setOnCloseCallback(host::requestFocus);
             return true;
@@ -294,15 +294,17 @@
         if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0) {
             if (layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY) ||
                     layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) {
-                actions.add(new OptionItem(
-                        R.string.action_increase_width, R.drawable.ic_widget_width_increase,
+                actions.add(new OptionItem(mLauncher,
+                        R.string.action_increase_width,
+                        R.drawable.ic_widget_width_increase,
                         IGNORE,
                         v -> performResizeAction(R.string.action_increase_width, host, info)));
             }
 
             if (info.spanX > info.minSpanX && info.spanX > 1) {
-                actions.add(new OptionItem(
-                        R.string.action_decrease_width, R.drawable.ic_widget_width_decrease,
+                actions.add(new OptionItem(mLauncher,
+                        R.string.action_decrease_width,
+                        R.drawable.ic_widget_width_decrease,
                         IGNORE,
                         v -> performResizeAction(R.string.action_decrease_width, host, info)));
             }
@@ -311,15 +313,17 @@
         if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0) {
             if (layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1) ||
                     layout.isRegionVacant(info.cellX, info.cellY - 1, info.spanX, 1)) {
-                actions.add(new OptionItem(
-                        R.string.action_increase_height, R.drawable.ic_widget_height_increase,
+                actions.add(new OptionItem(mLauncher,
+                        R.string.action_increase_height,
+                        R.drawable.ic_widget_height_increase,
                         IGNORE,
                         v -> performResizeAction(R.string.action_increase_height, host, info)));
             }
 
             if (info.spanY > info.minSpanY && info.spanY > 1) {
-                actions.add(new OptionItem(
-                        R.string.action_decrease_height, R.drawable.ic_widget_height_decrease,
+                actions.add(new OptionItem(mLauncher,
+                        R.string.action_decrease_height,
+                        R.drawable.ic_widget_height_decrease,
                         IGNORE,
                         v -> performResizeAction(R.string.action_decrease_height, host, info)));
             }
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index f031136..0060b83 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -43,7 +43,6 @@
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.statemanager.StateManager.StateHandler;
 import com.android.launcher3.states.StateAnimationConfig;
-import com.android.launcher3.views.ScrimView;
 
 /**
  * Handles AllApps view transition.
@@ -72,10 +71,7 @@
                 }
             };
 
-    private static final int APPS_VIEW_ALPHA_CHANNEL_INDEX = 0;
-
     private AllAppsContainerView mAppsView;
-    private ScrimView mScrimView;
 
     private final Launcher mLauncher;
     private boolean mIsVerticalLayout;
@@ -125,9 +121,7 @@
      */
     public void setProgress(float progress) {
         mProgress = progress;
-
-        mScrimView.setProgress(progress);
-        mAppsView.setTranslationY(progress * mShiftRange);
+        mAppsView.setTranslationY(mProgress * mShiftRange);
     }
 
     public float getProgress() {
@@ -191,9 +185,8 @@
         return AnimationSuccessListener.forRunnable(this::onProgressAnimationEnd);
     }
 
-    public void setupViews(AllAppsContainerView appsView, ScrimView scrimView) {
+    public void setupViews(AllAppsContainerView appsView) {
         mAppsView = appsView;
-        mScrimView = scrimView;
         if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && Utilities.ATLEAST_R) {
             mLauncher.getSystemUiController().updateUiState(UI_STATE_ALLAPPS,
                     View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
@@ -207,10 +200,6 @@
     void setScrollRangeDelta(float delta) {
         mScrollRangeDelta = delta;
         mShiftRange = mLauncher.getDeviceProfile().heightPx - mScrollRangeDelta;
-
-        if (mScrimView != null) {
-            mScrimView.reInitUi();
-        }
     }
 
     /**
diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
index 13ddc12..16ae250 100644
--- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
@@ -72,8 +72,9 @@
     @Override
     public void setInsets(Rect insets) {
         super.setInsets(insets);
-        mLauncher.getAllAppsController()
-                .setScrollRangeDelta(mSearchUiManager.getScrollRangeDelta(insets));
+        int allAppsStartingPositionY = mLauncher.getDeviceProfile().availableHeightPx
+                - mLauncher.getDeviceProfile().allAppsOpenVerticalTranslate;
+        mLauncher.getAllAppsController().setScrollRangeDelta(allAppsStartingPositionY);
     }
 
     @Override
diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java
index 941d3af..924a392 100644
--- a/src/com/android/launcher3/allapps/SearchUiManager.java
+++ b/src/com/android/launcher3/allapps/SearchUiManager.java
@@ -15,7 +15,6 @@
  */
 package com.android.launcher3.allapps;
 
-import android.graphics.Rect;
 import android.view.KeyEvent;
 
 import androidx.annotation.Nullable;
@@ -44,11 +43,6 @@
     default void preDispatchKeyEvent(KeyEvent keyEvent) { };
 
     /**
-     * Returns the vertical shift for the all-apps view, so that it aligns with the hotseat.
-     */
-    float getScrollRangeDelta(Rect insets);
-
-    /**
      * @return the edit text object
      */
     @Nullable
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index c51bcf5..a8185d6 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -42,7 +42,6 @@
 import com.android.launcher3.allapps.AllAppsStore;
 import com.android.launcher3.allapps.AlphabeticalAppsList;
 import com.android.launcher3.allapps.SearchUiManager;
-import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.search.SearchCallback;
 
 import java.util.ArrayList;
@@ -210,16 +209,6 @@
     }
 
     @Override
-    public float getScrollRangeDelta(Rect insets) {
-        if (mLauncher.getDeviceProfile().isVerticalBarLayout()
-                || FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
-            return 0;
-        } else {
-            return insets.bottom + insets.top;
-        }
-    }
-
-    @Override
     public ExtendedEditText getEditText() {
         return this;
     }
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index c7f0133..6331ef2 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -95,6 +95,10 @@
     public static final BooleanFlag ENABLE_DEVICE_SEARCH = new DeviceFlag(
             "ENABLE_DEVICE_SEARCH", true, "Allows on device search in all apps");
 
+    public static final BooleanFlag ENABLE_PEOPLE_TILE_PREVIEW = getDebugFlag(
+            "ENABLE_PEOPLE_TILE_PREVIEW", false,
+            "Experimental: Shows conversation shortcuts on home screen as search results");
+
     public static final BooleanFlag FOLDER_NAME_SUGGEST = new DeviceFlag(
             "FOLDER_NAME_SUGGEST", true,
             "Suggests folder names instead of blank text.");
@@ -218,6 +222,9 @@
     public static final BooleanFlag ENABLE_ENFORCED_ROUNDED_CORNERS = new DeviceFlag(
             "ENABLE_ENFORCED_ROUNDED_CORNERS", true, "Enforce rounded corners on all App Widgets");
 
+    public static final BooleanFlag NOTIFY_CRASHES = getDebugFlag("NOTIFY_CRASHES", false,
+            "Sends a notification whenever launcher encounters an uncaught exception.");
+
     public static void initialize(Context context) {
         synchronized (sDebugFlags) {
             for (DebugFlag flag : sDebugFlags) {
diff --git a/src/com/android/launcher3/dragndrop/AppWidgetHostViewDrawable.java b/src/com/android/launcher3/dragndrop/AppWidgetHostViewDrawable.java
index 7b32bbf..2135f5d 100644
--- a/src/com/android/launcher3/dragndrop/AppWidgetHostViewDrawable.java
+++ b/src/com/android/launcher3/dragndrop/AppWidgetHostViewDrawable.java
@@ -17,12 +17,8 @@
 
 import android.graphics.Canvas;
 import android.graphics.ColorFilter;
-import android.graphics.Outline;
 import android.graphics.Paint;
-import android.graphics.Path;
 import android.graphics.PixelFormat;
-import android.graphics.Rect;
-import android.graphics.RectF;
 import android.graphics.drawable.Drawable;
 
 import com.android.launcher3.widget.LauncherAppWidgetHostView;
@@ -36,38 +32,15 @@
 
     private final LauncherAppWidgetHostView mAppWidgetHostView;
     private Paint mPaint = new Paint();
-    private final Path mClipPath;
-    private final boolean mWasAttached;
 
     public AppWidgetHostViewDrawable(LauncherAppWidgetHostView appWidgetHostView) {
         mAppWidgetHostView = appWidgetHostView;
-        mWasAttached = appWidgetHostView.isAttachedToWindow();
-        Path clipPath = null;
-        if (appWidgetHostView.getClipToOutline()) {
-            Outline outline = new Outline();
-            mAppWidgetHostView.getOutlineProvider().getOutline(mAppWidgetHostView, outline);
-            Rect rect = new Rect();
-            if (outline.getRect(rect)) {
-                float radius = outline.getRadius();
-                clipPath = new Path();
-                clipPath.addRoundRect(new RectF(rect), radius, radius, Path.Direction.CCW);
-            }
-        }
-        mClipPath = clipPath;
     }
 
     @Override
     public void draw(Canvas canvas) {
         int saveCount = canvas.saveLayer(0, 0, getIntrinsicWidth(), getIntrinsicHeight(), mPaint);
-        if (mClipPath != null) {
-            canvas.clipPath(mClipPath);
-        }
-        // If the view was never attached, or is current attached, then draw. Otherwise do not try
-        // to draw, or we might trigger bugs with items that get drawn while requiring the view to
-        // be attached.
-        if (!mWasAttached || mAppWidgetHostView.isAttachedToWindow()) {
-            mAppWidgetHostView.draw(canvas);
-        }
+        mAppWidgetHostView.draw(canvas);
         canvas.restoreToCount(saveCount);
     }
 
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 419c3f1..c80fd90 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -46,7 +46,6 @@
 import com.android.launcher3.ShortcutAndWidgetContainer;
 import com.android.launcher3.Workspace;
 import com.android.launcher3.folder.Folder;
-import com.android.launcher3.graphics.OverviewScrim;
 import com.android.launcher3.graphics.SysUiScrim;
 import com.android.launcher3.graphics.WorkspaceDragScrim;
 import com.android.launcher3.keyboard.ViewGroupFocusHelper;
@@ -84,7 +83,6 @@
 
     // Related to adjacent page hints
     private final ViewGroupFocusHelper mFocusIndicatorHelper;
-    private final OverviewScrim mOverviewScrim;
     private WorkspaceDragScrim mWorkspaceDragScrim;
     private SysUiScrim mSysUiScrim;
     private LauncherRootView mRootView;
@@ -103,15 +101,12 @@
         setChildrenDrawingOrderEnabled(true);
 
         mFocusIndicatorHelper = new ViewGroupFocusHelper(this);
-        mOverviewScrim = new OverviewScrim(this);
     }
 
     public void setup(DragController dragController, Workspace workspace) {
         mDragController = dragController;
         recreateControllers();
 
-        mOverviewScrim.setup();
-
         mWorkspaceDragScrim = new WorkspaceDragScrim((this));
         mWorkspaceDragScrim.setWorkspace(workspace);
 
@@ -529,20 +524,8 @@
     protected void dispatchDraw(Canvas canvas) {
         // Draw the background below children.
         mWorkspaceDragScrim.draw(canvas);
-        mOverviewScrim.updateCurrentScrimmedView(this);
         mFocusIndicatorHelper.draw(canvas);
         super.dispatchDraw(canvas);
-        if (mOverviewScrim.getScrimmedView() == null) {
-            mOverviewScrim.draw(canvas);
-        }
-    }
-
-    @Override
-    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
-        if (child == mOverviewScrim.getScrimmedView()) {
-            mOverviewScrim.draw(canvas);
-        }
-        return super.drawChild(canvas, child, drawingTime);
     }
 
     @Override
@@ -564,8 +547,4 @@
     public SysUiScrim getSysUiScrim() {
         return mSysUiScrim;
     }
-
-    public OverviewScrim getOverviewScrim() {
-        return mOverviewScrim;
-    }
 }
diff --git a/src/com/android/launcher3/graphics/OverviewScrim.java b/src/com/android/launcher3/graphics/OverviewScrim.java
deleted file mode 100644
index 7d52744..0000000
--- a/src/com/android/launcher3/graphics/OverviewScrim.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2019 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.graphics;
-
-import static android.view.View.VISIBLE;
-
-import android.util.FloatProperty;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-import com.android.launcher3.R;
-import com.android.launcher3.uioverrides.WallpaperColorInfo;
-import com.android.launcher3.util.Themes;
-
-/**
- * View scrim which draws behind overview (recent apps).
- */
-public class OverviewScrim extends Scrim {
-
-    public static final FloatProperty<OverviewScrim> SCRIM_MULTIPLIER =
-            new FloatProperty<OverviewScrim>("scrimMultiplier") {
-                @Override
-                public Float get(OverviewScrim scrim) {
-                    return scrim.mScrimMultiplier;
-                }
-
-                @Override
-                public void setValue(OverviewScrim scrim, float v) {
-                    scrim.setScrimMultiplier(v);
-                }
-            };
-
-    private @NonNull View mStableScrimmedView;
-    // Might be higher up if mStableScrimmedView is invisible.
-    private @Nullable View mCurrentScrimmedView;
-
-    private float mScrimMultiplier = 1f;
-
-    public OverviewScrim(View view) {
-        super(view);
-
-        mScrimColor = Themes.getAttrColor(view.getContext(), R.attr.allAppsScrimColor);
-    }
-
-    /**
-     * Initializes once view hierarchy is established.
-     */
-    public void setup() {
-        mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel();
-    }
-
-    public void updateCurrentScrimmedView(ViewGroup root) {
-        // Find the lowest view that is at or above the view we want to show the scrim behind.
-        mCurrentScrimmedView = mStableScrimmedView;
-        int currentIndex = root.indexOfChild(mCurrentScrimmedView);
-        final int childCount = root.getChildCount();
-        while (mCurrentScrimmedView != null && mCurrentScrimmedView.getVisibility() != VISIBLE
-                && currentIndex < childCount) {
-            currentIndex++;
-            mCurrentScrimmedView = root.getChildAt(currentIndex);
-        }
-    }
-
-    @Override
-    public void onExtractedColorsChanged(WallpaperColorInfo wallpaperColorInfo) {
-        // No super, don't respond to wallpaper colors, follow device ones instead
-    }
-
-    /**
-     * @return The view to draw the scrim behind, or null if all visible views should be scrimmed.
-     */
-    public @Nullable View getScrimmedView() {
-        return mCurrentScrimmedView;
-    }
-
-    private void setScrimMultiplier(float scrimMultiplier) {
-        if (Float.compare(mScrimMultiplier, scrimMultiplier) != 0) {
-            mScrimMultiplier = scrimMultiplier;
-            invalidate();
-        }
-    }
-
-    @Override
-    protected int getScrimAlpha() {
-        return Math.round(super.getScrimAlpha() * mScrimMultiplier);
-    }
-}
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
index 56dbbd3..fd51ba8 100644
--- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
+++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
@@ -20,6 +20,7 @@
 import android.content.pm.LauncherApps;
 import android.content.pm.PackageInstaller.SessionInfo;
 import android.os.UserHandle;
+import android.util.Log;
 import android.util.LongSparseArray;
 import android.util.Pair;
 
@@ -47,6 +48,8 @@
  */
 public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
 
+    private static final String LOG = "AddWorkspaceItemsTask";
+
     private final List<Pair<ItemInfo, Object>> mItemList;
 
     /**
@@ -167,6 +170,8 @@
 
                 // Save the WorkspaceItemInfo for binding in the workspace
                 addedItemsFinal.add(itemInfo);
+
+                Log.i(LOG, "Adding item info to workspace: " + itemInfo);
             }
         }
 
diff --git a/src/com/android/launcher3/model/ItemInstallQueue.java b/src/com/android/launcher3/model/ItemInstallQueue.java
index df8367f..836d804 100644
--- a/src/com/android/launcher3/model/ItemInstallQueue.java
+++ b/src/com/android/launcher3/model/ItemInstallQueue.java
@@ -63,6 +63,8 @@
  */
 public class ItemInstallQueue {
 
+    private static final String LOG = "ItemInstallQueue";
+
     public static final int FLAG_ACTIVITY_PAUSED = 1;
     public static final int FLAG_LOADER_RUNNING = 2;
     public static final int FLAG_DRAG_AND_DROP = 4;
@@ -183,7 +185,17 @@
 
     private void queuePendingShortcutInfo(PendingInstallShortcutInfo info) {
         // Queue the item up for adding if launcher has not loaded properly yet
-        MODEL_EXECUTOR.post(() -> addToQueue(info));
+        MODEL_EXECUTOR.post(() -> {
+            Pair<ItemInfo, Object> itemInfo = info.getItemInfo(mContext);
+            if (itemInfo == null) {
+                Log.i(LOG, "Adding PendingInstallShortcutInfo with no attached info to queue.");
+            } else {
+                Log.i(LOG, "Adding PendingInstallShortcutInfo to queue. Attached info: "
+                        + itemInfo.first);
+            }
+
+            addToQueue(info);
+        });
         flushInstallQueue();
     }
 
diff --git a/src/com/android/launcher3/pm/InstallSessionHelper.java b/src/com/android/launcher3/pm/InstallSessionHelper.java
index 0091af1..72f1c58 100644
--- a/src/com/android/launcher3/pm/InstallSessionHelper.java
+++ b/src/com/android/launcher3/pm/InstallSessionHelper.java
@@ -29,6 +29,7 @@
 import android.os.Process;
 import android.os.UserHandle;
 import android.text.TextUtils;
+import android.util.Log;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.RequiresApi;
@@ -56,6 +57,8 @@
  */
 public class InstallSessionHelper {
 
+    private static final String LOG = "InstallSessionHelper";
+
     // Set<String> of session ids of promise icons that have been added to the home screen
     // as FLAG_PROMISE_NEW_INSTALLS.
     protected static final String PROMISE_ICON_IDS = "promise_icon_ids";
@@ -219,6 +222,9 @@
                 && !promiseIconAddedForId(sessionInfo.getSessionId())
                 && !new PackageManagerHelper(mAppContext).isAppInstalled(
                         sessionInfo.getAppPackageName(), getUserHandle(sessionInfo))) {
+            Log.i(LOG, "Adding package name to install queue: "
+                    + sessionInfo.getAppPackageName());
+
             ItemInstallQueue.INSTANCE.get(mAppContext)
                     .queueItem(sessionInfo.getAppPackageName(), getUserHandle(sessionInfo));
 
diff --git a/src/com/android/launcher3/states/HintState.java b/src/com/android/launcher3/states/HintState.java
index 76f89bc..22c9d5b 100644
--- a/src/com/android/launcher3/states/HintState.java
+++ b/src/com/android/launcher3/states/HintState.java
@@ -49,7 +49,7 @@
     }
 
     @Override
-    public float getOverviewScrimAlpha(Launcher launcher) {
+    public float getWorkspaceScrimAlpha(Launcher launcher) {
         return 0.4f;
     }
 
diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java
index d593013..39bcdc5 100644
--- a/src/com/android/launcher3/states/SpringLoadedState.java
+++ b/src/com/android/launcher3/states/SpringLoadedState.java
@@ -88,7 +88,7 @@
     }
 
     @Override
-    public float getWorkspaceScrimAlpha(Launcher launcher) {
+    public float getWorkspaceBackgroundAlpha(Launcher launcher) {
         return 0.3f;
     }
 
diff --git a/src/com/android/launcher3/states/StateAnimationConfig.java b/src/com/android/launcher3/states/StateAnimationConfig.java
index 8e7dcc0..0dbfb0b 100644
--- a/src/com/android/launcher3/states/StateAnimationConfig.java
+++ b/src/com/android/launcher3/states/StateAnimationConfig.java
@@ -56,7 +56,7 @@
             ANIM_OVERVIEW_TRANSLATE_Y,
             ANIM_OVERVIEW_FADE,
             ANIM_ALL_APPS_FADE,
-            ANIM_OVERVIEW_SCRIM_FADE,
+            ANIM_WORKSPACE_SCRIM_FADE,
             ANIM_ALL_APPS_HEADER_FADE,
             ANIM_OVERVIEW_MODAL,
             ANIM_DEPTH,
@@ -75,7 +75,7 @@
     public static final int ANIM_OVERVIEW_TRANSLATE_Y = 8;
     public static final int ANIM_OVERVIEW_FADE = 9;
     public static final int ANIM_ALL_APPS_FADE = 10;
-    public static final int ANIM_OVERVIEW_SCRIM_FADE = 11;
+    public static final int ANIM_WORKSPACE_SCRIM_FADE = 11;
     public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions
     public static final int ANIM_OVERVIEW_MODAL = 13;
     public static final int ANIM_DEPTH = 14;
diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
index 19dfe15..a241e63 100644
--- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java
@@ -24,7 +24,6 @@
 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 static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
-import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_SIDE;
 
 import android.content.res.Resources;
 import android.graphics.PointF;
@@ -45,7 +44,7 @@
 import com.android.launcher3.util.OverScroller;
 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
 
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 public class LandscapePagedViewHandler implements PagedOrientationHandler {
@@ -76,14 +75,6 @@
     }
 
     @Override
-    public void getCurveProperties(PagedView view, Rect insets, CurveProperties out) {
-        out.scroll = view.getScrollY();
-        out.halfPageSize = view.getNormalChildHeight() / 2;
-        out.halfScreenSize = view.getMeasuredHeight() / 2;
-        out.screenCenter = insets.top + view.getPaddingTop() + out.scroll + out.halfPageSize;
-    }
-
-    @Override
     public boolean isLayoutNaturalToLauncher() {
         return false;
     }
@@ -308,15 +299,10 @@
 
     @Override
     public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
-        List<SplitPositionOption> options = new ArrayList<>(2);
-        // Add left/right options where left => position top, right => position bottom
-        options.add(new SplitPositionOption(
+        // Add "left" side of phone which is actually the top
+        return Collections.singletonList(new SplitPositionOption(
                 R.drawable.ic_split_screen, R.string.split_screen_position_left,
                 STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
-        options.add(new SplitPositionOption(
-                R.drawable.ic_split_screen, R.string.split_screen_position_right,
-                STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE));
-        return options;
     }
 
     @Override
diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java
index 9140a04..b85d08a 100644
--- a/src/com/android/launcher3/touch/PagedOrientationHandler.java
+++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java
@@ -93,7 +93,6 @@
     void delegateScrollTo(PagedView pagedView, int primaryScroll);
     void delegateScrollBy(PagedView pagedView, int unboundedScroll, int x, int y);
     void scrollerStartScroll(OverScroller scroller, int newPosition);
-    void getCurveProperties(PagedView view, Rect insets, CurveProperties out);
     boolean isLayoutNaturalToLauncher();
     float getTaskMenuX(float x, View thumbnailView);
     float getTaskMenuY(float y, View thumbnailView);
@@ -121,13 +120,6 @@
      */
     void adjustFloatingIconStartVelocity(PointF velocity);
 
-    class CurveProperties {
-        public int scroll;
-        public int halfPageSize;
-        public int screenCenter;
-        public int halfScreenSize;
-    }
-
     class ChildBounds {
 
         public final int primaryDimension;
diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
index 29be627..2fb5952 100644
--- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
+++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java
@@ -22,7 +22,6 @@
 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 static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
-import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_SIDE;
 
 import android.content.res.Resources;
 import android.graphics.PointF;
@@ -74,14 +73,6 @@
     }
 
     @Override
-    public void getCurveProperties(PagedView view, Rect insets, CurveProperties out) {
-        out.scroll = view.getScrollX();
-        out.halfPageSize = view.getNormalChildWidth() / 2;
-        out.halfScreenSize = view.getMeasuredWidth() / 2;
-        out.screenCenter = insets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize;
-    }
-
-    @Override
     public boolean isLayoutNaturalToLauncher() {
         return true;
     }
@@ -306,16 +297,17 @@
 
     @Override
     public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
-        List<SplitPositionOption> options = new ArrayList<>(2);
+        List<SplitPositionOption> options = new ArrayList<>(1);
         // TODO: Add in correct icons
-        if (dp.isLandscape) { // or seascape
+        if (dp.isSeascape()) { // or seascape
             // Add left/right options
             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) {
+            options.add(new SplitPositionOption(
                     R.drawable.ic_split_screen, R.string.split_screen_position_left,
                     STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
-            options.add(new SplitPositionOption(
-                    R.drawable.ic_split_screen, R.string.split_screen_position_right,
-                    STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE));
         } else {
             // Only add top option
             options.add(new SplitPositionOption(
diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
index b5252f7..bd6e31b 100644
--- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
+++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java
@@ -20,7 +20,6 @@
 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 static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
-import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_SIDE;
 
 import android.content.res.Resources;
 import android.graphics.PointF;
@@ -33,7 +32,7 @@
 import com.android.launcher3.Utilities;
 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
 
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
@@ -96,15 +95,10 @@
 
     @Override
     public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
-        List<SplitPositionOption> options = new ArrayList<>(2);
-        // Add left/right options where left => position bottom, right => position top
-        options.add(new SplitPositionOption(
-                R.drawable.ic_split_screen, R.string.split_screen_position_left,
-                STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE));
-        options.add(new SplitPositionOption(
+        // Add "right" option which is actually the top
+        return Collections.singletonList(new SplitPositionOption(
                 R.drawable.ic_split_screen, R.string.split_screen_position_right,
                 STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
-        return options;
     }
 
     /* ---------- The following are only used by TaskViewTouchHandler. ---------- */
diff --git a/src/com/android/launcher3/views/AbstractSlideInView.java b/src/com/android/launcher3/views/AbstractSlideInView.java
index e08f881..f79313f 100644
--- a/src/com/android/launcher3/views/AbstractSlideInView.java
+++ b/src/com/android/launcher3/views/AbstractSlideInView.java
@@ -216,7 +216,7 @@
         return mLauncher.getDragLayer();
     }
 
-    protected static View createColorScrim(Context context, int bgColor) {
+    protected View createColorScrim(Context context, int bgColor) {
         View view = new View(context);
         view.forceHasOverlappingRendering(false);
         view.setBackgroundColor(bgColor);
diff --git a/src/com/android/launcher3/views/AccessibilityActionsView.java b/src/com/android/launcher3/views/AccessibilityActionsView.java
index 0eacaa3..1d136c3 100644
--- a/src/com/android/launcher3/views/AccessibilityActionsView.java
+++ b/src/com/android/launcher3/views/AccessibilityActionsView.java
@@ -67,7 +67,7 @@
         info.addAction(new AccessibilityAction(
                 R.string.all_apps_button_label, l.getText(R.string.all_apps_button_label)));
         for (OptionItem item : OptionsPopupView.getOptions(l)) {
-            info.addAction(new AccessibilityAction(item.labelRes, l.getText(item.labelRes)));
+            info.addAction(new AccessibilityAction(item.labelRes, item.label));
         }
         return info;
     }
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 9a2db10..98cc876 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -26,6 +26,7 @@
 import android.content.Intent;
 import android.graphics.Rect;
 import android.graphics.RectF;
+import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
 import android.util.ArrayMap;
 import android.util.AttributeSet;
@@ -37,6 +38,7 @@
 
 import androidx.annotation.Nullable;
 import androidx.annotation.VisibleForTesting;
+import androidx.core.content.ContextCompat;
 
 import com.android.launcher3.Launcher;
 import com.android.launcher3.LauncherSettings;
@@ -62,6 +64,7 @@
 
     private final ArrayMap<View, OptionItem> mItemMap = new ArrayMap<>();
     private RectF mTargetRect;
+    private boolean mShouldAddArrow;
 
     public OptionsPopupView(Context context, AttributeSet attrs) {
         this(context, attrs, 0);
@@ -113,9 +116,13 @@
         return (type & TYPE_OPTIONS_POPUP) != 0;
     }
 
+    public void setShouldAddArrow(boolean shouldAddArrow) {
+        mShouldAddArrow = shouldAddArrow;
+    }
+
     @Override
     protected boolean shouldAddArrow() {
-        return false;
+        return mShouldAddArrow;
     }
 
     @Override
@@ -124,16 +131,17 @@
     }
 
     public static OptionsPopupView show(
-            Launcher launcher, RectF targetRect, List<OptionItem> items) {
+            Launcher launcher, RectF targetRect, List<OptionItem> items, boolean shouldAddArrow) {
         OptionsPopupView popup = (OptionsPopupView) launcher.getLayoutInflater()
                 .inflate(R.layout.longpress_options_menu, launcher.getDragLayer(), false);
         popup.mTargetRect = targetRect;
+        popup.setShouldAddArrow(shouldAddArrow);
 
         for (OptionItem item : items) {
             DeepShortcutView view =
                     (DeepShortcutView) popup.inflateAndAdd(R.layout.system_shortcut, popup);
-            view.getIconView().setBackgroundResource(item.iconRes);
-            view.getBubbleText().setText(item.labelRes);
+            view.getIconView().setBackgroundDrawable(item.icon);
+            view.getBubbleText().setText(item.label);
             view.setOnClickListener(popup);
             view.setOnLongClickListener(popup);
             popup.mItemMap.put(view, item);
@@ -154,7 +162,7 @@
             y = launcher.getDragLayer().getHeight() / 2;
         }
         RectF target = new RectF(x - halfSize, y - halfSize, x + halfSize, y + halfSize);
-        show(launcher, target, getOptions(launcher));
+        show(launcher, target, getOptions(launcher), false);
     }
 
     /**
@@ -162,11 +170,15 @@
      */
     public static ArrayList<OptionItem> getOptions(Launcher launcher) {
         ArrayList<OptionItem> options = new ArrayList<>();
-        options.add(new OptionItem(R.string.settings_button_text, R.drawable.ic_setting,
+        options.add(new OptionItem(launcher,
+                R.string.settings_button_text,
+                R.drawable.ic_setting,
                 LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS,
                 OptionsPopupView::startSettings));
         if (!WidgetsModel.GO_DISABLE_WIDGETS) {
-            options.add(new OptionItem(R.string.widget_button_text, R.drawable.ic_widget,
+            options.add(new OptionItem(launcher,
+                    R.string.widget_button_text,
+                    R.drawable.ic_widget,
                     LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS,
                     OptionsPopupView::onWidgetsClicked));
         }
@@ -174,7 +186,9 @@
                 R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text;
         int resDrawable = Utilities.existsStyleWallpapers(launcher) ?
                 R.drawable.ic_palette : R.drawable.ic_wallpaper;
-        options.add(new OptionItem(resString, resDrawable,
+        options.add(new OptionItem(launcher,
+                resString,
+                resDrawable,
                 IGNORE,
                 OptionsPopupView::startWallpaperPicker));
         return options;
@@ -241,15 +255,28 @@
 
     public static class OptionItem {
 
+        // Used to create AccessibilityNodeInfo in AccessibilityActionsView.java.
         public final int labelRes;
-        public final int iconRes;
+
+        public final CharSequence label;
+        public final Drawable icon;
         public final EventEnum eventId;
         public final OnLongClickListener clickListener;
 
-        public OptionItem(int labelRes, int iconRes, EventEnum eventId,
-                OnLongClickListener clickListener) {
+        public OptionItem(Context context, int labelRes, int iconRes, EventEnum eventId,
+                          OnLongClickListener clickListener) {
             this.labelRes = labelRes;
-            this.iconRes = iconRes;
+            this.label = context.getText(labelRes);
+            this.icon = ContextCompat.getDrawable(context, iconRes);
+            this.eventId = eventId;
+            this.clickListener = clickListener;
+        }
+
+        public OptionItem(CharSequence label, Drawable icon, EventEnum eventId,
+                          OnLongClickListener clickListener) {
+            this.labelRes = 0;
+            this.label = label;
+            this.icon = icon;
             this.eventId = eventId;
             this.clickListener = clickListener;
         }
diff --git a/src/com/android/launcher3/views/ScrimView.java b/src/com/android/launcher3/views/ScrimView.java
index 7f0765b..c9424de 100644
--- a/src/com/android/launcher3/views/ScrimView.java
+++ b/src/com/android/launcher3/views/ScrimView.java
@@ -15,14 +15,9 @@
  */
 package com.android.launcher3.views;
 
-import static androidx.core.graphics.ColorUtils.compositeColors;
-
-import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
 import static com.android.launcher3.util.SystemUiController.UI_STATE_SCRIM_VIEW;
 
 import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
 import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.View;
@@ -32,103 +27,61 @@
 import com.android.launcher3.Insettable;
 import com.android.launcher3.Launcher;
 import com.android.launcher3.R;
-import com.android.launcher3.uioverrides.WallpaperColorInfo;
-import com.android.launcher3.uioverrides.WallpaperColorInfo.OnChangeListener;
+import com.android.launcher3.util.SystemUiController;
 import com.android.launcher3.util.Themes;
 
 /**
  * Simple scrim which draws a flat color
  */
-public class ScrimView<T extends Launcher> extends View implements Insettable, OnChangeListener {
+public class ScrimView extends View implements Insettable {
+    private static final float STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD = 0.9f;
 
-    protected final T mLauncher;
-    private final WallpaperColorInfo mWallpaperColorInfo;
-    protected final int mEndScrim;
-    protected final boolean mIsScrimDark;
-
-    protected float mMaxScrimAlpha;
-
-    protected float mProgress = 1;
-    protected int mScrimColor;
-
-    protected int mCurrentFlatColor;
-    protected int mEndFlatColor;
-    protected int mEndFlatColorAlpha;
+    private final boolean mIsScrimDark;
+    private SystemUiController mSystemUiController;
 
     public ScrimView(Context context, AttributeSet attrs) {
         super(context, attrs);
-        mLauncher = Launcher.cast(Launcher.getLauncher(context));
-        mWallpaperColorInfo = WallpaperColorInfo.INSTANCE.get(context);
-        mEndScrim = Themes.getAttrColor(context, R.attr.allAppsScrimColor);
-        mIsScrimDark = ColorUtils.calculateLuminance(mEndScrim) < 0.5f;
-
-        mMaxScrimAlpha = 0.7f;
+        mIsScrimDark = ColorUtils.calculateLuminance(
+                Themes.getAttrColor(context, R.attr.allAppsScrimColor)) < 0.5f;
         setFocusable(false);
     }
 
     @Override
     public void setInsets(Rect insets) { }
 
-
-    @Override
-    protected void onAttachedToWindow() {
-        super.onAttachedToWindow();
-        mWallpaperColorInfo.addOnChangeListener(this);
-        onExtractedColorsChanged(mWallpaperColorInfo);
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        super.onDetachedFromWindow();
-        mWallpaperColorInfo.removeOnChangeListener(this);
-    }
-
     @Override
     public boolean hasOverlappingRendering() {
         return false;
     }
 
     @Override
-    public void onExtractedColorsChanged(WallpaperColorInfo wallpaperColorInfo) {
-        mScrimColor = wallpaperColorInfo.getMainColor();
-        mEndFlatColor = compositeColors(mEndScrim, setColorAlphaBound(
-                mScrimColor, Math.round(mMaxScrimAlpha * 255)));
-        mEndFlatColorAlpha = Color.alpha(mEndFlatColor);
-        updateColors();
-        invalidate();
-    }
-
-    public void setProgress(float progress) {
-        if (mProgress != progress) {
-            mProgress = progress;
-            updateColors();
-            updateSysUiColors();
-            invalidate();
-        }
-    }
-
-    public void reInitUi() { }
-
-    protected void updateColors() {
-        mCurrentFlatColor = mProgress >= 1 ? 0 : setColorAlphaBound(
-                mEndFlatColor, Math.round((1 - mProgress) * mEndFlatColorAlpha));
-    }
-
-    protected void updateSysUiColors() {
-        // Use a light system UI (dark icons) if all apps is behind at least half of the
-        // status bar.
-        boolean forceChange = mProgress <= 0.1f;
-        if (forceChange) {
-            mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !mIsScrimDark);
-        } else {
-            mLauncher.getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, 0);
-        }
+    protected boolean onSetAlpha(int alpha) {
+        updateSysUiColors();
+        return super.onSetAlpha(alpha);
     }
 
     @Override
-    protected void onDraw(Canvas canvas) {
-        if (mCurrentFlatColor != 0) {
-            canvas.drawColor(mCurrentFlatColor);
+    protected void onVisibilityChanged(View changedView, int visibility) {
+        super.onVisibilityChanged(changedView, visibility);
+        updateSysUiColors();
+    }
+
+    private void updateSysUiColors() {
+        // Use a light system UI (dark icons) if all apps is behind at least half of the
+        // status bar.
+        boolean forceChange =
+                getVisibility() == VISIBLE && getAlpha() > STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD;
+        if (forceChange) {
+            getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, !mIsScrimDark);
+        } else {
+            getSystemUiController().updateUiState(UI_STATE_SCRIM_VIEW, 0);
         }
     }
+
+    private SystemUiController getSystemUiController() {
+        if (mSystemUiController == null) {
+            mSystemUiController = Launcher.getLauncher(getContext()).getSystemUiController();
+        }
+        return mSystemUiController;
+    }
 }
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index fc63af0..95b887c 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -19,6 +19,7 @@
 
 import android.content.Context;
 import android.graphics.Point;
+import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -108,7 +109,7 @@
 
         // If the ImageView doesn't have a drawable yet, the widget preview hasn't been loaded and
         // we abort the drag.
-        if (image.getDrawable() == null) {
+        if (image.getDrawable() == null && v.getAppWidgetHostViewPreview() == null) {
             return false;
         }
 
@@ -116,11 +117,21 @@
         dragHelper.setRemoteViewsPreview(v.getPreview());
         dragHelper.setAppWidgetHostViewPreview(v.getAppWidgetHostViewPreview());
 
-        int[] loc = new int[2];
-        getPopupContainer().getLocationInDragLayer(image, loc);
+        if (image.getDrawable() != null) {
+            int[] loc = new int[2];
+            getPopupContainer().getLocationInDragLayer(image, loc);
 
-        dragHelper.startDrag(image.getBitmapBounds(), image.getDrawable().getIntrinsicWidth(),
-                image.getWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
+            dragHelper.startDrag(image.getBitmapBounds(), image.getDrawable().getIntrinsicWidth(),
+                    image.getWidth(), new Point(loc[0], loc[1]), this, new DragOptions());
+        } else {
+            View preview = v.getAppWidgetHostViewPreview();
+            int[] loc = new int[2];
+            getPopupContainer().getLocationInDragLayer(preview, loc);
+
+            Rect r = new Rect(0, 0, preview.getWidth(), preview.getHeight());
+            dragHelper.startDrag(r, preview.getMeasuredWidth(), preview.getMeasuredWidth(),
+                    new Point(loc[0], loc[1]), this, new DragOptions());
+        }
         close(true);
         return true;
     }
diff --git a/src/com/android/launcher3/widget/PendingItemDragHelper.java b/src/com/android/launcher3/widget/PendingItemDragHelper.java
index 3e61e56..e78d517 100644
--- a/src/com/android/launcher3/widget/PendingItemDragHelper.java
+++ b/src/com/android/launcher3/widget/PendingItemDragHelper.java
@@ -115,6 +115,7 @@
             }
             if (mAppWidgetHostViewPreview != null) {
                 preview = new AppWidgetHostViewDrawable(mAppWidgetHostViewPreview);
+                previewSizeBeforeScale[0] = mAppWidgetHostViewPreview.getMeasuredWidth();
                 launcher.getDragController()
                         .addDragListener(new AppWidgetHostViewDragListener(launcher));
             }
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index 40b256b..5e7c961 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -28,9 +28,11 @@
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.View.OnLayoutChangeListener;
+import android.view.ViewGroup;
 import android.view.ViewPropertyAnimator;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.FrameLayout;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.RemoteViews;
 import android.widget.TextView;
@@ -42,7 +44,6 @@
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.R;
 import com.android.launcher3.WidgetPreviewLoader;
-import com.android.launcher3.dragndrop.AppWidgetHostViewDrawable;
 import com.android.launcher3.icons.BaseIconFactory;
 import com.android.launcher3.icons.BitmapRenderer;
 import com.android.launcher3.icons.FastBitmapDrawable;
@@ -77,7 +78,9 @@
     private int mCellSize;
     private float mPreviewScale = 1f;
 
+    private FrameLayout mWidgetImageContainer;
     private WidgetImageView mWidgetImage;
+    private ImageView mWidgetBadge;
     private TextView mWidgetName;
     private TextView mWidgetDims;
     private TextView mWidgetDescription;
@@ -133,7 +136,9 @@
     protected void onFinishInflate() {
         super.onFinishInflate();
 
+        mWidgetImageContainer = findViewById(R.id.widget_preview_container);
         mWidgetImage = findViewById(R.id.widget_preview);
+        mWidgetBadge = findViewById(R.id.widget_badge);
         mWidgetName = findViewById(R.id.widget_name);
         mWidgetDims = findViewById(R.id.widget_dims);
         mWidgetDescription = findViewById(R.id.widget_description);
@@ -155,7 +160,9 @@
             Log.d(TAG, "reset called on:" + mWidgetName.getText());
         }
         mWidgetImage.animate().cancel();
-        mWidgetImage.setDrawable(null, null);
+        mWidgetImage.setDrawable(null);
+        mWidgetImage.setVisibility(View.VISIBLE);
+        mWidgetBadge.setImageDrawable(null);
         mWidgetName.setText(null);
         mWidgetDims.setText(null);
         mWidgetDescription.setText(null);
@@ -167,6 +174,9 @@
             mActiveRequest = null;
         }
         mPreview = null;
+        if (mAppWidgetHostViewPreview != null) {
+            mWidgetImageContainer.removeView(mAppWidgetHostViewPreview);
+        }
         mAppWidgetHostViewPreview = null;
     }
 
@@ -215,6 +225,13 @@
             mAppWidgetHostViewPreview.setPadding(/* left= */ 0, /* top= */0, /* right= */
                     0, /* bottom= */ 0);
             mAppWidgetHostViewPreview.updateAppWidget(/* remoteViews= */ null);
+            // Gravity 77 = "fill"
+            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
+                    ViewGroup.LayoutParams.MATCH_PARENT,
+                    ViewGroup.LayoutParams.MATCH_PARENT, /* gravity= */ 77);
+            mAppWidgetHostViewPreview.setLayoutParams(params);
+            mWidgetImageContainer.addView(mAppWidgetHostViewPreview, /* index= */ 0);
+            mWidgetImage.setVisibility(View.GONE);
         }
     }
 
@@ -258,21 +275,36 @@
             return;
         }
         if (drawable != null) {
-            LayoutParams layoutParams = (LayoutParams) mWidgetImage.getLayoutParams();
-            layoutParams.width = (int) (drawable.getIntrinsicWidth() * mPreviewScale);
-            layoutParams.height = (int) (drawable.getIntrinsicHeight() * mPreviewScale);
-            mWidgetImage.setLayoutParams(layoutParams);
-
-            mWidgetImage.setDrawable(drawable, mWidgetPreviewLoader.getBadgeForUser(mItem.user,
-                    BaseIconFactory.getBadgeSizeForIconSize(mDeviceProfile.allAppsIconSizePx)));
-            if (mAnimatePreview) {
-                mWidgetImage.setAlpha(0f);
-                ViewPropertyAnimator anim = mWidgetImage.animate();
-                anim.alpha(1.0f).setDuration(FADE_IN_DURATION_MS);
-            } else {
-                mWidgetImage.setAlpha(1f);
+            setContainerSize(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
+            mWidgetImage.setDrawable(drawable);
+            mWidgetImage.setVisibility(View.VISIBLE);
+            if (mAppWidgetHostViewPreview != null) {
+                removeView(mAppWidgetHostViewPreview);
+                mAppWidgetHostViewPreview = null;
             }
         }
+        Drawable badge = mWidgetPreviewLoader.getBadgeForUser(mItem.user,
+                BaseIconFactory.getBadgeSizeForIconSize(mDeviceProfile.allAppsIconSizePx));
+        if (badge == null) {
+            mWidgetBadge.setVisibility(View.GONE);
+        } else {
+            mWidgetBadge.setVisibility(View.VISIBLE);
+            mWidgetBadge.setImageDrawable(badge);
+        }
+        if (mAnimatePreview) {
+            mWidgetImageContainer.setAlpha(0f);
+            ViewPropertyAnimator anim = mWidgetImageContainer.animate();
+            anim.alpha(1.0f).setDuration(FADE_IN_DURATION_MS);
+        } else {
+            mWidgetImageContainer.setAlpha(1f);
+        }
+    }
+
+    private void setContainerSize(int width, int height) {
+        LayoutParams layoutParams = (LayoutParams) mWidgetImageContainer.getLayoutParams();
+        layoutParams.width = (int) (width * mPreviewScale);
+        layoutParams.height = (int) (height * mPreviewScale);
+        mWidgetImageContainer.setLayoutParams(layoutParams);
     }
 
     public void ensurePreview() {
@@ -290,15 +322,8 @@
             int viewWidth = dp.cellWidthPx * mItem.spanX;
             int viewHeight = dp.cellHeightPx * mItem.spanY;
 
-            mAppWidgetHostViewPreview.measure(
-                    MeasureSpec.makeMeasureSpec(viewWidth, MeasureSpec.EXACTLY),
-                    MeasureSpec.makeMeasureSpec(viewHeight, MeasureSpec.EXACTLY));
-
-            viewWidth = mAppWidgetHostViewPreview.getMeasuredWidth();
-            viewHeight = mAppWidgetHostViewPreview.getMeasuredHeight();
-            mAppWidgetHostViewPreview.layout(0, 0, viewWidth, viewHeight);
-            Drawable drawable = new AppWidgetHostViewDrawable(mAppWidgetHostViewPreview);
-            applyPreview(drawable);
+            setContainerSize(viewWidth, viewHeight);
+            applyPreview((Drawable) null);
             return;
         }
         if (mActiveRequest != null) {
diff --git a/src/com/android/launcher3/widget/WidgetCellPreview.java b/src/com/android/launcher3/widget/WidgetCellPreview.java
new file mode 100644
index 0000000..ad3a61a
--- /dev/null
+++ b/src/com/android/launcher3/widget/WidgetCellPreview.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.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.widget.FrameLayout;
+
+/**
+ * View group managing the widget preview: either using a {@link WidgetImageView} or an actual
+ * {@link LauncherAppWidgetHostView}.
+ */
+public class WidgetCellPreview extends FrameLayout {
+    public WidgetCellPreview(Context context) {
+        this(context, null);
+    }
+
+    public WidgetCellPreview(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public WidgetCellPreview(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    public boolean onInterceptTouchEvent(MotionEvent ev) {
+        super.onInterceptTouchEvent(ev);
+        return true;
+    }
+
+}
diff --git a/src/com/android/launcher3/widget/WidgetImageView.java b/src/com/android/launcher3/widget/WidgetImageView.java
index 39d701c..11f4485 100644
--- a/src/com/android/launcher3/widget/WidgetImageView.java
+++ b/src/com/android/launcher3/widget/WidgetImageView.java
@@ -25,7 +25,6 @@
 import android.view.View;
 
 import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
 
 /**
  * View that draws a bitmap horizontally centered. If the image width is greater than the view
@@ -37,7 +36,6 @@
     private final int mBadgeMargin;
 
     private Drawable mDrawable;
-    private Drawable mBadge;
 
     public WidgetImageView(Context context) {
         this(context, null);
@@ -54,9 +52,9 @@
                 .getDimensionPixelSize(R.dimen.profile_badge_margin);
     }
 
-    public void setDrawable(Drawable drawable, Drawable badge) {
+    /** Set the drawable to use for this view. */
+    public void setDrawable(Drawable drawable) {
         mDrawable = drawable;
-        mBadge = badge;
         invalidate();
     }
 
@@ -70,11 +68,6 @@
             updateDstRectF();
             mDrawable.setBounds(getBitmapBounds());
             mDrawable.draw(canvas);
-
-            // Only draw the badge if a preview was drawn.
-            if (mBadge != null) {
-                mBadge.draw(canvas);
-            }
         }
     }
 
@@ -105,17 +98,6 @@
             mDstRectF.top = (myHeight - scaledHeight) / 2;
             mDstRectF.bottom = (myHeight + scaledHeight) / 2;
         }
-
-        if (mBadge != null) {
-            Rect bounds = mBadge.getBounds();
-            int left = Utilities.boundToRange(
-                    (int) (mDstRectF.right + mBadgeMargin - bounds.width()),
-                    mBadgeMargin, getWidth() - bounds.width());
-            int top = Utilities.boundToRange(
-                    (int) (mDstRectF.bottom + mBadgeMargin - bounds.height()),
-                    mBadgeMargin, getHeight() - bounds.height());
-            mBadge.setBounds(left, top, bounds.width() + left, bounds.height() + top);
-        }
     }
 
     /**
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index d13884a..a4257a2 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -169,7 +169,7 @@
         onWidgetsBound();
 
         mSearchAndRecommendationViewHolder.mSearchBar.initialize(
-                mLauncher.getPopupDataProvider().getAllWidgets(), /* searchModeListener= */ this);
+                mLauncher.getPopupDataProvider(), /* searchModeListener= */ this);
     }
 
     @Override
diff --git a/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java b/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java
index c1d64b1..1524ab3 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsListTableViewHolderBinder.java
@@ -31,7 +31,6 @@
 import com.android.launcher3.model.WidgetItem;
 import com.android.launcher3.recyclerview.ViewHolderBinder;
 import com.android.launcher3.widget.WidgetCell;
-import com.android.launcher3.widget.WidgetImageView;
 import com.android.launcher3.widget.model.WidgetsListContentEntry;
 import com.android.launcher3.widget.util.WidgetsTableUtils;
 
@@ -170,7 +169,7 @@
                     WidgetCell widget = (WidgetCell) mLayoutInflater.inflate(
                             R.layout.widget_cell, tableRow, false);
                     // set up touch.
-                    WidgetImageView preview = widget.findViewById(R.id.widget_preview);
+                    View preview = widget.findViewById(R.id.widget_preview_container);
                     preview.setOnClickListener(mIconClickListener);
                     preview.setOnLongClickListener(mIconLongClickListener);
                     tableRow.addView(widget);
diff --git a/src/com/android/launcher3/widget/picker/search/LauncherWidgetsSearchBar.java b/src/com/android/launcher3/widget/picker/search/LauncherWidgetsSearchBar.java
index 56a08b1..42f1bb2 100644
--- a/src/com/android/launcher3/widget/picker/search/LauncherWidgetsSearchBar.java
+++ b/src/com/android/launcher3/widget/picker/search/LauncherWidgetsSearchBar.java
@@ -26,10 +26,7 @@
 
 import com.android.launcher3.ExtendedEditText;
 import com.android.launcher3.R;
-import com.android.launcher3.search.SearchAlgorithm;
-import com.android.launcher3.widget.model.WidgetsListBaseEntry;
-
-import java.util.List;
+import com.android.launcher3.popup.PopupDataProvider;
 
 /**
  * View for a search bar with an edit text with a cancel button.
@@ -54,12 +51,10 @@
     }
 
     @Override
-    public void initialize(List<WidgetsListBaseEntry> allWidgets,
-            SearchModeListener searchModeListener) {
-        SearchAlgorithm<WidgetsListBaseEntry> algo =
-                new SimpleWidgetsSearchAlgorithm(new SimpleWidgetsSearchPipeline(allWidgets));
+    public void initialize(PopupDataProvider dataProvider, SearchModeListener searchModeListener) {
         mController = new WidgetsSearchBarController(
-                algo, mEditText, mCancelButton, searchModeListener);
+                new SimpleWidgetsSearchAlgorithm(dataProvider),
+                mEditText, mCancelButton, searchModeListener);
     }
 
     @Override
diff --git a/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchAlgorithm.java b/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchAlgorithm.java
index 15d2454..9be3b5f 100644
--- a/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchAlgorithm.java
+++ b/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchAlgorithm.java
@@ -16,42 +16,41 @@
 
 package com.android.launcher3.widget.picker.search;
 
-import android.os.Handler;
-import android.util.Log;
+import static com.android.launcher3.search.StringMatcherUtility.matches;
 
+import android.os.Handler;
+
+import com.android.launcher3.model.WidgetItem;
+import com.android.launcher3.popup.PopupDataProvider;
 import com.android.launcher3.search.SearchAlgorithm;
 import com.android.launcher3.search.SearchCallback;
+import com.android.launcher3.search.StringMatcherUtility.StringMatcher;
 import com.android.launcher3.widget.model.WidgetsListBaseEntry;
+import com.android.launcher3.widget.model.WidgetsListContentEntry;
+import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
+import com.android.launcher3.widget.model.WidgetsListSearchHeaderEntry;
 
 import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * Implementation of {@link SearchAlgorithm} that posts a task to query on the main thread.
  */
 public final class SimpleWidgetsSearchAlgorithm implements SearchAlgorithm<WidgetsListBaseEntry> {
 
-    private static final boolean DEBUG = false;
-    private static final String TAG = "SimpleWidgetsSearchAlgo";
-    private static final String DELIM = "\t";
-
     private final Handler mResultHandler;
-    private final WidgetsPickerSearchPipeline mSearchPipeline;
+    private final PopupDataProvider mDataProvider;
 
-    public SimpleWidgetsSearchAlgorithm(WidgetsPickerSearchPipeline searchPipeline) {
+    public SimpleWidgetsSearchAlgorithm(PopupDataProvider dataProvider) {
         mResultHandler = new Handler();
-        mSearchPipeline = searchPipeline;
+        mDataProvider = dataProvider;
     }
 
     @Override
     public void doSearch(String query, SearchCallback<WidgetsListBaseEntry> callback) {
-        long startTime = System.currentTimeMillis();
-        String queryToken = query + DELIM + startTime;
-        if (DEBUG) {
-            Log.d(TAG, "doSearch queryToken:" + queryToken);
-        }
-        mSearchPipeline.query(query,
-                results -> mResultHandler.post(
-                        () -> callback.onSearchResult(queryToken, new ArrayList(results))));
+        ArrayList<WidgetsListBaseEntry> result = getFilteredWidgets(mDataProvider, query);
+        mResultHandler.post(() -> callback.onSearchResult(query, result));
     }
 
     @Override
@@ -60,4 +59,36 @@
             mResultHandler.removeCallbacksAndMessages(/*token= */null);
         }
     }
+
+    /**
+     * Returns entries for all matched widgets
+     */
+    public static ArrayList<WidgetsListBaseEntry> getFilteredWidgets(
+            PopupDataProvider dataProvider, String input) {
+        ArrayList<WidgetsListBaseEntry> results = new ArrayList<>();
+        dataProvider.getAllWidgets().stream()
+                .filter(entry -> entry instanceof WidgetsListHeaderEntry)
+                .forEach(headerEntry -> {
+                    List<WidgetItem> matchedWidgetItems = filterWidgetItems(
+                            input, headerEntry.mPkgItem.title.toString(), headerEntry.mWidgets);
+                    if (matchedWidgetItems.size() > 0) {
+                        results.add(new WidgetsListSearchHeaderEntry(headerEntry.mPkgItem,
+                                headerEntry.mTitleSectionName, matchedWidgetItems));
+                        results.add(new WidgetsListContentEntry(headerEntry.mPkgItem,
+                                headerEntry.mTitleSectionName, matchedWidgetItems));
+                    }
+                });
+        return results;
+    }
+
+    private static List<WidgetItem> filterWidgetItems(String query, String packageTitle,
+            List<WidgetItem> items) {
+        StringMatcher matcher = StringMatcher.getInstance();
+        if (matches(query, packageTitle, matcher)) {
+            return items;
+        }
+        return items.stream()
+                .filter(item -> matches(query, item.label, matcher))
+                .collect(Collectors.toList());
+    }
 }
diff --git a/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchPipeline.java b/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchPipeline.java
deleted file mode 100644
index 5222e8e..0000000
--- a/src/com/android/launcher3/widget/picker/search/SimpleWidgetsSearchPipeline.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.widget.picker.search;
-
-import static com.android.launcher3.search.StringMatcherUtility.matches;
-
-import com.android.launcher3.model.WidgetItem;
-import com.android.launcher3.search.StringMatcherUtility.StringMatcher;
-import com.android.launcher3.widget.model.WidgetsListBaseEntry;
-import com.android.launcher3.widget.model.WidgetsListContentEntry;
-import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
-import com.android.launcher3.widget.model.WidgetsListSearchHeaderEntry;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-
-/**
- * Implementation of {@link WidgetsPickerSearchPipeline} that performs search by prefix matching on
- * app names and widget labels.
- */
-public final class SimpleWidgetsSearchPipeline implements WidgetsPickerSearchPipeline {
-
-    private final List<WidgetsListBaseEntry> mAllEntries;
-
-    public SimpleWidgetsSearchPipeline(List<WidgetsListBaseEntry> allEntries) {
-        mAllEntries = allEntries;
-    }
-
-    @Override
-    public void query(String input, Consumer<List<WidgetsListBaseEntry>> callback) {
-        ArrayList<WidgetsListBaseEntry> results = new ArrayList<>();
-        mAllEntries.stream().filter(entry -> entry instanceof WidgetsListHeaderEntry)
-                .forEach(headerEntry -> {
-                    List<WidgetItem> matchedWidgetItems = filterWidgetItems(
-                            input, headerEntry.mPkgItem.title.toString(), headerEntry.mWidgets);
-                    if (matchedWidgetItems.size() > 0) {
-                        results.add(new WidgetsListSearchHeaderEntry(headerEntry.mPkgItem,
-                                headerEntry.mTitleSectionName, matchedWidgetItems));
-                        results.add(new WidgetsListContentEntry(headerEntry.mPkgItem,
-                                headerEntry.mTitleSectionName, matchedWidgetItems));
-                    }
-                });
-        callback.accept(results);
-    }
-
-    private List<WidgetItem> filterWidgetItems(String query, String packageTitle,
-            List<WidgetItem> items) {
-        StringMatcher matcher = StringMatcher.getInstance();
-        if (matches(query, packageTitle, matcher)) {
-            return items;
-        }
-        return items.stream()
-                .filter(item -> matches(query, item.label, matcher))
-                .collect(Collectors.toList());
-    }
-}
diff --git a/src/com/android/launcher3/widget/picker/search/WidgetsPickerSearchPipeline.java b/src/com/android/launcher3/widget/picker/search/WidgetsPickerSearchPipeline.java
deleted file mode 100644
index d12782c..0000000
--- a/src/com/android/launcher3/widget/picker/search/WidgetsPickerSearchPipeline.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.widget.picker.search;
-
-import com.android.launcher3.widget.model.WidgetsListBaseEntry;
-
-import java.util.List;
-import java.util.function.Consumer;
-
-/**
- * An interface for a pipeline to handle widgets search.
- */
-public interface WidgetsPickerSearchPipeline {
-
-    /**
-     * Performs a search query asynchronically. Invokes {@code callback} when the search is
-     * complete.
-     */
-    void query(String input, Consumer<List<WidgetsListBaseEntry>> callback);
-
-    /**
-     * Cancels any ongoing search request.
-     */
-    default void cancel() {};
-
-    /**
-     * Cleans up after search is no longer needed.
-     */
-    default void destroy() {};
-}
diff --git a/src/com/android/launcher3/widget/picker/search/WidgetsSearchBar.java b/src/com/android/launcher3/widget/picker/search/WidgetsSearchBar.java
index 3ac82c0..0ac47ce 100644
--- a/src/com/android/launcher3/widget/picker/search/WidgetsSearchBar.java
+++ b/src/com/android/launcher3/widget/picker/search/WidgetsSearchBar.java
@@ -16,9 +16,7 @@
 
 package com.android.launcher3.widget.picker.search;
 
-import com.android.launcher3.widget.model.WidgetsListBaseEntry;
-
-import java.util.List;
+import com.android.launcher3.popup.PopupDataProvider;
 
 /**
  * Interface for a widgets picker search bar.
@@ -27,7 +25,7 @@
     /**
      * Attaches a controller to the search bar which interacts with {@code searchModeListener}.
      */
-    void initialize(List<WidgetsListBaseEntry> allWidgets, SearchModeListener searchModeListener);
+    void initialize(PopupDataProvider dataProvider, SearchModeListener searchModeListener);
 
     /**
      * Clears search bar.
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
index ff28148..53748b7 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -74,4 +74,9 @@
     public float getVerticalProgress(Launcher launcher) {
         return 0f;
     }
+
+    @Override
+    public float getWorkspaceScrimAlpha(Launcher launcher) {
+        return 1;
+    }
 }