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

Commit 0cdefc74 authored by Ben Lin's avatar Ben Lin
Browse files

Rotate splitscreen drawable by 90 when splitscreen is vertical.

If splitscreen will be vertical on the device/display, rotate the icon
so that it seems that way.

Bug: 407647118
Test: Manual. Rotate tablet screen vertically and see the icon updates.
Flag: EXEMPT bugfix
Change-Id: Id5dfc06f16cc6b22eba05fc468d92395a134b78a
parent 5582f3c0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -482,6 +482,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        if (isHandleMenuActive()) {
            mHandleMenu.relayout(
                    startT,
                    taskInfo.configuration,
                    mResult.mCaptionX,
                    // Add top padding to the caption Y so that the menu is shown over what is the
                    // actual contents of the caption, ignoring padding. This is currently relevant
+25 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.app.WindowConfiguration
import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.content.res.Configuration
import android.content.res.Resources
import android.graphics.Bitmap
import android.graphics.PixelFormat
@@ -57,6 +58,7 @@ import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.Accessibilit
import androidx.core.view.isGone
import com.android.window.flags.Flags
import com.android.wm.shell.R
import com.android.wm.shell.common.split.SplitScreenUtils
import com.android.wm.shell.desktopmode.DesktopModeUiEventLogger
import com.android.wm.shell.desktopmode.DesktopModeUiEventLogger.DesktopUiEventEnum.A11Y_APP_HANDLE_MENU_DESKTOP_VIEW
import com.android.wm.shell.desktopmode.DesktopModeUiEventLogger.DesktopUiEventEnum.A11Y_APP_HANDLE_MENU_FULLSCREEN
@@ -386,10 +388,16 @@ private constructor(
    }

    /** Update pill layout, in case task changes have caused positioning to change. */
    fun relayout(t: SurfaceControl.Transaction, captionX: Int, captionY: Int) {
    fun relayout(
        t: SurfaceControl.Transaction,
        configuration: Configuration,
        captionX: Int,
        captionY: Int,
    ) {
        handleMenuViewContainer?.let { container ->
            updateHandleMenuPillPositions(captionX, captionY)
            container.setPosition(t, handleMenuPosition.x, handleMenuPosition.y)
            handleMenuView?.updateSplitScreenButtonOrientation(configuration)
        }
    }

@@ -944,6 +952,7 @@ private constructor(
                        drawableInsets = iconButtonDrawableInsetsBase,
                    )
            }
            updateSplitScreenButtonOrientation(taskInfo.configuration)

            floatingBtn.apply {
                background =
@@ -964,6 +973,21 @@ private constructor(
            }
        }

        /** Update the split screen button (horizontal vs. vertical split) orientation. */
        fun updateSplitScreenButtonOrientation(configuration: Configuration) {
            splitscreenBtn.rotation =
                if (
                    SplitScreenUtils.isLeftRightSplit(
                        SplitScreenUtils.allowLeftRightSplitInPortrait(context.resources),
                        configuration,
                    )
                ) {
                    0f
                } else {
                    90f
                }
        }

        private fun bindMoreActionsPill(style: MenuStyle) {
            moreActionsPill.background.setTint(style.backgroundColor)
            val buttons =
+6 −1
Original line number Diff line number Diff line
@@ -186,7 +186,12 @@ class AppHandleController(
                    wct,
                )

            handleMenu?.relayout(startT, captionLayout.captionX, captionLayout.captionY)
            handleMenu?.relayout(
                startT,
                taskInfo.configuration,
                captionLayout.captionX,
                captionLayout.captionY,
            )
            openByDefaultDialog?.relayout(taskInfo)

            updateViewHolder(captionLayout)
+1 −0
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ class AppHeaderController(
                )
            handleMenu?.relayout(
                startT,
                taskInfo.configuration,
                captionLayout.captionX,
                // Add top padding to the caption Y so that the menu is shown over what is the
                // actual contents of the caption, ignoring padding. This is currently relevant