diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-06-16 02:47:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-06-16 02:47:47 +0000 |
commit | 756740d9f44c958f66577b125d1526d3ac93d917 (patch) | |
tree | c6de27cdd45ebc61cae0aa7ec996714557592102 | |
parent | f40975ee76cb8c1d81132a22d8a0b7d3a40cab94 (diff) | |
parent | 89825acce149cd1dfdad8c62283ff1952645e45a (diff) |
Merge "Send empty response to IME when autofill session is destroyed" into rvc-dev
-rw-r--r-- | services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java | 18 | ||||
-rw-r--r-- | services/autofill/java/com/android/server/autofill/Session.java | 3 |
2 files changed, 20 insertions, 1 deletions
diff --git a/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java b/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java index 0ec8654f2a20..398ece4c1836 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java +++ b/services/autofill/java/com/android/server/autofill/AutofillInlineSessionController.java @@ -77,8 +77,8 @@ final class AutofillInlineSessionController { if (mSession != null) { // Destroy the existing session. mSession.destroySessionLocked(); - mInlineFillUi = null; } + mInlineFillUi = null; // TODO(b/151123764): consider reusing the same AutofillInlineSession object for the // same field. mSession = new AutofillInlineSuggestionsRequestSession(mInputMethodManagerInternal, mUserId, @@ -87,6 +87,22 @@ final class AutofillInlineSessionController { } /** + * Destroys the current session. May send an empty response to IME to clear the suggestions if + * the focus didn't change to a different field. + * + * @param autofillId the currently focused view from the autofill session + */ + @GuardedBy("mLock") + void destroyLocked(@NonNull AutofillId autofillId) { + if (mSession != null) { + mSession.onInlineSuggestionsResponseLocked(InlineFillUi.emptyUi(autofillId)); + mSession.destroySessionLocked(); + mSession = null; + } + mInlineFillUi = null; + } + + /** * Returns the {@link InlineSuggestionsRequest} provided by IME for the last request. * * <p> The caller is responsible for making sure Autofill hears back from IME before calling diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index a9a0ab69f633..c7490b3b991c 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -3702,6 +3702,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState unlinkClientVultureLocked(); mUi.destroyAll(mPendingSaveUi, this, true); mUi.clearCallback(this); + if (mCurrentViewId != null) { + mInlineSessionController.destroyLocked(mCurrentViewId); + } mDestroyed = true; // Log metrics |