Separate 2-button mode check from ENABLE_OVERVIEW_ACTIONS

This will allow us to cleanly remove ENABLE_OVERVIEW_ACTIONS while still
keeping the shelf instead of actions in 2-button mode.

Bug: 143361609
Change-Id: I5cd43b6d3daeb527c7787b1cb81fae9179d8911c
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 43540ce..d250658 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1138,7 +1138,7 @@
     /**
      * Finds all the views we need and configure them properly.
      */
-    private void setupViews() {
+    protected void setupViews() {
         mDragLayer = findViewById(R.id.drag_layer);
         mFocusHandler = mDragLayer.getFocusIndicatorHelper();
         mWorkspace = mDragLayer.findViewById(R.id.workspace);
@@ -1174,11 +1174,6 @@
         mDropTargetBar.setup(mDragController);
 
         mAllAppsController.setupViews(mAppsView);
-
-        if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
-            // Overview is above all other launcher elements, including qsb, so move it to the top.
-            mOverviewPanel.bringToFront();
-        }
     }
 
     /**
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 7e06099..16be391 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -41,8 +41,10 @@
 import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL;
 import static com.android.launcher3.testing.TestProtocol.SPRING_LOADED_STATE_ORDINAL;
 
+import android.view.View;
 import android.view.animation.Interpolator;
 
+import com.android.launcher3.allapps.AllAppsContainerView;
 import com.android.launcher3.anim.AnimatorSetBuilder;
 import com.android.launcher3.states.HintState;
 import com.android.launcher3.states.SpringLoadedState;
@@ -337,8 +339,13 @@
                 hotseat.setScaleX(0.92f);
                 hotseat.setScaleY(0.92f);
                 if (ENABLE_OVERVIEW_ACTIONS.get()) {
-                    launcher.getAppsView().setScaleX(0.92f);
-                    launcher.getAppsView().setScaleY(0.92f);
+                    AllAppsContainerView qsbContainer = launcher.getAppsView();
+                    View qsb = qsbContainer.getSearchView();
+                    boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0;
+                    if (!qsbVisible) {
+                        qsbContainer.setScaleX(0.92f);
+                        qsbContainer.setScaleY(0.92f);
+                    }
                 }
             }
         } else if (this == NORMAL && fromState == OVERVIEW_PEEK) {