Merge "Dont finish handwriting inking was prepared for session" into udc-qpr-dev am: f3b13f106f am: e5c151fdf1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24023608
Change-Id: I057a29d50d5d3ee29be4d56ee82001eef70d1014
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 7b5dd55..795eb4a 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -1019,8 +1019,9 @@
if (!mOnPreparedStylusHwCalled) {
// prepare hasn't been called by Stylus HOVER.
onPrepareStylusHandwriting();
- mOnPreparedStylusHwCalled = true;
}
+ // reset flag as it's not relevant after onStartStylusHandwriting().
+ mOnPreparedStylusHwCalled = false;
if (onStartStylusHandwriting()) {
cancelStylusWindowIdleTimeout();
mPrivOps.onStylusHandwritingReady(requestId, Process.myPid());
@@ -3089,7 +3090,8 @@
mInputStarted = false;
mStartedInputConnection = null;
mCurCompletions = null;
- if (mInkWindow != null) {
+ if (!mOnPreparedStylusHwCalled) {
+ // If IME didn't prepare to show InkWindow for current handwriting session.
finishStylusHandwriting();
}
// Back callback is typically unregistered in {@link #hideWindow()}, but it's possible