summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Feng Cao <fengcao@google.com> 2020-04-10 17:49:15 -0700
committer Feng Cao <fengcao@google.com> 2020-04-10 17:53:31 -0700
commit1f0b18175ca309a6c9ab38a85277665a6bcce950 (patch)
treeb48ab27f3310a0162fe9912e0ed1c8c42f73dc48
parent232ffbfe8fbe3ced3a188f7b364d311f937ddba2 (diff)
Resend previous inline suggestions when IME hides and shows again
* when IME hides (onInputViewFinish), autofill manager service will send an empty inline suggestions response to clear the previous non-empty response * when IME shows again (onInputViewStart), if the focus didn't change, the autofill manager service will resend the previous non-empty inline suggestions response to the IME Test: atest android.autofillservice.cts.inline Test: atest CtsInputMethodTestCases Bug: 152577411 Bug: 153702698 Change-Id: Ic6a4b1db54c93040dc47c2a0d1cdc2e98f64d8ff
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java b/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java
index ca230b6936ff..ea4aaa43ea65 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java
@@ -39,6 +39,7 @@ import com.android.internal.view.InlineSuggestionsRequestInfo;
import com.android.server.inputmethod.InputMethodManagerInternal;
import java.lang.ref.WeakReference;
+import java.util.Collections;
import java.util.Optional;
import java.util.function.Consumer;
@@ -205,12 +206,9 @@ final class AutofillInlineSuggestionsRequestSession {
// Although the inline suggestions should disappear when IME hides which removes them
// from the view hierarchy, but we still send an empty response to be extra safe.
- // TODO(b/149945531): clear the existing suggestions when IME is hide, once the bug is
- // fixed.
- //if (sDebug) Log.d(TAG, "Send empty inline response");
- //updateResponseToImeUncheckLocked(new InlineSuggestionsResponse(Collections
- // .EMPTY_LIST));
- //mPreviousResponseIsNotEmpty = false;
+ if (sDebug) Log.d(TAG, "Send empty inline response");
+ updateResponseToImeUncheckLocked(new InlineSuggestionsResponse(Collections.EMPTY_LIST));
+ mPreviousResponseIsNotEmpty = false;
} else if (mImeInputViewStarted && mInlineSuggestionsResponse != null && match(mAutofillId,
mImeCurrentFieldId)) {
// 2. if IME is visible, and response is not null, send the response
@@ -224,9 +222,6 @@ final class AutofillInlineSuggestionsRequestSession {
+ mInlineSuggestionsResponse.getInlineSuggestions().size());
}
updateResponseToImeUncheckLocked(mInlineSuggestionsResponse);
- // TODO(b/149945531): don't set the response to null so it's cached, once the bug is
- // fixed.
- mInlineSuggestionsResponse = null;
mPreviousResponseIsNotEmpty = !isEmptyResponse;
}
}