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

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

Fixed Save logic so it's not triggered when field was not autofilled.

Test: atest CtsAutoFillServiceTestCases:VirtualContainerActivityTest#testSaveNotShown_initialValues_noUserInput_serviceDatasets\
CtsAutoFillServiceTestCases:VirtualContainerActivityCompatModeTest#testSaveNotShown_initialValues_noUserInput_serviceDatasets
Test: atest CtsAutoFillServiceTestCases
Test: manual verification with Chrome in compat mode

Fixes: 75333153

Change-Id: I344755ce0f5937180b4647fa47269eca5c93c980
parent 4cda02f2
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -1438,6 +1438,19 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                final AutofillValue filledValue = viewState.getAutofilledValue();

                if (!value.equals(filledValue)) {
                    boolean changed = true;
                    if (filledValue == null) {
                        // Dataset was not autofilled, make sure initial value didn't change.
                        final AutofillValue initialValue = getValueFromContextsLocked(id);
                        if (initialValue != null && initialValue.equals(value)) {
                            if (sDebug) {
                                Slog.d(TAG, "id " + id + " is part of dataset but initial value "
                                        + "didn't change: " + value);
                            }
                            changed = false;
                        }
                    }
                    if (changed) {
                        if (sDebug) {
                            Slog.d(TAG, "found a change on required " + id + ": " + filledValue
                                    + " => " + value);
@@ -1446,6 +1459,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                    }
                }
            }
        }

        final AutofillId[] optionalIds = saveInfo.getOptionalIds();
        if (allRequiredAreNotEmpty) {