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

Commit 260c6980 authored by Steve McKay's avatar Steve McKay
Browse files

Treat UNKNOWN tooltype events as Mouse events.

Temporary fix for CTS.
Eventually we'll need to update UiAutomator to support specific input tooltypes.

Bug: 24544391
Change-Id: Ief339d0d35c4305811928e9605b535c7ef230f7b
parent 130c34bf
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -38,7 +38,9 @@ final class Events {
     * Returns true if event was triggered by a finger or stylus touch.
     */
    static boolean isTouchEvent(MotionEvent e) {
        return isTouchType(e.getToolType(0));
        return isTouchType(e.getToolType(0))
                // Temporarily work around uiautomator's missing tool type support.
                || isUnknownType(e.getToolType(0));
    }

    /**
@@ -49,13 +51,20 @@ final class Events {
    }

    /**
     * Returns true if event was triggered by a finger or stylus touch.
     * Returns true if type is finger or stylus.
     */
    static boolean isTouchType(int toolType) {
        return toolType == MotionEvent.TOOL_TYPE_FINGER
                || toolType == MotionEvent.TOOL_TYPE_STYLUS;
    }

    /**
     * Returns true if type is unknown.
     */
    static boolean isUnknownType(int toolType) {
        return toolType == MotionEvent.TOOL_TYPE_UNKNOWN;
    }

    /**
     * Returns true if event was triggered by a finger or stylus touch.
     */