Loading core/java/android/service/autofill/Dataset.java +23 −20 Original line number Diff line number Diff line Loading @@ -123,47 +123,50 @@ public final class Dataset implements Parcelable { */ public static final int PICK_REASON_UNKNOWN = 0; /** * This dataset is picked because of autofill provider detection was chosen. * This dataset is picked because pcc wasn't enabled. * @hide */ public static final int PICK_REASON_AUTOFILL_PROVIDER_DETECTION = 1; public static final int PICK_REASON_NO_PCC = 1; /** * This dataset is picked because of PCC detection was chosen. * This dataset is picked because provider gave this dataset. * @hide */ public static final int PICK_REASON_PCC_DETECTION = 2; public static final int PICK_REASON_PROVIDER_DETECTION_ONLY = 2; /** * This dataset is picked because of Framework detection was chosen. * This dataset is picked because provider detection was preferred. However, provider also made * this dataset available for PCC detected types, so they could've been picked up by PCC * detection. This however doesn't imply that this dataset would've been chosen for sure. For * eg, if PCC Detection was preferred, and PCC detected other field types, which wasn't * applicable to this dataset, it wouldn't have been shown. * @hide */ public static final int PICK_REASON_FRAMEWORK_DETECTION = 3; public static final int PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC = 3; /** * This dataset is picked because of Autofill Provider being a fallback. * This dataset is picked because of PCC detection was chosen. * @hide */ public static final int PICK_REASON_AUTOFILL_PROVIDER_FALLBACK = 4; public static final int PICK_REASON_PCC_DETECTION_ONLY = 4; /** * This dataset is picked because of PCC detection being a fallback. * This dataset is picked because of PCC Detection was preferred. However, Provider also gave * this dataset, so if PCC wasn't enabled, this dataset would've been eligible anyway. * @hide */ public static final int PICK_REASON_PCC_DETECTION_FALLBACK = 5; public static final int PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER = 5; /** * This dataset is picked because of Framework detection being a fallback. * Reason why the dataset was eligible for autofill. * @hide */ public static final int PICK_REASON_FRAMEWORK_FALLBACK = 6; @IntDef(prefix = { "PICK_REASON_" }, value = { PICK_REASON_UNKNOWN, PICK_REASON_AUTOFILL_PROVIDER_DETECTION, PICK_REASON_PCC_DETECTION, PICK_REASON_FRAMEWORK_DETECTION, PICK_REASON_AUTOFILL_PROVIDER_FALLBACK, PICK_REASON_PCC_DETECTION_FALLBACK, PICK_REASON_FRAMEWORK_FALLBACK, PICK_REASON_NO_PCC, PICK_REASON_PROVIDER_DETECTION_ONLY, PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC, PICK_REASON_PCC_DETECTION_ONLY, PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER, }) @Retention(RetentionPolicy.SOURCE) @interface DatasetEligibleReason{} public @interface DatasetEligibleReason{} private @DatasetEligibleReason int mEligibleReason; Loading services/autofill/java/com/android/server/autofill/Session.java +26 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,12 @@ package com.android.server.autofill; import static android.Manifest.permission.PROVIDE_OWN_AUTOFILL_SUGGESTIONS; import static android.service.autofill.AutofillFieldClassificationService.EXTRA_SCORES; import static android.service.autofill.AutofillService.EXTRA_FILL_RESPONSE; import static android.service.autofill.Dataset.PICK_REASON_NO_PCC; import static android.service.autofill.Dataset.PICK_REASON_PCC_DETECTION_ONLY; import static android.service.autofill.Dataset.PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER; import static android.service.autofill.Dataset.PICK_REASON_PROVIDER_DETECTION_ONLY; import static android.service.autofill.Dataset.PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC; import static android.service.autofill.Dataset.PICK_REASON_UNKNOWN; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_DIALOG; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_INLINE; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_MENU; Loading Loading @@ -124,6 +130,7 @@ import android.service.autofill.AutofillFieldClassificationService.Scores; import android.service.autofill.AutofillService; import android.service.autofill.CompositeUserData; import android.service.autofill.Dataset; import android.service.autofill.Dataset.DatasetEligibleReason; import android.service.autofill.FieldClassification; import android.service.autofill.FieldClassification.Match; import android.service.autofill.FieldClassificationUserData; Loading Loading @@ -1798,6 +1805,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState private void computeDatasetsForProviderAndUpdateContainer( FillResponse response, DatasetComputationContainer container) { @DatasetEligibleReason int globalPickReason = PICK_REASON_UNKNOWN; boolean isPccEnabled = mService.isPccClassificationEnabled(); if (isPccEnabled) { globalPickReason = PICK_REASON_PROVIDER_DETECTION_ONLY; } else { globalPickReason = PICK_REASON_NO_PCC; } List<Dataset> datasets = response.getDatasets(); if (datasets == null) return; ArrayMap<AutofillId, Set<Dataset>> autofillIdToDatasetMap = new ArrayMap<>(); Loading @@ -1805,6 +1819,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Set<AutofillId> eligibleAutofillIds = new ArraySet<>(); for (Dataset dataset : response.getDatasets()) { if (dataset.getFieldIds() == null || dataset.getFieldIds().isEmpty()) continue; @DatasetEligibleReason int pickReason = globalPickReason; if (dataset.getAutofillDatatypes() != null && !dataset.getAutofillDatatypes().isEmpty()) { // This dataset has information relevant for detection too, so we should filter Loading @@ -1827,6 +1842,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (newSize == 0) continue; if (conversionRequired) { pickReason = PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC; ArrayList<AutofillId> fieldIds = new ArrayList<>(newSize); ArrayList<AutofillValue> fieldValues = new ArrayList<>(newSize); ArrayList<RemoteViews> fieldPresentations = new ArrayList<>(newSize); Loading Loading @@ -1870,6 +1886,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState dataset.getAuthentication()); } } dataset.setEligibleReasonReason(pickReason); eligibleDatasets.add(dataset); for (AutofillId id : dataset.getFieldIds()) { eligibleAutofillIds.add(id); Loading Loading @@ -1905,6 +1922,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Set<AutofillId> eligibleAutofillIds = new ArraySet<>(); for (int i = 0; i < datasets.size(); i++) { @DatasetEligibleReason int pickReason = PICK_REASON_PCC_DETECTION_ONLY; Dataset dataset = datasets.get(i); if (dataset.getAutofillDatatypes() == null || dataset.getAutofillDatatypes().isEmpty()) continue; Loading @@ -1919,7 +1938,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Set<AutofillId> datasetAutofillIds = new ArraySet<>(); for (int j = 0; j < dataset.getAutofillDatatypes().size(); j++) { if (dataset.getAutofillDatatypes().get(j) == null) continue; if (dataset.getAutofillDatatypes().get(j) == null) { if (dataset.getFieldIds() != null && dataset.getFieldIds().get(j) != null) { pickReason = PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER; } continue; } String hint = dataset.getAutofillDatatypes().get(j); if (hintsToAutofillIdMap.containsKey(hint)) { Loading Loading @@ -1966,6 +1990,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState null, dataset.getId(), dataset.getAuthentication()); dataset.setEligibleReasonReason(pickReason); eligibleDatasets.add(newDataset); Set<Dataset> newDatasets; for (AutofillId autofillId : datasetAutofillIds) { Loading Loading
core/java/android/service/autofill/Dataset.java +23 −20 Original line number Diff line number Diff line Loading @@ -123,47 +123,50 @@ public final class Dataset implements Parcelable { */ public static final int PICK_REASON_UNKNOWN = 0; /** * This dataset is picked because of autofill provider detection was chosen. * This dataset is picked because pcc wasn't enabled. * @hide */ public static final int PICK_REASON_AUTOFILL_PROVIDER_DETECTION = 1; public static final int PICK_REASON_NO_PCC = 1; /** * This dataset is picked because of PCC detection was chosen. * This dataset is picked because provider gave this dataset. * @hide */ public static final int PICK_REASON_PCC_DETECTION = 2; public static final int PICK_REASON_PROVIDER_DETECTION_ONLY = 2; /** * This dataset is picked because of Framework detection was chosen. * This dataset is picked because provider detection was preferred. However, provider also made * this dataset available for PCC detected types, so they could've been picked up by PCC * detection. This however doesn't imply that this dataset would've been chosen for sure. For * eg, if PCC Detection was preferred, and PCC detected other field types, which wasn't * applicable to this dataset, it wouldn't have been shown. * @hide */ public static final int PICK_REASON_FRAMEWORK_DETECTION = 3; public static final int PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC = 3; /** * This dataset is picked because of Autofill Provider being a fallback. * This dataset is picked because of PCC detection was chosen. * @hide */ public static final int PICK_REASON_AUTOFILL_PROVIDER_FALLBACK = 4; public static final int PICK_REASON_PCC_DETECTION_ONLY = 4; /** * This dataset is picked because of PCC detection being a fallback. * This dataset is picked because of PCC Detection was preferred. However, Provider also gave * this dataset, so if PCC wasn't enabled, this dataset would've been eligible anyway. * @hide */ public static final int PICK_REASON_PCC_DETECTION_FALLBACK = 5; public static final int PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER = 5; /** * This dataset is picked because of Framework detection being a fallback. * Reason why the dataset was eligible for autofill. * @hide */ public static final int PICK_REASON_FRAMEWORK_FALLBACK = 6; @IntDef(prefix = { "PICK_REASON_" }, value = { PICK_REASON_UNKNOWN, PICK_REASON_AUTOFILL_PROVIDER_DETECTION, PICK_REASON_PCC_DETECTION, PICK_REASON_FRAMEWORK_DETECTION, PICK_REASON_AUTOFILL_PROVIDER_FALLBACK, PICK_REASON_PCC_DETECTION_FALLBACK, PICK_REASON_FRAMEWORK_FALLBACK, PICK_REASON_NO_PCC, PICK_REASON_PROVIDER_DETECTION_ONLY, PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC, PICK_REASON_PCC_DETECTION_ONLY, PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER, }) @Retention(RetentionPolicy.SOURCE) @interface DatasetEligibleReason{} public @interface DatasetEligibleReason{} private @DatasetEligibleReason int mEligibleReason; Loading
services/autofill/java/com/android/server/autofill/Session.java +26 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,12 @@ package com.android.server.autofill; import static android.Manifest.permission.PROVIDE_OWN_AUTOFILL_SUGGESTIONS; import static android.service.autofill.AutofillFieldClassificationService.EXTRA_SCORES; import static android.service.autofill.AutofillService.EXTRA_FILL_RESPONSE; import static android.service.autofill.Dataset.PICK_REASON_NO_PCC; import static android.service.autofill.Dataset.PICK_REASON_PCC_DETECTION_ONLY; import static android.service.autofill.Dataset.PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER; import static android.service.autofill.Dataset.PICK_REASON_PROVIDER_DETECTION_ONLY; import static android.service.autofill.Dataset.PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC; import static android.service.autofill.Dataset.PICK_REASON_UNKNOWN; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_DIALOG; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_INLINE; import static android.service.autofill.FillEventHistory.Event.UI_TYPE_MENU; Loading Loading @@ -124,6 +130,7 @@ import android.service.autofill.AutofillFieldClassificationService.Scores; import android.service.autofill.AutofillService; import android.service.autofill.CompositeUserData; import android.service.autofill.Dataset; import android.service.autofill.Dataset.DatasetEligibleReason; import android.service.autofill.FieldClassification; import android.service.autofill.FieldClassification.Match; import android.service.autofill.FieldClassificationUserData; Loading Loading @@ -1798,6 +1805,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState private void computeDatasetsForProviderAndUpdateContainer( FillResponse response, DatasetComputationContainer container) { @DatasetEligibleReason int globalPickReason = PICK_REASON_UNKNOWN; boolean isPccEnabled = mService.isPccClassificationEnabled(); if (isPccEnabled) { globalPickReason = PICK_REASON_PROVIDER_DETECTION_ONLY; } else { globalPickReason = PICK_REASON_NO_PCC; } List<Dataset> datasets = response.getDatasets(); if (datasets == null) return; ArrayMap<AutofillId, Set<Dataset>> autofillIdToDatasetMap = new ArrayMap<>(); Loading @@ -1805,6 +1819,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Set<AutofillId> eligibleAutofillIds = new ArraySet<>(); for (Dataset dataset : response.getDatasets()) { if (dataset.getFieldIds() == null || dataset.getFieldIds().isEmpty()) continue; @DatasetEligibleReason int pickReason = globalPickReason; if (dataset.getAutofillDatatypes() != null && !dataset.getAutofillDatatypes().isEmpty()) { // This dataset has information relevant for detection too, so we should filter Loading @@ -1827,6 +1842,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (newSize == 0) continue; if (conversionRequired) { pickReason = PICK_REASON_PROVIDER_DETECTION_PREFERRED_WITH_PCC; ArrayList<AutofillId> fieldIds = new ArrayList<>(newSize); ArrayList<AutofillValue> fieldValues = new ArrayList<>(newSize); ArrayList<RemoteViews> fieldPresentations = new ArrayList<>(newSize); Loading Loading @@ -1870,6 +1886,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState dataset.getAuthentication()); } } dataset.setEligibleReasonReason(pickReason); eligibleDatasets.add(dataset); for (AutofillId id : dataset.getFieldIds()) { eligibleAutofillIds.add(id); Loading Loading @@ -1905,6 +1922,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Set<AutofillId> eligibleAutofillIds = new ArraySet<>(); for (int i = 0; i < datasets.size(); i++) { @DatasetEligibleReason int pickReason = PICK_REASON_PCC_DETECTION_ONLY; Dataset dataset = datasets.get(i); if (dataset.getAutofillDatatypes() == null || dataset.getAutofillDatatypes().isEmpty()) continue; Loading @@ -1919,7 +1938,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Set<AutofillId> datasetAutofillIds = new ArraySet<>(); for (int j = 0; j < dataset.getAutofillDatatypes().size(); j++) { if (dataset.getAutofillDatatypes().get(j) == null) continue; if (dataset.getAutofillDatatypes().get(j) == null) { if (dataset.getFieldIds() != null && dataset.getFieldIds().get(j) != null) { pickReason = PICK_REASON_PCC_DETECTION_PREFERRED_WITH_PROVIDER; } continue; } String hint = dataset.getAutofillDatatypes().get(j); if (hintsToAutofillIdMap.containsKey(hint)) { Loading Loading @@ -1966,6 +1990,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState null, dataset.getId(), dataset.getAuthentication()); dataset.setEligibleReasonReason(pickReason); eligibleDatasets.add(newDataset); Set<Dataset> newDatasets; for (AutofillId autofillId : datasetAutofillIds) { Loading