From e48180fb88f62fe929d384e643eceb8cf4631e1c Mon Sep 17 00:00:00 2001 From: Tetsui Ohkubo Date: Fri, 17 Sep 2021 16:34:11 +0900 Subject: [PATCH] Update javadoc for EditorInfo.actionId usage We concluded that the behavior of sendDefaultEditorAction should be kept for compatibility. To compensate that, we should update the javadoc to reflect the current behavior. Test: None Bug: 28898996 Change-Id: Idcb2b7180f9e22818ab819715fe2723a05b4894a --- .../android/inputmethodservice/InputMethodService.java | 7 ++++++- core/java/android/view/inputmethod/InputConnection.java | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index dadea6792ac16..fc0533e75470a 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -2867,7 +2867,12 @@ public class InputMethodService extends AbstractInputMethodService { * Ask the input target to execute its default action via * {@link InputConnection#performEditorAction * InputConnection.performEditorAction()}. - * + * + *

For compatibility, this method does not execute a custom action even if {@link + * EditorInfo#actionLabel EditorInfo.actionLabel} is set. The implementor should directly call + * {@link InputConnection#performEditorAction InputConnection.performEditorAction()} with + * {@link EditorInfo#actionId EditorInfo.actionId} if they want to execute a custom action.

+ * * @param fromEnterKey If true, this will be executed as if the user had * pressed an enter key on the keyboard, that is it will not * be done if the editor has set {@link EditorInfo#IME_FLAG_NO_ENTER_ACTION diff --git a/core/java/android/view/inputmethod/InputConnection.java b/core/java/android/view/inputmethod/InputConnection.java index 5185dc2543c78..e0f0d118d58c5 100644 --- a/core/java/android/view/inputmethod/InputConnection.java +++ b/core/java/android/view/inputmethod/InputConnection.java @@ -726,8 +726,9 @@ public interface InputConnection { * associated with the action.

* * @param editorAction This must be one of the action constants for - * {@link EditorInfo#imeOptions EditorInfo.editorType}, such as - * {@link EditorInfo#IME_ACTION_GO EditorInfo.EDITOR_ACTION_GO}. + * {@link EditorInfo#imeOptions EditorInfo.imeOptions}, such as + * {@link EditorInfo#IME_ACTION_GO EditorInfo.EDITOR_ACTION_GO}, or the value of + * {@link EditorInfo#actionId EditorInfo.actionId} if a custom action is available. * @return true on success, false if the input connection is no longer * valid. */