Merge "Finish handwriting session for recents gesture" into tm-dev
This commit is contained in:
commit
4cff41a3f2
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -414,4 +414,12 @@ public interface InputMethod {
|
||||
// intentionally empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish stylus handwriting session.
|
||||
* @hide
|
||||
*/
|
||||
default void finishStylusHandwriting() {
|
||||
// intentionally empty
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -67,4 +67,6 @@ oneway interface IInputMethod {
|
||||
in List<MotionEvent> events);
|
||||
|
||||
void initInkWindow();
|
||||
|
||||
void finishStylusHandwriting();
|
||||
}
|
||||
|
@ -245,4 +245,13 @@ final class IInputMethodInvoker {
|
||||
logRemoteException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
void finishStylusHandwriting() {
|
||||
try {
|
||||
mTarget.finishStylusHandwriting();
|
||||
} catch (RemoteException e) {
|
||||
logRemoteException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package com.android.server.inputmethod;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UserIdInt;
|
||||
import android.inputmethodservice.InputMethodService;
|
||||
import android.os.IBinder;
|
||||
import android.view.inputmethod.InlineSuggestionsRequest;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
@ -149,6 +150,12 @@ public abstract class InputMethodManagerInternal {
|
||||
*/
|
||||
public abstract void updateImeWindowStatus(boolean disableImeIcon);
|
||||
|
||||
/**
|
||||
* Finish stylus handwriting by calling {@link InputMethodService#finishStylusHandwriting()} if
|
||||
* there is an ongoing handwriting session.
|
||||
*/
|
||||
public abstract void maybeFinishStylusHandwriting();
|
||||
|
||||
/**
|
||||
* Callback when the IInputMethodSession from the accessibility service with the specified
|
||||
* accessibilityConnectionId is created.
|
||||
@ -239,6 +246,10 @@ public abstract class InputMethodManagerInternal {
|
||||
@Override
|
||||
public void unbindAccessibilityFromCurrentClient(int accessibilityConnectionId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maybeFinishStylusHandwriting() {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -237,6 +237,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
|
||||
private static final int MSG_RESET_HANDWRITING = 1090;
|
||||
private static final int MSG_START_HANDWRITING = 1100;
|
||||
private static final int MSG_FINISH_HANDWRITING = 1110;
|
||||
|
||||
private static final int MSG_UNBIND_CLIENT = 3000;
|
||||
private static final int MSG_UNBIND_ACCESSIBILITY_SERVICE = 3001;
|
||||
@ -4496,7 +4497,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}
|
||||
|
||||
@BinderThread
|
||||
private void finishStylusHandwriting(int requestId) {
|
||||
private void resetStylusHandwriting(int requestId) {
|
||||
synchronized (ImfLock.class) {
|
||||
final OptionalInt curRequest = mHwController.getCurrentRequestId();
|
||||
if (!curRequest.isPresent() || curRequest.getAsInt() != requestId) {
|
||||
@ -4863,6 +4864,14 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case MSG_FINISH_HANDWRITING:
|
||||
synchronized (ImfLock.class) {
|
||||
IInputMethodInvoker curMethod = getCurMethodLocked();
|
||||
if (curMethod != null && mHwController.getCurrentRequestId().isPresent()) {
|
||||
curMethod.finishStylusHandwriting();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -5501,6 +5510,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maybeFinishStylusHandwriting() {
|
||||
mHandler.removeMessages(MSG_FINISH_HANDWRITING);
|
||||
mHandler.obtainMessage(MSG_FINISH_HANDWRITING).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@BinderThread
|
||||
@ -6454,8 +6469,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
|
||||
@BinderThread
|
||||
@Override
|
||||
public void finishStylusHandwriting(int requestId) {
|
||||
mImms.finishStylusHandwriting(requestId);
|
||||
public void resetStylusHandwriting(int requestId) {
|
||||
mImms.resetStylusHandwriting(requestId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,6 +281,7 @@ public class RecentsAnimationController implements DeathRecipient {
|
||||
task.setCanAffectSystemUiFlags(behindSystemBars);
|
||||
}
|
||||
}
|
||||
InputMethodManagerInternal.get().maybeFinishStylusHandwriting();
|
||||
if (!behindSystemBars) {
|
||||
// Hiding IME if IME window is not attached to app.
|
||||
// Since some windowing mode is not proper to snapshot Task with IME window
|
||||
|
Loading…
x
Reference in New Issue
Block a user