Merge "Introduce IMM#isStylusHandwritingAvailable()"
This commit is contained in:
@@ -53178,6 +53178,7 @@ package android.view.inputmethod {
|
||||
method public boolean isActive();
|
||||
method public boolean isFullscreenMode();
|
||||
method public boolean isInputMethodSuppressingSpellChecker();
|
||||
method public boolean isStylusHandwritingAvailable();
|
||||
method @Deprecated public boolean isWatchingCursor(android.view.View);
|
||||
method public void restartInput(android.view.View);
|
||||
method public void sendAppPrivateCommand(android.view.View, String, android.os.Bundle);
|
||||
|
||||
@@ -1402,6 +1402,20 @@ public final class InputMethodManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if currently selected IME supports Stylus handwriting.
|
||||
* If the method returns {@code false}, {@link #startStylusHandwriting(View)} shouldn't be
|
||||
* called and Stylus touch should continue as normal touch input.
|
||||
* @see #startStylusHandwriting(View)
|
||||
*/
|
||||
public boolean isStylusHandwritingAvailable() {
|
||||
try {
|
||||
return mService.isStylusHandwritingAvailable();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of installed input methods for the specified user.
|
||||
*
|
||||
@@ -1992,10 +2006,13 @@ public final class InputMethodManager {
|
||||
* pointers will be {@code android.view.MotionEvent#FLAG_CANCELED} cancelled.
|
||||
*
|
||||
* If Stylus handwriting mode is not supported or cannot be fulfilled for any reason by IME,
|
||||
* request will be ignored and Stylus touch will continue as normal touch input.
|
||||
* request will be ignored and Stylus touch will continue as normal touch input. Ideally,
|
||||
* {@link #isStylusHandwritingAvailable()} should be called first to determine if stylus
|
||||
* handwriting is supported by IME.
|
||||
*
|
||||
* @param view the View for which stylus handwriting is requested. It and
|
||||
* {@link View#hasWindowFocus its window} must be {@link View#hasFocus focused}.
|
||||
* @see #isStylusHandwritingAvailable()
|
||||
*/
|
||||
public void startStylusHandwriting(@NonNull View view) {
|
||||
// Re-dispatch if there is a context mismatch.
|
||||
|
||||
@@ -89,4 +89,6 @@ interface IInputMethodManager {
|
||||
|
||||
/** Start Stylus handwriting session **/
|
||||
void startStylusHandwriting(in IInputMethodClient client);
|
||||
/** Returns {@code true} if currently selected IME supports Stylus handwriting. */
|
||||
boolean isStylusHandwritingAvailable();
|
||||
}
|
||||
|
||||
@@ -74,6 +74,11 @@ public abstract class InputMethodManagerInternal {
|
||||
*/
|
||||
public abstract List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId);
|
||||
|
||||
/**
|
||||
* Returns {@code true} if currently selected IME supports Stylus handwriting.
|
||||
*/
|
||||
public abstract boolean isStylusHandwritingAvailable();
|
||||
|
||||
/**
|
||||
* Called by the Autofill Frameworks to request an {@link InlineSuggestionsRequest} from
|
||||
* the input method.
|
||||
@@ -256,6 +261,11 @@ public abstract class InputMethodManagerInternal {
|
||||
@Override
|
||||
public void maybeFinishStylusHandwriting() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStylusHandwritingAvailable() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -2133,6 +2133,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStylusHandwritingAvailable() {
|
||||
synchronized (ImfLock.class) {
|
||||
return mBindingController.supportsStylusHandwriting();
|
||||
}
|
||||
}
|
||||
|
||||
@GuardedBy("ImfLock.class")
|
||||
private List<InputMethodInfo> getInputMethodListLocked(@UserIdInt int userId,
|
||||
@DirectBootAwareness int directBootAwareness) {
|
||||
@@ -5787,6 +5794,11 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
mHandler.removeMessages(MSG_FINISH_HANDWRITING);
|
||||
mHandler.obtainMessage(MSG_FINISH_HANDWRITING).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStylusHandwritingAvailable() {
|
||||
return InputMethodManagerService.this.isStylusHandwritingAvailable();
|
||||
}
|
||||
}
|
||||
|
||||
@BinderThread
|
||||
|
||||
Reference in New Issue
Block a user