Handle SystemGestureRegion in TaskbarDragLayer
- Currently user can tap on taskbar icons when in persitent mode when a popup is visible on screen.
we are making it so that touch event is not performed at view level and get dismissed before at drag layer.
Test: Presubmit, Manual
Bug: 320229858
Flag: NONE
Change-Id: I9a76faa0e282317d808ba0f55b49741dc7b750a3
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java
index 491938d..f6478df 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java
@@ -147,6 +147,15 @@
}
@Override
+ protected boolean isEventWithinSystemGestureRegion(MotionEvent ev) {
+ final float x = ev.getX();
+ final float y = ev.getY();
+
+ return x >= mSystemGestureRegion.left && x < getWidth() - mSystemGestureRegion.right
+ && y >= mSystemGestureRegion.top;
+ }
+
+ @Override
protected boolean canFindActiveController() {
// Unlike super class, we want to be able to find controllers when touches occur in the
// gesture area. For example, this allows Folder to close itself when touching the Taskbar.
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index abc5ef8..5d2d3f4 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -104,7 +104,7 @@
protected final Rect mHitRect = new Rect();
@ViewDebug.ExportedProperty(category = "launcher")
- private final RectF mSystemGestureRegion = new RectF();
+ protected final RectF mSystemGestureRegion = new RectF();
private int mTouchDispatchState = 0;
protected final T mActivity;
@@ -164,7 +164,7 @@
return findActiveController(ev);
}
- private boolean isEventInLauncher(MotionEvent ev) {
+ protected boolean isEventWithinSystemGestureRegion(MotionEvent ev) {
final float x = ev.getX();
final float y = ev.getY();
@@ -175,7 +175,8 @@
private TouchController findControllerToHandleTouch(MotionEvent ev) {
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
if (topView != null
- && (isEventInLauncher(ev) || topView.canInterceptEventsInSystemGestureRegion())
+ && (isEventWithinSystemGestureRegion(ev)
+ || topView.canInterceptEventsInSystemGestureRegion())
&& topView.onControllerInterceptTouchEvent(ev)) {
return topView;
}
@@ -287,7 +288,7 @@
mTouchDispatchState |= TOUCH_DISPATCHING_FROM_VIEW
| TOUCH_DISPATCHING_TO_VIEW_IN_PROGRESS;
- if (isEventInLauncher(ev)) {
+ if (isEventWithinSystemGestureRegion(ev)) {
mTouchDispatchState &= ~TOUCH_DISPATCHING_FROM_VIEW_GESTURE_REGION;
} else {
mTouchDispatchState |= TOUCH_DISPATCHING_FROM_VIEW_GESTURE_REGION;