From b0b721bbe01bc0485c83451ff4620bda57017dfc Mon Sep 17 00:00:00 2001 From: Joanne Chung Date: Mon, 24 Feb 2020 23:52:42 +0800 Subject: [PATCH] Fix wrong parameter fieldIndex caused IndexOutOfBoundsException The inline authentication change ag/10235929 changes the parameter of createInlineSuggestion from fieldIndex to datasetIndex. However, the passed parameter forget to change to datasetIndex. It is possible to trigger IndexOutOfBoundsException when we have multiple fields but only one dataset. Bug: 149891961 Test: atest android.autofillservice.cts.inline.InlineAuthenticationTest Test: Manual test by local sample Change-Id: Iec074b14f2aa3fdb7de918ad684192921b9c5d65 --- .../android/server/autofill/ui/InlineSuggestionFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 0d8c89b4124d5..db5166a242b1a 100644 --- a/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java +++ b/services/autofill/java/com/android/server/autofill/ui/InlineSuggestionFactory.java @@ -162,7 +162,8 @@ public final class InlineSuggestionFactory { continue; } InlineSuggestion inlineSuggestion = createInlineSuggestion(isAugmented, dataset, - fieldIndex, mergedInlinePresentation(request, datasetIndex, inlinePresentation), + datasetIndex, + mergedInlinePresentation(request, datasetIndex, inlinePresentation), onClickFactory, remoteRenderService, onErrorCallback, request.getHostInputToken());