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

Commit 6a6970b1 authored by Miranda Kephart's avatar Miranda Kephart Committed by Android (Google) Code Review
Browse files

Merge "Fix screenshot back behavior in 3-button mode" into main

parents 505ee0bf f47269c5
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -357,7 +357,11 @@ constructor(
                        if (
                            ev is MotionEvent &&
                                ev.actionMasked == MotionEvent.ACTION_DOWN &&
                                !getTouchRegion().contains(ev.rawX.toInt(), ev.rawY.toInt())
                                !view
                                    .getObservedRegion(
                                        windowManager.currentWindowMetrics.windowInsets
                                    )
                                    .contains(ev.rawX.toInt(), ev.rawY.toInt())
                        ) {
                            callbacks?.onTouchOutside()
                        }
@@ -366,11 +370,7 @@ constructor(
    }

    private fun getTouchRegion(): Region {
        return view.getTouchRegion(
            windowManager.currentWindowMetrics.windowInsets.getInsets(
                WindowInsets.Type.systemGestures()
            )
        )
        return view.getTouchRegion(windowManager.currentWindowMetrics.windowInsets)
    }

    companion object {
+16 −2
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.screenshot.ui

import android.content.Context
import android.content.res.Configuration
import android.graphics.Insets
import android.graphics.Rect
import android.graphics.Region
import android.util.AttributeSet
@@ -119,7 +118,21 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
        })
    }

    fun getTouchRegion(gestureInsets: Insets): Region {
    fun getObservedRegion(insets: WindowInsets): Region {
        val region = getTouchRegion(insets)
        if (
            resources.getInteger(com.android.internal.R.integer.config_navBarInteractionMode) !=
                NAV_BAR_MODE_GESTURAL
        ) {
            region.op(
                insets.getBoundingRects(WindowInsets.Type.navigationBars())[0],
                Region.Op.UNION,
            )
        }
        return region
    }

    fun getTouchRegion(insets: WindowInsets): Region {
        val region = getSwipeRegion()

        // only add gesture insets to touch region in gestural mode
@@ -127,6 +140,7 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
            resources.getInteger(com.android.internal.R.integer.config_navBarInteractionMode) ==
                NAV_BAR_MODE_GESTURAL
        ) {
            val gestureInsets = insets.getInsets(WindowInsets.Type.systemGestures())
            // Receive touches in gesture insets so they don't cause TOUCH_OUTSIDE
            // left edge gesture region
            val insetRect = Rect(0, 0, gestureInsets.left, displayMetrics.heightPixels)