From 2373682ff3cbe3d25233fef8b0622c4c84d25111 Mon Sep 17 00:00:00 2001 From: Simranjit Kohli Date: Mon, 22 May 2023 11:21:31 -0700 Subject: [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 --- .../autofill/java/com/android/server/autofill/Session.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 0a8f474fd4cc..c83f5784a97a 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -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 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); -- cgit v1.2.3-59-g8ed1b