Loading services/java/com/android/server/wm/StackTapDetector.java +43 −39 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.server.wm; package com.android.server.wm; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Region; import android.os.Looper; import android.os.Looper; import android.view.DisplayInfo; import android.view.DisplayInfo; Loading Loading @@ -52,6 +51,7 @@ public class StackTapDetector extends InputEventReceiver { @Override @Override public void onInputEvent(InputEvent event) { public void onInputEvent(InputEvent event) { try { if (!(event instanceof MotionEvent) if (!(event instanceof MotionEvent) || !event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { || !event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { return; return; Loading @@ -67,7 +67,8 @@ public class StackTapDetector extends InputEventReceiver { case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE: if (mPointerId >= 0) { if (mPointerId >= 0) { int index = motionEvent.findPointerIndex(mPointerId); int index = motionEvent.findPointerIndex(mPointerId); if ((motionEvent.getEventTime() - motionEvent.getDownTime()) > TAP_TIMEOUT_MSEC if ((motionEvent.getEventTime() - motionEvent.getDownTime()) > TAP_TIMEOUT_MSEC || (motionEvent.getX(index) - mDownX) > mMotionSlop || (motionEvent.getX(index) - mDownX) > mMotionSlop || (motionEvent.getY(index) - mDownY) > mMotionSlop) { || (motionEvent.getY(index) - mDownY) > mMotionSlop) { mPointerId = -1; mPointerId = -1; Loading @@ -87,8 +88,8 @@ public class StackTapDetector extends InputEventReceiver { < TAP_TIMEOUT_MSEC < TAP_TIMEOUT_MSEC && (x - mDownX) < mMotionSlop && (y - mDownY) < mMotionSlop && (x - mDownX) < mMotionSlop && (y - mDownY) < mMotionSlop && !mTouchExcludeRegion.contains(x, y)) { && !mTouchExcludeRegion.contains(x, y)) { mService.mH.obtainMessage(H.TAP_OUTSIDE_STACK, x, y, mDisplayContent) mService.mH.obtainMessage(H.TAP_OUTSIDE_STACK, x, y, .sendToTarget(); mDisplayContent).sendToTarget(); } } } } mPointerId = -1; mPointerId = -1; Loading @@ -96,5 +97,8 @@ public class StackTapDetector extends InputEventReceiver { break; break; } } } } } finally { finishInputEvent(event, false /*ignored for monitors*/); } } } } } Loading
services/java/com/android/server/wm/StackTapDetector.java +43 −39 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.server.wm; package com.android.server.wm; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Region; import android.os.Looper; import android.os.Looper; import android.view.DisplayInfo; import android.view.DisplayInfo; Loading Loading @@ -52,6 +51,7 @@ public class StackTapDetector extends InputEventReceiver { @Override @Override public void onInputEvent(InputEvent event) { public void onInputEvent(InputEvent event) { try { if (!(event instanceof MotionEvent) if (!(event instanceof MotionEvent) || !event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { || !event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { return; return; Loading @@ -67,7 +67,8 @@ public class StackTapDetector extends InputEventReceiver { case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE: if (mPointerId >= 0) { if (mPointerId >= 0) { int index = motionEvent.findPointerIndex(mPointerId); int index = motionEvent.findPointerIndex(mPointerId); if ((motionEvent.getEventTime() - motionEvent.getDownTime()) > TAP_TIMEOUT_MSEC if ((motionEvent.getEventTime() - motionEvent.getDownTime()) > TAP_TIMEOUT_MSEC || (motionEvent.getX(index) - mDownX) > mMotionSlop || (motionEvent.getX(index) - mDownX) > mMotionSlop || (motionEvent.getY(index) - mDownY) > mMotionSlop) { || (motionEvent.getY(index) - mDownY) > mMotionSlop) { mPointerId = -1; mPointerId = -1; Loading @@ -87,8 +88,8 @@ public class StackTapDetector extends InputEventReceiver { < TAP_TIMEOUT_MSEC < TAP_TIMEOUT_MSEC && (x - mDownX) < mMotionSlop && (y - mDownY) < mMotionSlop && (x - mDownX) < mMotionSlop && (y - mDownY) < mMotionSlop && !mTouchExcludeRegion.contains(x, y)) { && !mTouchExcludeRegion.contains(x, y)) { mService.mH.obtainMessage(H.TAP_OUTSIDE_STACK, x, y, mDisplayContent) mService.mH.obtainMessage(H.TAP_OUTSIDE_STACK, x, y, .sendToTarget(); mDisplayContent).sendToTarget(); } } } } mPointerId = -1; mPointerId = -1; Loading @@ -96,5 +97,8 @@ public class StackTapDetector extends InputEventReceiver { break; break; } } } } } finally { finishInputEvent(event, false /*ignored for monitors*/); } } } } }