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

Commit f7a7bb6b authored by Felipe Leme's avatar Felipe Leme
Browse files

Autofill a manual request directly when it only has one dataset.

Tests:
- renamed testManualAutofill() to testManualAutofillOneDataset()
- added testManualAutofillTwoDatasetsPickFirst()
- added testManualAutofillTwoDatasetsPickSecond()

Bug: 35708229
Test: LoginActivityTest pass
Test: manual verification
Change-Id: I7aa60ab5df60decaf49d617bf3e9fcf3ab0074fa
parent 60b4af5d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.view.autofill.AutofillManager.FLAG_VIEW_ENTERED;
import static android.view.autofill.AutofillManager.FLAG_VIEW_EXITED;
import static android.view.autofill.AutofillManager.FLAG_START_SESSION;
import static android.view.autofill.AutofillManager.FLAG_VALUE_CHANGED;
import static android.view.autofill.AutofillManager.FLAG_MANUAL_REQUEST;

import static com.android.server.autofill.Helper.DEBUG;
import static com.android.server.autofill.Helper.VERBOSE;
@@ -1128,6 +1129,13 @@ final class AutofillManagerServiceImpl {
                return;
            }

            if ((mFlags & FLAG_MANUAL_REQUEST) != 0 && response.getDatasets() != null
                    && response.getDatasets().size() == 1) {
                Slog.d(TAG, "autofilling manual request directly");
                autoFill(response.getDatasets().get(0));
                return;
            }

            mCurrentViewState.setResponse(mCurrentResponse);
        }