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

Commit 04e09998 authored by Ben Lin's avatar Ben Lin
Browse files

Increase menu paddings to draw shadows correctly.

Adding the menu to a System-level container could potentially crop it if
the container is exactly the size of the menu. This increases the
container's width and height by a bit so that the menu can draw its
shadow correctly.

Bug: 399926630
Test: Manual. See shadows correctly now on Handle Menu.
Flag: EXEMPT bugfix

Change-Id: I6c454db2e97dc438ddbeab9d9a3010f0c6d895a1
parent 21aa4fbc
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -22,13 +22,15 @@
    android:layout_height="wrap_content"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:paddingLeft="@dimen/desktop_mode_handle_menu_padding_left_bottom_right"
    android:paddingRight="@dimen/desktop_mode_handle_menu_padding_left_bottom_right"
    android:paddingBottom="@dimen/desktop_mode_handle_menu_pill_elevation_padding"
    android:paddingEnd="@dimen/desktop_mode_handle_menu_pill_elevation_padding"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/app_info_pill"
        android:layout_width="match_parent"
        android:layout_width="@dimen/desktop_mode_handle_menu_width"
        android:layout_height="@dimen/desktop_mode_handle_menu_app_info_pill_height"
        android:layout_marginTop="@dimen/desktop_mode_handle_menu_margin_top"
        android:layout_marginStart="1dp"
@@ -62,7 +64,7 @@

    <LinearLayout
        android:id="@+id/windowing_pill"
        android:layout_width="match_parent"
        android:layout_width="@dimen/desktop_mode_handle_menu_width"
        android:layout_height="@dimen/desktop_mode_handle_menu_windowing_pill_height"
        android:layout_marginTop="@dimen/desktop_mode_handle_menu_pill_spacing_margin"
        android:layout_marginStart="1dp"
@@ -133,7 +135,7 @@

    <LinearLayout
        android:id="@+id/more_actions_pill"
        android:layout_width="match_parent"
        android:layout_width="@dimen/desktop_mode_handle_menu_width"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/desktop_mode_handle_menu_pill_spacing_margin"
        android:layout_marginStart="1dp"
@@ -171,7 +173,7 @@

        <LinearLayout
            android:id="@+id/handle_menu_restart_pill"
            android:layout_width="match_parent"
            android:layout_width="@dimen/desktop_mode_handle_menu_width"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

@@ -201,7 +203,7 @@

    <LinearLayout
        android:id="@+id/open_in_app_or_browser_pill"
        android:layout_width="match_parent"
        android:layout_width="@dimen/desktop_mode_handle_menu_width"
        android:layout_height="@dimen/desktop_mode_handle_menu_open_in_browser_pill_height"
        android:layout_marginTop="@dimen/desktop_mode_handle_menu_pill_spacing_margin"
        android:layout_marginStart="1dp"
+2 −2
Original line number Diff line number Diff line
@@ -579,8 +579,8 @@
    <!-- The top margin of the handle menu in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_margin_top">4dp</dimen>

    <!-- The start margin of the handle menu in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_margin_start">6dp</dimen>
    <!-- The left, bottom, and right padding of the handle menu in desktop mode. -->
    <dimen name="desktop_mode_handle_menu_padding_left_bottom_right">6dp</dimen>

    <!-- The radius of the caption menu corners. -->
    <dimen name="desktop_mode_handle_menu_corner_radius">26dp</dimen>
+0 −1
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ class DesktopHandleManageWindowsMenu(
        return calculateMenuPosition(
            splitScreenController,
            callerTaskInfo,
            marginStart = 0,
            marginTop =
                context.resources.getDimensionPixelSize(
                    R.dimen.desktop_mode_handle_menu_margin_top
+10 −11
Original line number Diff line number Diff line
@@ -132,8 +132,8 @@ private constructor(
    private val menuWidth = loadDimensionPixelSize(R.dimen.desktop_mode_handle_menu_width)
    private val menuHeight = getHandleMenuHeight()
    private val marginMenuTop = loadDimensionPixelSize(R.dimen.desktop_mode_handle_menu_margin_top)
    private val marginMenuStart =
        loadDimensionPixelSize(R.dimen.desktop_mode_handle_menu_margin_start)
    private val marginMenuPadding =
        loadDimensionPixelSize(R.dimen.desktop_mode_handle_menu_padding_left_bottom_right)

    @VisibleForTesting var handleMenuViewContainer: AdditionalViewContainer? = null

@@ -253,8 +253,8 @@ private constructor(
                    taskId = taskInfo.taskId,
                    x = x,
                    y = y,
                    width = menuWidth,
                    height = menuHeight,
                    width = menuWidth + 2 * marginMenuPadding,
                    height = menuHeight + marginMenuPadding,
                    flags = lpFlags,
                    view = handleMenuView.rootView,
                    forciblyShownTypes =
@@ -273,8 +273,8 @@ private constructor(
                    t,
                    x,
                    y,
                    menuWidth,
                    menuHeight,
                    menuWidth + 2 * marginMenuPadding,
                    menuHeight + marginMenuPadding,
                    lpFlags,
                )
            } else {
@@ -286,8 +286,8 @@ private constructor(
                    ssg,
                    x,
                    y,
                    menuWidth,
                    menuHeight,
                    menuWidth + 2 * marginMenuPadding,
                    menuHeight + marginMenuPadding,
                )
            }

@@ -353,7 +353,6 @@ private constructor(
            calculateMenuPosition(
                splitScreenController,
                taskInfo,
                marginStart = marginMenuStart,
                marginMenuTop,
                captionX,
                captionY,
@@ -366,9 +365,9 @@ private constructor(
            // Align the handle menu to the start of the header.
            menuX =
                if (context.isRtl()) {
                    taskBounds.width() - menuWidth - marginMenuStart
                    taskBounds.width() - menuWidth
                } else {
                    marginMenuStart
                    0
                }
            menuY = captionY + marginMenuTop
        } else {
+2 −6
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import com.android.wm.shell.windowdecor.extension.isFullscreen
fun calculateMenuPosition(
    splitScreenController: SplitScreenController,
    taskInfo: RunningTaskInfo,
    marginStart: Int,
    marginTop: Int,
    captionX: Int,
    captionY: Int,
@@ -38,12 +37,9 @@ fun calculateMenuPosition(
    if (taskInfo.isFreeform) {
        val taskBounds = taskInfo.configuration.windowConfiguration.bounds
        return if (isRtl) {
            Point(
                /* x= */ taskBounds.right - menuWidth - marginStart,
                /* y= */ taskBounds.top + marginTop,
            )
            Point(/* x= */ taskBounds.right - menuWidth, /* y= */ taskBounds.top + marginTop)
        } else {
            Point(/* x= */ taskBounds.left + marginStart, /* y= */ taskBounds.top + marginTop)
            Point(/* x= */ taskBounds.left, /* y= */ taskBounds.top + marginTop)
        }
    }
    val nonFreeformPosition = Point(captionX + (captionWidth / 2) - (menuWidth / 2), captionY)
Loading