diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index c9e3d4f109..43f7d2317a 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -32,6 +32,7 @@ import android.widget.FrameLayout; 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 @@ public class DeviceProfile { 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); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index ef00a8d60a..7562dd8b30 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -643,7 +643,8 @@ public class Workspace extends PagedView // of workspace despite that it's not a true child. // Note that it relies on the strict ordering of measuring the workspace before the QSB // at the dragLayer level. - if (getChildCount() > 0) { + // Only measure the QSB when the view is enabled + if (FeatureFlags.QSB_ON_FIRST_SCREEN && getChildCount() > 0) { CellLayout firstPage = (CellLayout) getChildAt(0); int cellHeight = firstPage.getCellHeight(); diff --git a/src/com/android/launcher3/qsb/QsbContainerView.java b/src/com/android/launcher3/qsb/QsbContainerView.java index 38a3e1f58c..4dc3c1c0da 100644 --- a/src/com/android/launcher3/qsb/QsbContainerView.java +++ b/src/com/android/launcher3/qsb/QsbContainerView.java @@ -40,6 +40,7 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.compat.AppWidgetManagerCompat; +import com.android.launcher3.config.FeatureFlags; /** * A frame layout which contains a QSB. This internally uses fragment to bind the view, which @@ -89,7 +90,11 @@ public class QsbContainerView extends FrameLayout { LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mWrapper = new FrameLayout(getActivity()); - mWrapper.addView(createQsb(mWrapper)); + + // Only add the view when enabled + if (FeatureFlags.QSB_ON_FIRST_SCREEN) { + mWrapper.addView(createQsb(mWrapper)); + } return mWrapper; } @@ -197,6 +202,11 @@ public class QsbContainerView extends FrameLayout { } private void rebindFragment() { + // Exit if the embedded qsb is disabled + if (!FeatureFlags.QSB_ON_FIRST_SCREEN) { + return; + } + if (mWrapper != null && getActivity() != null) { mWrapper.removeAllViews(); mWrapper.addView(createQsb(mWrapper));