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

Commit 574e6b42 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Wire displayId from input event to PipTouchState

Bug: 171257597
Test: None
Change-Id: Ic78ce2d4341b00275067b45e5f9e59e6c487ecfc
parent 33064dba
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wm.shell.pip.phone;
import android.graphics.PointF;
import android.os.Handler;
import android.util.Log;
import android.view.Display;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;
@@ -64,6 +65,7 @@ public class PipTouchState {
    private boolean mStartedDragging = false;
    private boolean mAllowDraggingOffscreen = false;
    private int mActivePointerId;
    private int mLastTouchDisplayId = Display.INVALID_DISPLAY;

    public PipTouchState(ViewConfiguration viewConfig, Handler handler,
            Runnable doubleTapTimeoutCallback, Runnable hoverExitTimeoutCallback) {
@@ -81,12 +83,14 @@ public class PipTouchState {
        mIsDragging = false;
        mStartedDragging = false;
        mIsUserInteracting = false;
        mLastTouchDisplayId = Display.INVALID_DISPLAY;
    }

    /**
     * Processes a given touch event and updates the state.
     */
    public void onTouchEvent(MotionEvent ev) {
        mLastTouchDisplayId = ev.getDisplayId();
        switch (ev.getActionMasked()) {
            case MotionEvent.ACTION_DOWN: {
                if (!mAllowTouches) {
@@ -265,6 +269,13 @@ public class PipTouchState {
        return mStartedDragging;
    }

    /**
     * @return Display ID of the last touch event.
     */
    public int getLastTouchDisplayId() {
        return mLastTouchDisplayId;
    }

    /**
     * Sets whether touching is currently allowed.
     */
@@ -378,6 +389,7 @@ public class PipTouchState {
        pw.println(prefix + TAG);
        pw.println(innerPrefix + "mAllowTouches=" + mAllowTouches);
        pw.println(innerPrefix + "mActivePointerId=" + mActivePointerId);
        pw.println(innerPrefix + "mLastTouchDisplayId=" + mLastTouchDisplayId);
        pw.println(innerPrefix + "mDownTouch=" + mDownTouch);
        pw.println(innerPrefix + "mDownDelta=" + mDownDelta);
        pw.println(innerPrefix + "mLastTouch=" + mLastTouch);