diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-05-14 13:18:38 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-14 13:18:38 +0000 |
commit | 2ec1d707fafb7cf49229f63ddfd57a7d660752a8 (patch) | |
tree | 4f64c2fb193fa578e93a8e2a4b60f1a91639fb1c /services/autofill/java | |
parent | a601967457fa25a46b8d35a525cb0c4e57d53dd7 (diff) | |
parent | 793e1bc92a1874c161d8bddca7d3969abee1c580 (diff) |
Merge "AF: Remove the timeout for receiving InlineSuggestionsRequest from IME" into rvc-dev
Diffstat (limited to 'services/autofill/java')
2 files changed, 9 insertions, 27 deletions
diff --git a/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java b/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java index 3282870fe281..3dd2433ac2bd 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java +++ b/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java @@ -67,8 +67,8 @@ final class AutofillInlineSessionController { * Requests the IME to create an {@link InlineSuggestionsRequest} for {@code autofillId}. * * @param autofillId the Id of the field for which the request is for. - * @param requestConsumer the callback which will be invoked when IME responded or if it times - * out waiting for IME response. + * @param requestConsumer the callback to be invoked when the IME responds. Note that this is + * never invoked if the IME doesn't respond. */ @GuardedBy("mLock") void onCreateInlineSuggestionsRequestLocked(@NonNull AutofillId autofillId, diff --git a/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java b/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java index aee4afbdc3d2..1a3baba1ff19 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java +++ b/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java @@ -55,16 +55,6 @@ final class AutofillInlineSuggestionsRequestSession { private static final String TAG = AutofillInlineSuggestionsRequestSession.class.getSimpleName(); - // This timeout controls how long Autofill should wait for the IME to respond either - // unsupported or an {@link InlineSuggestionsRequest}. The timeout is needed to take into - // account the latency between the two events after a field is focused, 1) an Autofill - // request is triggered on framework; 2) the InputMethodService#onStartInput() event is - // triggered on the IME side. When 1) happens, Autofill may call the IME to return an {@link - // InlineSuggestionsRequest}, but the IME will only return it after 2) happens (or return - // immediately if the IME doesn't support inline suggestions). Also there is IPC latency - // between the framework and the IME but that should be small compare to that. - private static final int CREATE_INLINE_SUGGESTIONS_REQUEST_TIMEOUT_MS = 1000; - @NonNull private final InputMethodManagerInternal mInputMethodManagerInternal; private final int mUserId; @@ -92,9 +82,6 @@ final class AutofillInlineSuggestionsRequestSession { @GuardedBy("mLock") @Nullable private IInlineSuggestionsResponseCallback mResponseCallback; - @GuardedBy("mLock") - @Nullable - private Runnable mTimeoutCallback; @GuardedBy("mLock") @Nullable @@ -174,12 +161,17 @@ final class AutofillInlineSuggestionsRequestSession { } /** - * This method must be called when the session is destroyed, to avoid further callbacks from/to - * the IME. + * Prevents further interaction with the IME. Must be called before starting a new request + * session to avoid unwanted behavior from two overlapping requests. */ @GuardedBy("mLock") void destroySessionLocked() { mDestroyed = true; + + if (!mImeRequestReceived) { + Slog.w(TAG, + "Never received an InlineSuggestionsRequest from the IME for " + mAutofillId); + } } /** @@ -196,11 +188,6 @@ final class AutofillInlineSuggestionsRequestSession { mInputMethodManagerInternal.onCreateInlineSuggestionsRequest(mUserId, new InlineSuggestionsRequestInfo(mComponentName, mAutofillId, mUiExtras), new InlineSuggestionsRequestCallbackImpl(this)); - mTimeoutCallback = () -> { - Slog.w(TAG, "Timed out waiting for IME callback InlineSuggestionsRequest."); - handleOnReceiveImeRequest(null, null); - }; - mHandler.postDelayed(mTimeoutCallback, CREATE_INLINE_SUGGESTIONS_REQUEST_TIMEOUT_MS); } /** @@ -264,11 +251,6 @@ final class AutofillInlineSuggestionsRequestSession { } mImeRequestReceived = true; - if (mTimeoutCallback != null) { - if (sVerbose) Slog.v(TAG, "removing timeout callback"); - mHandler.removeCallbacks(mTimeoutCallback); - mTimeoutCallback = null; - } if (request != null && callback != null) { mImeRequest = request; mResponseCallback = callback; |