From 217649d3edb650cdc8b0999d848815cc6c52e0cd Mon Sep 17 00:00:00 2001 From: Adam He Date: Wed, 19 Feb 2020 18:30:20 -0800 Subject: [PATCH] Hide suggestions with hideFillUi Fix: 149945531 Test: atest InlineLoginActivityTest Change-Id: Ibd6d19165c69f51fbe92addbf114c9d123147362 --- .../java/com/android/server/autofill/Session.java | 12 ++++++++++++ .../autofill/ui/InlineSuggestionFactory.java | 15 ++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index f544517a79e31..317ce4cb5feea 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -1158,6 +1158,18 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } catch (RemoteException e) { Slog.e(TAG, "Error requesting to hide fill UI", e); } + try { + final InlineSuggestionSession.ImeResponse imeResponse = + mInlineSuggestionSession.waitAndGetImeResponse(); + if (imeResponse == null) { + Log.w(TAG, "Session input method callback is not set yet"); + return; + } + imeResponse.getCallback().onInlineSuggestionsResponse( + new InlineSuggestionsResponse(Collections.EMPTY_LIST)); + } catch (RemoteException e) { + Slog.e(TAG, "RemoteException hiding inline suggestions"); + } } } diff --git a/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java b/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java index a8886fc06c5af..17cdf618d5660 100644 --- a/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java +++ b/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java @@ -82,12 +82,17 @@ public final class InlineSuggestionFactory { if (sDebug) Slog.d(TAG, "createInlineSuggestionsResponse called"); final BiConsumer onClickFactory; if (response.getAuthentication() != null) { - onClickFactory = (dataset, datasetIndex) -> client.authenticate(response.getRequestId(), - datasetIndex, response.getAuthentication(), response.getClientState(), - /* authenticateInline= */ true); + onClickFactory = (dataset, datasetIndex) -> { + client.requestHideFillUi(autofillId); + client.authenticate(response.getRequestId(), + datasetIndex, response.getAuthentication(), response.getClientState(), + /* authenticateInline= */ true); + }; } else { - onClickFactory = (dataset, datasetIndex) -> - client.fill(response.getRequestId(), datasetIndex, dataset); + onClickFactory = (dataset, datasetIndex) -> { + client.requestHideFillUi(autofillId); + client.fill(response.getRequestId(), datasetIndex, dataset); + }; } final List datasetList = response.getDatasets();