diff options
| -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, - ) + ), ) } } |