summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matt Sziklay <mattsziklay@google.com> 2023-02-15 17:04:35 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-02-15 17:04:35 +0000
commit2b9c9c231a11a4e972d19bf4567a777fe0fedfc9 (patch)
treeaf313a7890368642aceeb5b119c965454e41bacf
parent3800ea7c67dd87ed1025aff89750a38d5b210d47 (diff)
parentb45e67c06ce8142af48939eed480a62990b0e471 (diff)
Merge "Update DesktopModeTouchEventListener to correctly identify click events." into tm-qpr-dev
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java33
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragDetector.java4
2 files changed, 23 insertions, 14 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
index 44e4a31c36f0..de5f2f467e99 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
@@ -250,25 +250,30 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
@Override
public boolean onTouch(View v, MotionEvent e) {
- boolean isDrag = false;
final int id = v.getId();
if (id != R.id.caption_handle && id != R.id.desktop_mode_caption) {
return false;
}
- if (id == R.id.caption_handle) {
- isDrag = mDragDetector.onMotionEvent(e);
- }
- if (e.getAction() != MotionEvent.ACTION_DOWN) {
- return isDrag;
- }
- final RunningTaskInfo taskInfo = mTaskOrganizer.getRunningTaskInfo(mTaskId);
- if (taskInfo.isFocused) {
- return isDrag;
+ switch (e.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mDragDetector.onMotionEvent(e);
+ final RunningTaskInfo taskInfo = mTaskOrganizer.getRunningTaskInfo(mTaskId);
+ if (taskInfo.isFocused) {
+ return mDragDetector.isDragEvent();
+ }
+ final WindowContainerTransaction wct = new WindowContainerTransaction();
+ wct.reorder(mTaskToken, true /* onTop */);
+ mSyncQueue.queue(wct);
+ return false;
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ boolean res = mDragDetector.isDragEvent();
+ mDragDetector.onMotionEvent(e);
+ return res;
+ default:
+ mDragDetector.onMotionEvent(e);
+ return mDragDetector.isDragEvent();
}
- final WindowContainerTransaction wct = new WindowContainerTransaction();
- wct.reorder(mTaskToken, true /* onTop */);
- mSyncQueue.queue(wct);
- return true;
}
/**
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragDetector.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragDetector.java
index 4fac843b05db..cf1850b92373 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragDetector.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragDetector.java
@@ -94,6 +94,10 @@ class DragDetector {
mTouchSlop = touchSlop;
}
+ boolean isDragEvent() {
+ return mIsDragEvent;
+ }
+
private void resetState() {
mIsDragEvent = false;
mInputDownPoint.set(0, 0);