Temporarily use 1f bottomSheetDepth for multi-display

Bug: 259893832
Test: Manual and DeviceProfileDumpTest
Change-Id: I196958e6f9f889de003b4d3a22a176bfd7e49511
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index eb016b2..bfde8da 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -23,6 +23,7 @@
 import static com.android.launcher3.Utilities.dpiFromPx;
 import static com.android.launcher3.Utilities.pxFromSp;
 import static com.android.launcher3.anim.Interpolators.LINEAR;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH;
 import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.ICON_OVERLAP_FACTOR;
 import static com.android.launcher3.icons.GraphicsUtils.getShapePath;
 import static com.android.launcher3.testing.shared.ResourceUtils.INVALID_RESOURCE_HANDLE;
@@ -78,6 +79,7 @@
     public final boolean isTablet;
     public final boolean isPhone;
     public final boolean transposeLayoutWithOrientation;
+    public final boolean isMultiDisplay;
     public final boolean isTwoPanels;
     public final boolean isQsbInline;
 
@@ -263,13 +265,14 @@
     /** TODO: Once we fully migrate to staged split, remove "isMultiWindowMode" */
     DeviceProfile(Context context, InvariantDeviceProfile inv, Info info, WindowBounds windowBounds,
             SparseArray<DotRenderer> dotRendererCache, boolean isMultiWindowMode,
-            boolean transposeLayoutWithOrientation, boolean useTwoPanels, boolean isGestureMode,
+            boolean transposeLayoutWithOrientation, boolean isMultiDisplay, boolean isGestureMode,
             @NonNull final ViewScaleProvider viewScaleProvider) {
 
         this.inv = inv;
         this.isLandscape = windowBounds.isLandscape();
         this.isMultiWindowMode = isMultiWindowMode;
         this.transposeLayoutWithOrientation = transposeLayoutWithOrientation;
+        this.isMultiDisplay = isMultiDisplay;
         this.isGestureMode = isGestureMode;
         windowX = windowBounds.bounds.left;
         windowY = windowBounds.bounds.top;
@@ -281,7 +284,7 @@
         mInfo = info;
         isTablet = info.isTablet(windowBounds);
         isPhone = !isTablet;
-        isTwoPanels = isTablet && useTwoPanels;
+        isTwoPanels = isTablet && isMultiDisplay;
         isTaskbarPresent = isTablet && ApiWrapper.TASKBAR_DRAWN_IN_PROCESS;
 
         // Some more constants.
@@ -348,13 +351,19 @@
         bottomSheetCloseDuration = res.getInteger(R.integer.config_bottomSheetCloseDuration);
         if (isTablet) {
             bottomSheetWorkspaceScale = workspaceContentScale;
-            // The goal is to set wallpaper to zoom at workspaceContentScale when in AllApps.
-            // When depth is 0, wallpaper zoom is set to maxWallpaperScale.
-            // When depth is 1, wallpaper zoom is set to 1.
-            // For depth to achieve zoom set to maxWallpaperScale * workspaceContentScale:
-            float maxWallpaperScale = res.getFloat(R.dimen.config_wallpaperMaxScale);
-            bottomSheetDepth = Utilities.mapToRange(maxWallpaperScale * workspaceContentScale,
-                    maxWallpaperScale, 1f, 0f, 1f, LINEAR);
+            if (isMultiDisplay && !ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH.get()) {
+                // TODO(b/259893832): Revert to use maxWallpaperScale to calculate bottomSheetDepth
+                // when screen recorder bug is fixed.
+                bottomSheetDepth = 1f;
+            } else {
+                // The goal is to set wallpaper to zoom at workspaceContentScale when in AllApps.
+                // When depth is 0, wallpaper zoom is set to maxWallpaperScale.
+                // When depth is 1, wallpaper zoom is set to 1.
+                // For depth to achieve zoom set to maxWallpaperScale * workspaceContentScale:
+                float maxWallpaperScale = res.getFloat(R.dimen.config_wallpaperMaxScale);
+                bottomSheetDepth = Utilities.mapToRange(maxWallpaperScale * workspaceContentScale,
+                        maxWallpaperScale, 1f, 0f, 1f, LINEAR);
+            }
         } else {
             bottomSheetWorkspaceScale = 1f;
             bottomSheetDepth = 0f;
@@ -723,7 +732,7 @@
 
         return new Builder(context, inv, mInfo)
                 .setWindowBounds(bounds)
-                .setUseTwoPanels(isTwoPanels)
+                .setIsMultiDisplay(isMultiDisplay)
                 .setMultiWindowMode(isMultiWindowMode)
                 .setDotRendererCache(dotRendererCache)
                 .setGestureMode(isGestureMode);
@@ -1714,7 +1723,7 @@
         private Info mInfo;
 
         private WindowBounds mWindowBounds;
-        private boolean mUseTwoPanels;
+        private boolean mIsMultiDisplay;
 
         private boolean mIsMultiWindowMode = false;
         private Boolean mTransposeLayoutWithOrientation;
@@ -1734,8 +1743,8 @@
             return this;
         }
 
-        public Builder setUseTwoPanels(boolean useTwoPanels) {
-            mUseTwoPanels = useTwoPanels;
+        public Builder setIsMultiDisplay(boolean isMultiDisplay) {
+            mIsMultiDisplay = isMultiDisplay;
             return this;
         }
 
@@ -1789,7 +1798,7 @@
                 mViewScaleProvider = DEFAULT_PROVIDER;
             }
             return new DeviceProfile(mContext, mInv, mInfo, mWindowBounds, mDotRendererCache,
-                    mIsMultiWindowMode, mTransposeLayoutWithOrientation, mUseTwoPanels,
+                    mIsMultiWindowMode, mTransposeLayoutWithOrientation, mIsMultiDisplay,
                     mIsGestureMode, mViewScaleProvider);
         }
     }
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 594d7cb..806e7b1 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -400,7 +400,7 @@
         SparseArray<DotRenderer> dotRendererCache = new SparseArray<>();
         for (WindowBounds bounds : displayInfo.supportedBounds) {
             localSupportedProfiles.add(new DeviceProfile.Builder(context, this, displayInfo)
-                    .setUseTwoPanels(deviceType == TYPE_MULTI_DISPLAY)
+                    .setIsMultiDisplay(deviceType == TYPE_MULTI_DISPLAY)
                     .setWindowBounds(bounds)
                     .setDotRendererCache(dotRendererCache)
                     .build());
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index c56186a..0e546ed 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -303,6 +303,10 @@
     public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag(
             "ENABLE_WIDGET_PICKER_DEPTH", true, "Enable changing depth in widget picker.");
 
+    public static final BooleanFlag ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH = getDebugFlag(
+            "ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH", false,
+            "Allow bottom sheet depth to be smaller than 1 for multi-display devices.");
+
     public static final BooleanFlag SCROLL_TOP_TO_RESET = new DeviceFlag(
             "SCROLL_TOP_TO_RESET", true, "Bring up IME and focus on "
             + "input when scroll to top if 'Always show keyboard' is enabled or in prefix state");