Fix IMS#onPrepareStylusHandwriting call
Ensure onPrepareStylusHandwriting() is always called before onStartStylusHandwriting(). Test: manually using HandwritingIme Bug: 217957587 Change-Id: I6f1b8a93a76dbb34d3323439253a3394c05d98a8
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user