From 9ae0d4b5e271bdca5cd000bac6871fa6e165132f Mon Sep 17 00:00:00 2001 From: TYM Tsai Date: Thu, 15 Dec 2022 09:10:51 +0800 Subject: [PATCH] Fix no FillContext when auth for client suggestions When the suggestion is coming from the client and does the authentication, a "No FillContext" error will occur and the authentication process will be stopped. It is because Autofill does not create a FillContext for the fill request when requesting client suggestions. When do authentication for the request, Autofill appends some data in the intent, like AssistStructure. The structure is saved in the FillContext. Autofill will try to find FillContext before authenticating, but can not find, so the authentication breaks. To fixes, add a FillContext with empty AssistStructure for client suggestions. And then when doing authentication, Autofill will append an empty structure in the intent. Bug: 261817171 Test: atest CtsAutoFillServiceTestCases Change-Id: I149b7dbf574ed8e0ec96f9e4e8dd7f21a0adc976 --- services/autofill/java/com/android/server/autofill/Session.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 64b7688cc196a..213d5efc985a5 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -4231,6 +4231,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (mContexts == null) { mContexts = new ArrayList<>(1); } + mContexts.add(new FillContext(requestId, new AssistStructure(), mCurrentViewId)); if (inlineSuggestionsRequest != null && !inlineSuggestionsRequest.isClientSupported()) { inlineSuggestionsRequest = null;