Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29350482 authored by Ahaan Ugale's avatar Ahaan Ugale
Browse files

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
parent 6f9b5cc3
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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);
            }
        }
    }