diff options
| author | 2024-10-29 18:14:00 +0000 | |
|---|---|---|
| committer | 2024-10-29 18:14:00 +0000 | |
| commit | 7ebf9ab1b0fcae09af761b6f86b430018079bf35 (patch) | |
| tree | f8549e9126773b04ed0c573d3b6f284f0d26d2d3 | |
| parent | 17b1888d826868e2e8a9ac8d1bcb40cc7aced9f2 (diff) | |
| parent | 3a6526ae2f6e9910b3134c2b5b845d2b3c22a480 (diff) | |
Merge "Only add gesture insets to screenshot touch region in gesture mode" into main
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt b/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt index 969cf482be90..b8ea8f9052ca 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt @@ -28,6 +28,7 @@ import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.view.WindowInsets +import android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL import android.widget.FrameLayout import android.widget.ImageView import com.android.systemui.res.R @@ -59,17 +60,17 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) : ev1: MotionEvent?, ev2: MotionEvent, distanceX: Float, - distanceY: Float + distanceY: Float, ): Boolean { actionsContainer.getBoundsOnScreen(tmpRect) val touchedInActionsContainer = tmpRect.contains(ev2.rawX.toInt(), ev2.rawY.toInt()) val canHandleInternallyByScrolling = - touchedInActionsContainer - && actionsContainer.canScrollHorizontally(distanceX.toInt()) + touchedInActionsContainer && + actionsContainer.canScrollHorizontally(distanceX.toInt()) return !canHandleInternallyByScrolling } - } + }, ) init { @@ -106,18 +107,24 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) : fun getTouchRegion(gestureInsets: Insets): Region { val region = getSwipeRegion() - // 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) - region.op(insetRect, Region.Op.UNION) - // right edge gesture region - insetRect.set( - displayMetrics.widthPixels - gestureInsets.right, - 0, - displayMetrics.widthPixels, - displayMetrics.heightPixels - ) - region.op(insetRect, Region.Op.UNION) + // only add gesture insets to touch region in gestural mode + if ( + resources.getInteger(com.android.internal.R.integer.config_navBarInteractionMode) == + NAV_BAR_MODE_GESTURAL + ) { + // 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) + region.op(insetRect, Region.Op.UNION) + // right edge gesture region + insetRect.set( + displayMetrics.widthPixels - gestureInsets.right, + 0, + displayMetrics.widthPixels, + displayMetrics.heightPixels, + ) + region.op(insetRect, Region.Op.UNION) + } return region } @@ -153,7 +160,7 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) : cutout.safeInsetBottom + verticalPadding, waterfall.bottom + verticalPadding, minimumBottomPadding, - ) + ), ) } else { screenshotStatic.setPadding( @@ -164,7 +171,7 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) : navBarInsets.bottom + verticalPadding, waterfall.bottom + verticalPadding, minimumBottomPadding, - ) + ), ) } } |