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

Commit 9d8d4dae authored by Taran Singh's avatar Taran Singh
Browse files

Cleanup isStylusEvent in HandwritingModeController

use MotionEvent#isStylusPointer() instead of a private method.

Bug: 210039666
Test: atest StylusHandwritingTest
Change-Id: I8533a7d4ed34afaba3b9e570ec85a4362bc40b1d
parent 094d6c18
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.server.inputmethod;

import static android.view.InputDevice.SOURCE_STYLUS;

import android.Manifest;
import android.annotation.AnyThread;
import android.annotation.NonNull;
@@ -95,15 +93,6 @@ final class HandwritingModeController {
        mInkWindowInitRunnable = inkWindowInitRunnable;
    }

    // TODO(b/210039666): Consider moving this to MotionEvent
    private static boolean isStylusEvent(MotionEvent event) {
        if (!event.isFromSource(SOURCE_STYLUS)) {
            return false;
        }
        final int tool = event.getToolType(0);
        return tool == MotionEvent.TOOL_TYPE_STYLUS || tool == MotionEvent.TOOL_TYPE_ERASER;
    }

    /**
     * Initializes the handwriting spy on the given displayId.
     *
@@ -329,7 +318,7 @@ final class HandwritingModeController {
            return false;
        }
        final MotionEvent event = (MotionEvent) ev;
        if (!isStylusEvent(event)) {
        if (!event.isStylusPointer()) {
            return false;
        }
        if (event.getDisplayId() != mCurrentDisplayId) {