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

Commit 792e2c00 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

HandwritingModeController: Use Context's InputManager for pilferPointers

Bug: 245989146
Test: Presbumit
Flag: EXEMPT trivial refactor
Change-Id: If6c4fa7235b0057729eca7dd4a3a988066f17490
parent 6e63aaf7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ final class HandwritingModeController {
    private final Context mContext;
    // This must be the looper for the UiThread.
    private final Looper mLooper;
    private final InputManager mInputManager;
    private final InputManagerInternal mInputManagerInternal;
    private final WindowManagerInternal mWindowManagerInternal;
    private final PackageManagerInternal mPackageManagerInternal;
@@ -103,6 +104,7 @@ final class HandwritingModeController {
        mContext = context;
        mLooper = uiThreadLooper;
        mCurrentDisplayId = Display.INVALID_DISPLAY;
        mInputManager = context.getSystemService(InputManager.class);
        mInputManagerInternal = LocalServices.getService(InputManagerInternal.class);
        mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
        mPackageManagerInternal = LocalServices.getService(PackageManagerInternal.class);
@@ -319,8 +321,7 @@ final class HandwritingModeController {
        }
        if (DEBUG) Slog.d(TAG, "Starting handwriting session in display: " + mCurrentDisplayId);

        InputManagerGlobal.getInstance()
                .pilferPointers(mHandwritingSurface.getInputChannel().getToken());
        mInputManager.pilferPointers(mHandwritingSurface.getInputChannel().getToken());

        // Stop processing more events.
        mHandwritingEventReceiver.dispose();
@@ -335,7 +336,7 @@ final class HandwritingModeController {
        mHandwritingSurface.startIntercepting(imePid, imeUid);

        // Unset the pointer icon for the stylus in case the app had set it.
        Objects.requireNonNull(mContext.getSystemService(InputManager.class)).setPointerIcon(
        mInputManager.setPointerIcon(
                PointerIcon.getSystemIcon(mContext, PointerIcon.TYPE_NOT_SPECIFIED),
                downEvent.getDisplayId(), downEvent.getDeviceId(), downEvent.getPointerId(0),
                mHandwritingSurface.getInputChannel().getToken());