Merge "Add the KeyboardQuickSwitchView (2/2)" into tm-qpr-dev
diff --git a/src/com/android/launcher3/graphics/SysUiScrim.java b/src/com/android/launcher3/graphics/SysUiScrim.java
index 11e7dc8..e983a30 100644
--- a/src/com/android/launcher3/graphics/SysUiScrim.java
+++ b/src/com/android/launcher3/graphics/SysUiScrim.java
@@ -32,11 +32,10 @@
 import android.util.DisplayMetrics;
 import android.util.FloatProperty;
 import android.view.View;
-import android.view.WindowInsets;
 
 import com.android.launcher3.BaseDraggingActivity;
+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.testing.shared.ResourceUtils;
 import com.android.launcher3.util.DynamicResource;
@@ -185,21 +184,18 @@
 
     /**
      * Determines whether to draw the top and/or bottom scrim based on new insets.
+     *
+     * In order for the bottom scrim to be drawn this 3 condition should be meet at the same time:
+     * the device is in 3 button navigation, the taskbar is not present and the Hotseat is
+     * horizontal
      */
     public void onInsetsChanged(Rect insets) {
+        DeviceProfile dp = mActivity.getDeviceProfile();
         mDrawTopScrim = mTopScrim != null && insets.top > 0;
         mDrawBottomScrim = mBottomMask != null
-                && !mActivity.getDeviceProfile().isVerticalBarLayout()
-                && hasBottomNavButtons();
-    }
-
-    private boolean hasBottomNavButtons() {
-        if (Utilities.ATLEAST_Q && mActivity.getRootView() != null
-                && mActivity.getRootView().getRootWindowInsets() != null) {
-            WindowInsets windowInsets = mActivity.getRootView().getRootWindowInsets();
-            return windowInsets.getTappableElementInsets().bottom > 0;
-        }
-        return true;
+                && !dp.isVerticalBarLayout()
+                && !dp.isGestureMode
+                && !dp.isTaskbarPresent;
     }
 
     @Override
diff --git a/src/com/android/launcher3/widget/picker/WidgetsListSearchHeaderHolder.java b/src/com/android/launcher3/widget/picker/WidgetsListSearchHeaderHolder.java
deleted file mode 100644
index 9562af3..0000000
--- a/src/com/android/launcher3/widget/picker/WidgetsListSearchHeaderHolder.java
+++ /dev/null
@@ -1,32 +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;
-
-import androidx.recyclerview.widget.RecyclerView.ViewHolder;
-
-/**
- * A {@link ViewHolder} for {@link WidgetsListHeader} of an app, which renders the app icon, the app
- * name, label and a button for showing / hiding widgets.
- */
-public final class WidgetsListSearchHeaderHolder extends ViewHolder {
-    final WidgetsListHeader mWidgetsListHeader;
-
-    public WidgetsListSearchHeaderHolder(WidgetsListHeader view) {
-        super(view);
-
-        mWidgetsListHeader = view;
-    }
-}