From 947fd9335ef94faaa23ce273c1efd815135ed08d Mon Sep 17 00:00:00 2001 From: Lan Wei Date: Thu, 3 Nov 2022 09:39:34 +0800 Subject: [PATCH] Improve javadoc for InputConnection#replaceText Bug: 254278543 Test: atest FrameworksCoreTests:BaseInputConnectionTest Test: atest CtsInputMethodTestCases:BaseInputConnectionTest Change-Id: I3e63532eae8349aaff21cfa72ed65f01779103df --- .../inputmethodservice/IRemoteInputConnectionInvoker.java | 8 ++++---- core/java/android/view/inputmethod/InputConnection.java | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java b/core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java index 49123aa7daa8b..2a472524cf563 100644 --- a/core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java +++ b/core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java @@ -740,8 +740,7 @@ final class IRemoteInputConnectionInvoker { } /** - * Invokes {@code IRemoteInputConnection#replaceText(InputConnectionCommandHeader, int, int, - * CharSequence, TextAttribute)}. + * Replaces the specific range in the current input field with suggested text. * * @param start the character index where the replacement should start. * @param end the character index where the replacement should end. @@ -751,8 +750,9 @@ final class IRemoteInputConnectionInvoker { * that this means you can't position the cursor within the text. * @param text the text to replace. This may include styles. * @param textAttribute The extra information about the text. This value may be null. - * @return {@code true} if the invocation is completed without {@link RemoteException}, {@code - * false} otherwise. + * @return {@code true} if the specific range is replaced successfully, {@code false} otherwise. + * @see android.view.inputmethod.InputConnection#replaceText(int, int, CharSequence, int, + * TextAttribute) */ @AnyThread public boolean replaceText( diff --git a/core/java/android/view/inputmethod/InputConnection.java b/core/java/android/view/inputmethod/InputConnection.java index 7d268a925f60e..49179af7a1575 100644 --- a/core/java/android/view/inputmethod/InputConnection.java +++ b/core/java/android/view/inputmethod/InputConnection.java @@ -1352,6 +1352,8 @@ public interface InputConnection { * that this means you can't position the cursor within the text. * @param text the text to replace. This may include styles. * @param textAttribute The extra information about the text. This value may be null. + * @return {@code true} if the replace command was sent to the associated editor (regardless of + * whether the replacement is success or not), {@code false} otherwise. */ default boolean replaceText( @IntRange(from = 0) int start,