Commit f9211375 authored by Chris Ye's avatar Chris Ye Committed by Commit Bot

Resolve conflict with gesture navigation when dragging cursor handle view on...

Resolve conflict with gesture navigation when dragging cursor handle view on the edge of the screen.

Since Android 10(API 29) has supported system gesture navigation, if users try to swipe the cursor handle on the edge of screen, which will conflict with system navigation back. We should resolve this conflict via `View.setSystemGestureExclusionRects()` in `PopupTouchHandleDrawable.onSizeChanged()`

Actually, it should be consistent with the behavior of the `Editor.HandleView`
```
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    setSystemGestureExclusionRects(Collections.singletonList(new Rect(0, 0, w, h)));
}
```

Bug: 1149803
Change-Id: Icd7669bcccfa975fbb97c0e3758a3648add0e3c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2543647Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Changwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828515}
parent 3fcd2fa4
......@@ -199,6 +199,7 @@ Chris Nardi <hichris123@gmail.com>
Chris Szurgot <szurgotc@amazon.com>
Chris Tserng <tserng@amazon.com>
Chris Vasselli <clindsay@gmail.com>
Chris Ye <hawkoyates@gmail.com>
Christophe Dumez <ch.dumez@samsung.com>
Christopher Dale <chrelad@gmail.com>
Chunbo Hua <chunbo.hua@intel.com>
......
......@@ -9,6 +9,7 @@ import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.graphics.Rect;
import android.os.Build;
import android.os.SystemClock;
import android.view.Gravity;
......@@ -34,6 +35,7 @@ import org.chromium.ui.touch_selection.TouchHandleOrientation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
/**
* View that displays a selection or insertion handle for text editing.
......@@ -514,6 +516,17 @@ public class PopupTouchHandleDrawable extends View implements DisplayAndroidObse
if (needsMirror) c.restore();
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
// Resolve conflict with gesture navigation back when dragging this handle view on the
// edge of the screen.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
setSystemGestureExclusionRects(Collections.singletonList(new Rect(0, 0, w, h)));
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment