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

Commit 2373682f authored by Simranjit Kohli's avatar Simranjit Kohli
Browse files

[Autofill PCC Detection] Provide detection info during save.

Provide detection info during save, so that the provider can trigger
save properly in the case of misdeteciton. Otherwise, provider may
save it for wrong fields, or may decide not to save at all.

Test: atest CtsAutoFillServiceTestCases.
Some tests were failing, but they were failing irrespective of this
change.
Bug: 277538115

Change-Id: I8a78e1c483339cb3ba8086224942108a77a93c55
parent ec8f8272
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
    private static final String EXTRA_REQUEST_ID = "android.service.autofill.extra.REQUEST_ID";

    private static final String PCC_HINTS_DELIMITER = ",";
    public static final String EXTRA_KEY_DETECTIONS = "detections";

    final Object mLock;

@@ -3646,6 +3647,17 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState

        final ArrayList<FillContext> contexts = mergePreviousSessionLocked( /* forSave= */ true);

        FieldClassificationResponse fieldClassificationResponse =
                mClassificationState.mLastFieldClassificationResponse;
        if (mService.isPccClassificationEnabled()
                && fieldClassificationResponse != null
                && !fieldClassificationResponse.getClassifications().isEmpty()) {
            if (mClientState == null) {
                mClientState = new Bundle();
            }
            mClientState.putParcelableArrayList(EXTRA_KEY_DETECTIONS, new ArrayList<>(
                    fieldClassificationResponse.getClassifications()));
        }
        final SaveRequest saveRequest =
                new SaveRequest(contexts, mClientState, mSelectedDatasetIds);
        mRemoteFillService.onSaveRequest(saveRequest);