Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab800f71 authored by Alex Chau's avatar Alex Chau
Browse files

Temporarily use 1f bottomSheetDepth for multi-display

Bug: 259893832
Test: Manual and DeviceProfileDumpTest
Change-Id: I196958e6f9f889de003b4d3a22a176bfd7e49511
parent 80872f32
Loading
Loading
Loading
Loading
+23 −14
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import static com.android.launcher3.InvariantDeviceProfile.INDEX_TWO_PANEL_PORTR
import static com.android.launcher3.Utilities.dpiFromPx;
import static com.android.launcher3.Utilities.dpiFromPx;
import static com.android.launcher3.Utilities.pxFromSp;
import static com.android.launcher3.Utilities.pxFromSp;
import static com.android.launcher3.anim.Interpolators.LINEAR;
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.folder.ClippedFolderIconLayoutRule.ICON_OVERLAP_FACTOR;
import static com.android.launcher3.icons.GraphicsUtils.getShapePath;
import static com.android.launcher3.icons.GraphicsUtils.getShapePath;
import static com.android.launcher3.testing.shared.ResourceUtils.INVALID_RESOURCE_HANDLE;
import static com.android.launcher3.testing.shared.ResourceUtils.INVALID_RESOURCE_HANDLE;
@@ -78,6 +79,7 @@ public class DeviceProfile {
    public final boolean isTablet;
    public final boolean isTablet;
    public final boolean isPhone;
    public final boolean isPhone;
    public final boolean transposeLayoutWithOrientation;
    public final boolean transposeLayoutWithOrientation;
    public final boolean isMultiDisplay;
    public final boolean isTwoPanels;
    public final boolean isTwoPanels;
    public final boolean isQsbInline;
    public final boolean isQsbInline;


@@ -263,13 +265,14 @@ public class DeviceProfile {
    /** TODO: Once we fully migrate to staged split, remove "isMultiWindowMode" */
    /** TODO: Once we fully migrate to staged split, remove "isMultiWindowMode" */
    DeviceProfile(Context context, InvariantDeviceProfile inv, Info info, WindowBounds windowBounds,
    DeviceProfile(Context context, InvariantDeviceProfile inv, Info info, WindowBounds windowBounds,
            SparseArray<DotRenderer> dotRendererCache, boolean isMultiWindowMode,
            SparseArray<DotRenderer> dotRendererCache, boolean isMultiWindowMode,
            boolean transposeLayoutWithOrientation, boolean useTwoPanels, boolean isGestureMode,
            boolean transposeLayoutWithOrientation, boolean isMultiDisplay, boolean isGestureMode,
            @NonNull final ViewScaleProvider viewScaleProvider) {
            @NonNull final ViewScaleProvider viewScaleProvider) {


        this.inv = inv;
        this.inv = inv;
        this.isLandscape = windowBounds.isLandscape();
        this.isLandscape = windowBounds.isLandscape();
        this.isMultiWindowMode = isMultiWindowMode;
        this.isMultiWindowMode = isMultiWindowMode;
        this.transposeLayoutWithOrientation = transposeLayoutWithOrientation;
        this.transposeLayoutWithOrientation = transposeLayoutWithOrientation;
        this.isMultiDisplay = isMultiDisplay;
        this.isGestureMode = isGestureMode;
        this.isGestureMode = isGestureMode;
        windowX = windowBounds.bounds.left;
        windowX = windowBounds.bounds.left;
        windowY = windowBounds.bounds.top;
        windowY = windowBounds.bounds.top;
@@ -281,7 +284,7 @@ public class DeviceProfile {
        mInfo = info;
        mInfo = info;
        isTablet = info.isTablet(windowBounds);
        isTablet = info.isTablet(windowBounds);
        isPhone = !isTablet;
        isPhone = !isTablet;
        isTwoPanels = isTablet && useTwoPanels;
        isTwoPanels = isTablet && isMultiDisplay;
        isTaskbarPresent = isTablet && ApiWrapper.TASKBAR_DRAWN_IN_PROCESS;
        isTaskbarPresent = isTablet && ApiWrapper.TASKBAR_DRAWN_IN_PROCESS;


        // Some more constants.
        // Some more constants.
@@ -348,6 +351,11 @@ public class DeviceProfile {
        bottomSheetCloseDuration = res.getInteger(R.integer.config_bottomSheetCloseDuration);
        bottomSheetCloseDuration = res.getInteger(R.integer.config_bottomSheetCloseDuration);
        if (isTablet) {
        if (isTablet) {
            bottomSheetWorkspaceScale = workspaceContentScale;
            bottomSheetWorkspaceScale = workspaceContentScale;
            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.
                // 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 0, wallpaper zoom is set to maxWallpaperScale.
                // When depth is 1, wallpaper zoom is set to 1.
                // When depth is 1, wallpaper zoom is set to 1.
@@ -355,6 +363,7 @@ public class DeviceProfile {
                float maxWallpaperScale = res.getFloat(R.dimen.config_wallpaperMaxScale);
                float maxWallpaperScale = res.getFloat(R.dimen.config_wallpaperMaxScale);
                bottomSheetDepth = Utilities.mapToRange(maxWallpaperScale * workspaceContentScale,
                bottomSheetDepth = Utilities.mapToRange(maxWallpaperScale * workspaceContentScale,
                        maxWallpaperScale, 1f, 0f, 1f, LINEAR);
                        maxWallpaperScale, 1f, 0f, 1f, LINEAR);
            }
        } else {
        } else {
            bottomSheetWorkspaceScale = 1f;
            bottomSheetWorkspaceScale = 1f;
            bottomSheetDepth = 0f;
            bottomSheetDepth = 0f;
@@ -723,7 +732,7 @@ public class DeviceProfile {


        return new Builder(context, inv, mInfo)
        return new Builder(context, inv, mInfo)
                .setWindowBounds(bounds)
                .setWindowBounds(bounds)
                .setUseTwoPanels(isTwoPanels)
                .setIsMultiDisplay(isMultiDisplay)
                .setMultiWindowMode(isMultiWindowMode)
                .setMultiWindowMode(isMultiWindowMode)
                .setDotRendererCache(dotRendererCache)
                .setDotRendererCache(dotRendererCache)
                .setGestureMode(isGestureMode);
                .setGestureMode(isGestureMode);
@@ -1714,7 +1723,7 @@ public class DeviceProfile {
        private Info mInfo;
        private Info mInfo;


        private WindowBounds mWindowBounds;
        private WindowBounds mWindowBounds;
        private boolean mUseTwoPanels;
        private boolean mIsMultiDisplay;


        private boolean mIsMultiWindowMode = false;
        private boolean mIsMultiWindowMode = false;
        private Boolean mTransposeLayoutWithOrientation;
        private Boolean mTransposeLayoutWithOrientation;
@@ -1734,8 +1743,8 @@ public class DeviceProfile {
            return this;
            return this;
        }
        }


        public Builder setUseTwoPanels(boolean useTwoPanels) {
        public Builder setIsMultiDisplay(boolean isMultiDisplay) {
            mUseTwoPanels = useTwoPanels;
            mIsMultiDisplay = isMultiDisplay;
            return this;
            return this;
        }
        }


@@ -1789,7 +1798,7 @@ public class DeviceProfile {
                mViewScaleProvider = DEFAULT_PROVIDER;
                mViewScaleProvider = DEFAULT_PROVIDER;
            }
            }
            return new DeviceProfile(mContext, mInv, mInfo, mWindowBounds, mDotRendererCache,
            return new DeviceProfile(mContext, mInv, mInfo, mWindowBounds, mDotRendererCache,
                    mIsMultiWindowMode, mTransposeLayoutWithOrientation, mUseTwoPanels,
                    mIsMultiWindowMode, mTransposeLayoutWithOrientation, mIsMultiDisplay,
                    mIsGestureMode, mViewScaleProvider);
                    mIsGestureMode, mViewScaleProvider);
        }
        }
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -400,7 +400,7 @@ public class InvariantDeviceProfile {
        SparseArray<DotRenderer> dotRendererCache = new SparseArray<>();
        SparseArray<DotRenderer> dotRendererCache = new SparseArray<>();
        for (WindowBounds bounds : displayInfo.supportedBounds) {
        for (WindowBounds bounds : displayInfo.supportedBounds) {
            localSupportedProfiles.add(new DeviceProfile.Builder(context, this, displayInfo)
            localSupportedProfiles.add(new DeviceProfile.Builder(context, this, displayInfo)
                    .setUseTwoPanels(deviceType == TYPE_MULTI_DISPLAY)
                    .setIsMultiDisplay(deviceType == TYPE_MULTI_DISPLAY)
                    .setWindowBounds(bounds)
                    .setWindowBounds(bounds)
                    .setDotRendererCache(dotRendererCache)
                    .setDotRendererCache(dotRendererCache)
                    .build());
                    .build());
+4 −0
Original line number Original line Diff line number Diff line
@@ -303,6 +303,10 @@ public final class FeatureFlags {
    public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag(
    public static final BooleanFlag ENABLE_WIDGET_PICKER_DEPTH = new DeviceFlag(
            "ENABLE_WIDGET_PICKER_DEPTH", true, "Enable changing depth in widget picker.");
            "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(
    public static final BooleanFlag SCROLL_TOP_TO_RESET = new DeviceFlag(
            "SCROLL_TOP_TO_RESET", true, "Bring up IME and focus on "
            "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");
            + "input when scroll to top if 'Always show keyboard' is enabled or in prefix state");