summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2023-11-16 21:42:34 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2023-12-07 17:49:01 +0000
commit7d1daa11687346dcad34c27dabf32fee9534f376 (patch)
tree36d7999d197f27818098caf565d5811295d0cffa
parentfe7861cad5670b638ad0cc4838bf047e689b9345 (diff)
Remove Pointer Tracking in WM: Disable TaskTapPointerEventListener
As part of the effort to remove input code from WM, add a flag to disable TaskTapPointerEventListener in WM. Its responsibilities are already handled by other means: - Taps outside focused tasks are reported to WM directly by InputDispatcher using onPointerDownOutsideFocus(). - Freeform window resizing is handled by WM Shell in DragResizeInputListener. Since its behavior is obsolete, remove it safely with a flag. Bug: 315321016 Test: manual Change-Id: Iaf9c9c2a4eade8b645cce1fa38734f15d3487593
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java27
-rw-r--r--services/core/java/com/android/server/wm/TaskTapPointerEventListener.java4
2 files changed, 26 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index ecf3e8504834..0612375dbd31 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -545,10 +545,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
boolean isDefaultDisplay;
/** Detect user tapping outside of current focused task bounds .*/
+ // TODO(b/315321016): Remove once pointer event detection is removed from WM.
@VisibleForTesting
final TaskTapPointerEventListener mTapDetector;
/** Detect user tapping outside of current focused root task bounds .*/
+ // TODO(b/315321016): Remove once pointer event detection is removed from WM.
private Region mTouchExcludeRegion = new Region();
/** Save allocating when calculating rects */
@@ -1189,11 +1191,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
"PointerEventDispatcher" + mDisplayId, mDisplayId);
mPointerEventDispatcher = new PointerEventDispatcher(inputChannel);
- // Tap Listeners are supported for:
- // 1. All physical displays (multi-display).
- // 2. VirtualDisplays on VR, AA (and everything else).
- mTapDetector = new TaskTapPointerEventListener(mWmService, this);
- registerPointerEventListener(mTapDetector);
+ if (com.android.input.flags.Flags.removePointerEventTrackingInWm()) {
+ mTapDetector = null;
+ } else {
+ // Tap Listeners are supported for:
+ // 1. All physical displays (multi-display).
+ // 2. VirtualDisplays on VR, AA (and everything else).
+ mTapDetector = new TaskTapPointerEventListener(mWmService, this);
+ registerPointerEventListener(mTapDetector);
+ }
if (mWmService.mMousePositionTracker != null) {
registerPointerEventListener(mWmService.mMousePositionTracker);
}
@@ -3262,6 +3268,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
}
void updateTouchExcludeRegion() {
+ if (mTapDetector == null) {
+ // The touch exclude region is used to detect the region outside of the focused task
+ // so that the tap detector can detect outside touches. Don't calculate the exclude
+ // region when the tap detector is disabled.
+ return;
+ }
final Task focusedTask = (mFocusedApp != null ? mFocusedApp.getTask() : null);
if (focusedTask == null) {
mTouchExcludeRegion.setEmpty();
@@ -3300,6 +3312,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
}
private void processTaskForTouchExcludeRegion(Task task, Task focusedTask, int delta) {
+ if (mTapDetector == null) {
+ // The touch exclude region is used to detect the region outside of the focused task
+ // so that the tap detector can detect outside touches. Don't calculate the exclude
+ // region when the tap detector is disabled.
+ }
final ActivityRecord topVisibleActivity = task.getTopVisibleActivity();
if (topVisibleActivity == null || !topVisibleActivity.hasContentToDisplay()) {
diff --git a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java
index 7d22b744ad5f..ac244c7b048e 100644
--- a/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java
+++ b/services/core/java/com/android/server/wm/TaskTapPointerEventListener.java
@@ -45,6 +45,10 @@ public class TaskTapPointerEventListener implements PointerEventListener {
public TaskTapPointerEventListener(WindowManagerService service,
DisplayContent displayContent) {
+ // TODO(b/315321016): Remove this class when the flag rollout is complete.
+ if (com.android.input.flags.Flags.removePointerEventTrackingInWm()) {
+ throw new IllegalStateException("TaskTapPointerEventListener should not be used!");
+ }
mService = service;
mDisplayContent = displayContent;
}