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

Commit 070f7b67 authored by Taran Singh's avatar Taran Singh
Browse files

Fix IMS#onPrepareStylusHandwriting call

Ensure onPrepareStylusHandwriting() is always called before
onStartStylusHandwriting().

Test: manually using HandwritingIme
Bug: 217957587
Change-Id: I6f1b8a93a76dbb34d3323439253a3394c05d98a8
parent d6111dd1
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -102,11 +102,4 @@ final class InkWindow extends PhoneWindow {
        lp.token = token;
        setAttributes(lp);
    }

    /**
     * Returns {@code true} if Window was created and added to WM.
     */
    boolean isInitialized() {
        return mIsViewAdded;
    }
}
+6 −2
Original line number Diff line number Diff line
@@ -578,6 +578,7 @@ public class InputMethodService extends AbstractInputMethodService {
    private boolean mImeSurfaceScheduledForRemoval;
    private ImsConfigurationTracker mConfigTracker = new ImsConfigurationTracker();
    private boolean mDestroyed;
    private boolean mOnPreparedStylusHwCalled;

    /** Stylus handwriting Ink window.  */
    private InkWindow mInkWindow;
@@ -919,9 +920,10 @@ public class InputMethodService extends AbstractInputMethodService {
                Log.d(TAG, "Input should have started before starting Stylus handwriting.");
                return;
            }
            if (!mInkWindow.isInitialized()) {
            if (!mOnPreparedStylusHwCalled) {
                // prepare hasn't been called by Stylus HOVER.
                onPrepareStylusHandwriting();
                mOnPreparedStylusHwCalled = true;
            }
            if (onStartStylusHandwriting()) {
                mPrivOps.onStylusHandwritingReady(requestId);
@@ -976,6 +978,7 @@ public class InputMethodService extends AbstractInputMethodService {
        public void initInkWindow() {
            mInkWindow.initOnly();
            onPrepareStylusHandwriting();
            mOnPreparedStylusHwCalled = true;
        }

        /**
@@ -2354,7 +2357,7 @@ public class InputMethodService extends AbstractInputMethodService {

    /**
     * Called to prepare stylus handwriting.
     * The system calls this before the first {@link #onStartStylusHandwriting} request.
     * The system calls this before the {@link #onStartStylusHandwriting} request.
     *
     * <p>Note: The system tries to call this as early as possible, when it detects that
     * handwriting stylus input is imminent. However, that a subsequent call to
@@ -2438,6 +2441,7 @@ public class InputMethodService extends AbstractInputMethodService {
        mInkWindow.hide(false /* remove */);

        mPrivOps.finishStylusHandwriting(requestId);
        mOnPreparedStylusHwCalled = false;
        onFinishStylusHandwriting();
    }