Snap for 9905614 from 627376d5b969bc223ce8c8265d330cd8c36625cd to tm-qpr3-release

Change-Id: I8d492c590ebbc00dd034f5bd8ca9b6297256ad37
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 2711b78..cd66562 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -100,10 +100,12 @@
                     windowLayoutParams,
                     intArrayOf(
                             ITYPE_EXTRA_NAVIGATION_BAR,
-                            ITYPE_BOTTOM_TAPPABLE_ELEMENT
+                            ITYPE_BOTTOM_TAPPABLE_ELEMENT,
+                            ITYPE_BOTTOM_MANDATORY_GESTURES
                     ),
                     intArrayOf(
                             SOURCE_FRAME,
+                            SOURCE_FRAME,
                             SOURCE_FRAME
                     )
             )
@@ -119,6 +121,7 @@
         val contentHeight = controllers.taskbarStashController.contentHeightToReportToApps
         val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps
         val res = context.resources
+
         for (provider in windowLayoutParams.providedInsets) {
             if (
                 provider.type == ITYPE_EXTRA_NAVIGATION_BAR ||
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java
index 5bb958a..610efeb 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java
@@ -27,6 +27,7 @@
 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_IME_SWITCHER_BUTTON_TAP;
 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_OVERVIEW_BUTTON_LONGPRESS;
 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_OVERVIEW_BUTTON_TAP;
+import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
 import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
 
@@ -265,6 +266,7 @@
     }
 
     private void navigateHome() {
+        TaskUtils.closeSystemWindowsAsync(CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY);
         mService.getOverviewCommandHelper().addCommand(OverviewCommandHelper.TYPE_HOME);
     }
 
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index 9984991..80bc1a7 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -16,7 +16,6 @@
 
 package com.android.launcher3.widget;
 
-import static android.view.View.MeasureSpec.getSize;
 import static android.view.View.MeasureSpec.makeMeasureSpec;
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
 import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
@@ -119,8 +118,6 @@
     private TextView mWidgetName;
     private TextView mWidgetDims;
     private TextView mWidgetDescription;
-    private Consumer<Bitmap> mCallback;
-    private @Nullable Bitmap mCachedPreview;
 
     protected WidgetItem mItem;
 
@@ -432,8 +429,6 @@
      */
     private void ensurePreviewWithCallback(Consumer<Bitmap> callback,
             @Nullable Bitmap cachedPreview) {
-        mCallback = callback;
-        mCachedPreview = cachedPreview;
         if (mAppWidgetHostViewPreview != null) {
             int containerWidth = (int) (mTargetPreviewWidth * mPreviewContainerScale);
             int containerHeight = (int) (mTargetPreviewHeight * mPreviewContainerScale);
@@ -474,7 +469,6 @@
                     INDEX_WIDGET_CENTERING,
                     -(params.width - (params.width * mPreviewContainerScale)) / 2.0f,
                     -(params.height - (params.height * mPreviewContainerScale)) / 2.0f);
-            mWidgetImageContainer.removeAllViews();
             mWidgetImageContainer.addView(mAppWidgetHostViewPreview, /* index= */ 0);
             mWidgetImage.setVisibility(View.GONE);
             applyPreview(null);
@@ -585,19 +579,4 @@
                 (mTargetPreviewHeight - verticalPadding) * mPreviewContainerScale
                         / appWidgetContentHeight);
     }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        int padding = getPaddingLeft() + getPaddingRight();
-        int allowedWidth = getSize(widthMeasureSpec) - padding;
-
-        // Here we prevent having clipped widgets when they're too large as the preview width is
-        // larger than the max allowed width. We then re-do the preview with the new preview width
-        if (allowedWidth > 0 && mCachedPreview == null && allowedWidth < mTargetPreviewWidth) {
-            mTargetPreviewWidth = allowedWidth;
-            ensurePreviewWithCallback(mCallback, null);
-        }
-
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-    }
 }