From 29350482e3c546a6174071741bc37ecc4f5498b4 Mon Sep 17 00:00:00 2001 From: Ahaan Ugale Date: Fri, 3 Apr 2020 17:16:56 -0700 Subject: [PATCH] AF: Fix bug where Session#setViewStatesLocked doesn't clear response. clearResponse=true doesn't clear the response if the `response` arg is non null. The new behavior matches the corresponding logic for authenticated responses above (lines 3197-3200). This affects only 1 invoking method, replaceResponseLocked, which sets the responses again soon after, so this change shouldn't affect any behavior. This change also fixes the javadoc for the method. Bug: 152620157 Test: atest android.autofillservice.cts Test: manual Change-Id: I78262baa1c6c11ef7e4b3c12c2ecd3d9dd28bfd7 --- .../java/com/android/server/autofill/Session.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 55a92966eb292..4b2e3b2e6467e 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -3226,7 +3226,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } /** - * Sets the state of all views in the given dataset and response. + * Sets the state and response of all views in the given dataset. */ @GuardedBy("mLock") private void setViewStatesLocked(@Nullable FillResponse response, @NonNull Dataset dataset, @@ -3241,10 +3241,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (datasetId != null) { viewState.setDatasetId(datasetId); } - if (response != null) { - viewState.setResponse(response); - } else if (clearResponse) { + if (clearResponse) { viewState.setResponse(null); + } else if (response != null) { + viewState.setResponse(response); } } }