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

Commit d98f037a authored by Taran Singh's avatar Taran Singh
Browse files

Finish handwriting session for recents gesture

Finish stylus handwriting session when user swipes to recent.
Bug: 223748964
Test: Manually:
     1. Open an app with editor
     2. swipe on editor with stylus [or emulated stylus]
     3. Observe ink trail drawn on screen
     4. quickly sipe to recents, ink should go away.
     5. repeat steps 1-3 for swipe to home

Change-Id: Id750ff55cb447247c3eca75daf37cb5aeb1d0cfa
parent 0ede4b88
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ class IInputMethodWrapper extends IInputMethod.Stub
    private static final int DO_CAN_START_STYLUS_HANDWRITING = 100;
    private static final int DO_START_STYLUS_HANDWRITING = 110;
    private static final int DO_INIT_INK_WINDOW = 120;
    private static final int DO_FINISH_STYLUS_HANDWRITING = 130;

    final WeakReference<InputMethodServiceInternal> mTarget;
    final Context mContext;
@@ -263,6 +264,10 @@ class IInputMethodWrapper extends IInputMethod.Stub
                inputMethod.initInkWindow();
                return;
            }
            case DO_FINISH_STYLUS_HANDWRITING: {
                inputMethod.finishStylusHandwriting();
                return;
            }

        }
        Log.w(TAG, "Unhandled message code: " + msg.what);
@@ -427,4 +432,10 @@ class IInputMethodWrapper extends IInputMethod.Stub
    public void initInkWindow() {
        mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_INIT_INK_WINDOW));
    }

    @BinderThread
    @Override
    public void finishStylusHandwriting() {
        mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_FINISH_STYLUS_HANDWRITING));
    }
}
+10 −1
Original line number Diff line number Diff line
@@ -992,6 +992,15 @@ public class InputMethodService extends AbstractInputMethodService {
            mOnPreparedStylusHwCalled = true;
        }

        /**
         * {@inheritDoc}
         * @hide
         */
        @Override
        public void finishStylusHandwriting() {
            InputMethodService.this.finishStylusHandwriting();
        }

        /**
         * {@inheritDoc}
         */
@@ -2461,7 +2470,7 @@ public class InputMethodService extends AbstractInputMethodService {
        mHandwritingEventReceiver = null;
        mInkWindow.hide(false /* remove */);

        mPrivOps.finishStylusHandwriting(requestId);
        mPrivOps.resetStylusHandwriting(requestId);
        mOnPreparedStylusHwCalled = false;
        onFinishStylusHandwriting();
    }
+8 −0
Original line number Diff line number Diff line
@@ -414,4 +414,12 @@ public interface InputMethod {
        // intentionally empty
    }

    /**
     * Finish stylus handwriting session.
     * @hide
     */
    default void finishStylusHandwriting() {
        // intentionally empty
    }

}
+1 −1
Original line number Diff line number Diff line
@@ -43,5 +43,5 @@ oneway interface IInputMethodPrivilegedOperations {
    void notifyUserActionAsync();
    void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible);
    void onStylusHandwritingReady(int requestId, int pid);
    void finishStylusHandwriting(int requestId);
    void resetStylusHandwriting(int requestId);
}
+2 −2
Original line number Diff line number Diff line
@@ -416,13 +416,13 @@ public final class InputMethodPrivilegedOperations {
     * @param requestId
     */
    @AnyThread
    public void finishStylusHandwriting(int requestId) {
    public void resetStylusHandwriting(int requestId) {
        final IInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull();
        if (ops == null) {
            return;
        }
        try {
            ops.finishStylusHandwriting(requestId);
            ops.resetStylusHandwriting(requestId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
Loading