Merge "Make autofill manager service to not clear inline suggestions when IME input finishes" into rvc-dev am: 7e38991bfb

Original change: undetermined

Change-Id: Ifac9ba87faa9a9b2c5eb13e7a0d65b2be9072db2
This commit is contained in:
Feng Cao
2020-06-02 06:27:58 +00:00
committed by Automerger Merge Worker

View File

@@ -40,7 +40,6 @@ import com.android.server.autofill.ui.InlineFillUi;
import com.android.server.inputmethod.InputMethodManagerInternal; import com.android.server.inputmethod.InputMethodManagerInternal;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.Optional; import java.util.Optional;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -209,18 +208,9 @@ final class AutofillInlineSuggestionsRequestSession {
if (mDestroyed || mResponseCallback == null) { if (mDestroyed || mResponseCallback == null) {
return; return;
} }
if (!mImeInputStarted && mPreviousResponseIsNotEmpty) { if (mImeInputViewStarted && mInlineFillUi != null && match(mAutofillId,
// 1. if previous response is not empty, and IME is just disconnected from the view,
// then send empty response to make sure existing responses don't stick around.
// Although the inline suggestions should disappear when IME hides which removes them
// from the view hierarchy, but we still send an empty response to indicate that the
// previous suggestions are invalid now.
if (sVerbose) Slog.v(TAG, "Send empty inline response");
updateResponseToImeUncheckLocked(new InlineSuggestionsResponse(Collections.EMPTY_LIST));
mPreviousResponseIsNotEmpty = false;
} else if (mImeInputViewStarted && mInlineFillUi != null && match(mAutofillId,
mImeCurrentFieldId)) { mImeCurrentFieldId)) {
// 2. if IME is visible, and response is not null, send the response // if IME is visible, and response is not null, send the response
InlineSuggestionsResponse response = mInlineFillUi.getInlineSuggestionsResponse(); InlineSuggestionsResponse response = mInlineFillUi.getInlineSuggestionsResponse();
boolean isEmptyResponse = response.getInlineSuggestions().isEmpty(); boolean isEmptyResponse = response.getInlineSuggestions().isEmpty();
if (isEmptyResponse && !mPreviousResponseIsNotEmpty) { if (isEmptyResponse && !mPreviousResponseIsNotEmpty) {