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

Commit edc51ab0 authored by Marzia Favaro's avatar Marzia Favaro
Browse files

App menu and handle input ignore cutouts

Align the app handle input layer and menu to the app handle ui, since
they were misaligned on some devices. The misaligment of the input layer
cause the app handle to not be interactable

Bug: 377689543
Fix: 376077824
Test: manual, verify interactablity and position of handle and menu
Flag: com.android.window.flags.show_app_handle_large_screens
Change-Id: Ia96b72e419d9bc0988480f7d643ab806134d5f27
parent 1384dd6b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.Rect
import android.view.WindowManager
import android.window.TaskSnapshot
import androidx.compose.ui.graphics.toArgb
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus
import com.android.wm.shell.shared.desktopmode.ManageWindowsViewContainer
import com.android.wm.shell.shared.split.SplitScreenConstants
import com.android.wm.shell.splitscreen.SplitScreenController
@@ -101,6 +102,7 @@ class DesktopHandleManageWindowsMenu(
            flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
                    WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
            view = menuView.rootView,
            ignoreCutouts = DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(context),
        )
    }

+3 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import androidx.annotation.StringRes
import androidx.annotation.VisibleForTesting
import androidx.compose.ui.graphics.toArgb
import androidx.core.view.isGone
import com.android.window.flags.Flags
import com.android.wm.shell.R
import com.android.wm.shell.apptoweb.isBrowserApp
import com.android.wm.shell.shared.split.SplitScreenConstants
@@ -218,7 +219,8 @@ class HandleMenu(
                            WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH or
                            WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
                    view = handleMenuView.rootView,
                    forciblyShownTypes = if (forceShowSystemBars) { systemBars() } else { 0 }
                    forciblyShownTypes = if (forceShowSystemBars) { systemBars() } else { 0 },
                    ignoreCutouts = Flags.showAppHandleLargeScreens()
                )
            } else {
                parentDecor.addWindow(
+14 −4
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.view.SurfaceControl
import android.view.View
import android.view.WindowInsets
import android.view.WindowManager
import android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
import com.android.wm.shell.windowdecor.WindowManagerWrapper

/**
@@ -40,6 +41,7 @@ class AdditionalSystemViewContainer(
    height: Int,
    flags: Int,
    @WindowInsets.Type.InsetsType forciblyShownTypes: Int = 0,
    ignoreCutouts: Boolean = false,
    override val view: View
) : AdditionalViewContainer() {
    val lp: WindowManager.LayoutParams = WindowManager.LayoutParams(
@@ -52,6 +54,10 @@ class AdditionalSystemViewContainer(
        gravity = Gravity.LEFT or Gravity.TOP
        setTrustedOverlay()
        this.forciblyShownTypes = forciblyShownTypes
        if (ignoreCutouts) {
            fitInsetsTypes = 0
            layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
        }
    }

    constructor(
@@ -63,7 +69,8 @@ class AdditionalSystemViewContainer(
        width: Int,
        height: Int,
        flags: Int,
        @LayoutRes layoutId: Int
        @LayoutRes layoutId: Int,
        ignoreCutouts: Boolean = false
    ) : this(
        windowManagerWrapper = windowManagerWrapper,
        taskId = taskId,
@@ -72,7 +79,8 @@ class AdditionalSystemViewContainer(
        width = width,
        height = height,
        flags = flags,
        view = LayoutInflater.from(context).inflate(layoutId, null /* parent */)
        view = LayoutInflater.from(context).inflate(layoutId, null /* parent */),
        ignoreCutouts = ignoreCutouts
    )

    constructor(
@@ -83,7 +91,8 @@ class AdditionalSystemViewContainer(
        y: Int,
        width: Int,
        height: Int,
        flags: Int
        flags: Int,
        ignoreCutouts: Boolean = false
    ) : this(
        windowManagerWrapper = windowManagerWrapper,
        taskId = taskId,
@@ -92,7 +101,8 @@ class AdditionalSystemViewContainer(
        width = width,
        height = height,
        flags = flags,
        view = View(context)
        view = View(context),
        ignoreCutouts = ignoreCutouts
    )

    init {
+3 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.window.DesktopModeFlags
import androidx.core.view.ViewCompat
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat
import com.android.internal.policy.SystemBarUtils
import com.android.window.flags.Flags
import com.android.wm.shell.R
import com.android.wm.shell.shared.animation.Interpolators
import com.android.wm.shell.windowdecor.WindowManagerWrapper
@@ -143,7 +144,8 @@ internal class AppHandleViewHolder(
        if (!DesktopModeFlags.ENABLE_HANDLE_INPUT_FIX.isTrue()) return
        statusBarInputLayer = AdditionalSystemViewContainer(context, windowManagerWrapper,
            taskInfo.taskId, handlePosition.x, handlePosition.y, handleWidth, handleHeight,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
            ignoreCutouts = Flags.showAppHandleLargeScreens()
        )
        val view = statusBarInputLayer?.view ?: error("Unable to find statusBarInputLayer View")
        val lp = statusBarInputLayer?.lp ?: error("Unable to find statusBarInputLayer " +