Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d982e6d9 authored by Craig Mautner's avatar Craig Mautner
Browse files

Finish InputEvents.

StackTapDetector was leaking InputEvents. Fixes bug 9180347.

Change-Id: Ib526768024b54021ca02e6183bae847e217bb68d
parent d0d3ca95
Loading
Loading
Loading
Loading
+43 −39
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm;

import android.graphics.Rect;
import android.graphics.Region;
import android.os.Looper;
import android.view.DisplayInfo;
@@ -52,6 +51,7 @@ public class StackTapDetector extends InputEventReceiver {

    @Override
    public void onInputEvent(InputEvent event) {
        try {
            if (!(event instanceof MotionEvent)
                    || !event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) {
                return;
@@ -67,7 +67,8 @@ public class StackTapDetector extends InputEventReceiver {
                case MotionEvent.ACTION_MOVE:
                    if (mPointerId >= 0) {
                        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.getY(index) - mDownY) > mMotionSlop) {
                            mPointerId = -1;
@@ -87,8 +88,8 @@ public class StackTapDetector extends InputEventReceiver {
                                    < TAP_TIMEOUT_MSEC
                                    && (x - mDownX) < mMotionSlop && (y - mDownY) < mMotionSlop
                                    && !mTouchExcludeRegion.contains(x, y)) {
                            mService.mH.obtainMessage(H.TAP_OUTSIDE_STACK, x, y, mDisplayContent)
                                    .sendToTarget();
                                mService.mH.obtainMessage(H.TAP_OUTSIDE_STACK, x, y,
                                        mDisplayContent).sendToTarget();
                            }
                        }
                        mPointerId = -1;
@@ -96,5 +97,8 @@ public class StackTapDetector extends InputEventReceiver {
                    break;
                }
            }
        } finally {
            finishInputEvent(event, false /*ignored for monitors*/);
        }
    }
}