Add checks for FeatureFlags.QSB_ON_FIRST_SCREEN

When false, it correctly does not show the QSB but leaves
a default style search bar which cannot be removed.

Add checks to control default view visibility in device
profile layout & re-layout, QSB container and in
Workspace's onMeasure

Bug: 35967694

Change-Id: I3d0f89e1022d838eeb95762fd1fb3f7257956c41
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index c9e3d4f..43f7d23 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -32,6 +32,7 @@
 
 import com.android.launcher3.CellLayout.ContainerType;
 import com.android.launcher3.badge.BadgeRenderer;
+import com.android.launcher3.config.FeatureFlags;
 
 import java.util.ArrayList;
 
@@ -530,10 +531,13 @@
                 workspacePadding.bottom);
         workspace.setPageSpacing(getWorkspacePageSpacing());
 
-        View qsbContainer = launcher.getQsbContainer();
-        lp = (FrameLayout.LayoutParams) qsbContainer.getLayoutParams();
-        lp.topMargin = mInsets.top + workspacePadding.top;
-        qsbContainer.setLayoutParams(lp);
+        // Only display when enabled
+        if (FeatureFlags.QSB_ON_FIRST_SCREEN) {
+            View qsbContainer = launcher.getQsbContainer();
+            lp = (FrameLayout.LayoutParams) qsbContainer.getLayoutParams();
+            lp.topMargin = mInsets.top + workspacePadding.top;
+            qsbContainer.setLayoutParams(lp);
+        }
 
         // Layout the hotseat
         Hotseat hotseat = (Hotseat) launcher.findViewById(R.id.hotseat);