diff options
author | Felipe Leme <felipeal@google.com> | 2018-03-30 16:27:11 -0700 |
---|---|---|
committer | Felipe Leme <felipeal@google.com> | 2018-03-30 16:32:07 -0700 |
commit | 8937157e0df49de5e2f6cdfbf21272aea2e5b9ac (patch) | |
tree | b3dfbefcf591e3fc7e4fcf286d326917fb38cdbf /input/autofill/AutofillFramework | |
parent | b1e0caf022f6fb264a4407888b5d33352b8eb2dd (diff) | |
download | android-8937157e0df49de5e2f6cdfbf21272aea2e5b9ac.tar.gz |
Don't trigger manual dataset pick up when service finds autofillable items.
Test: manual verification
Bug: 71907097
Change-Id: I917c03383dd0803d8aabb8a00f15deca5762a46d
Diffstat (limited to 'input/autofill/AutofillFramework')
-rw-r--r-- | input/autofill/AutofillFramework/afservice/src/main/java/com/example/android/autofill/service/MyAutofillService.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/input/autofill/AutofillFramework/afservice/src/main/java/com/example/android/autofill/service/MyAutofillService.java b/input/autofill/AutofillFramework/afservice/src/main/java/com/example/android/autofill/service/MyAutofillService.java index ace2cefe..e9cdd6ca 100644 --- a/input/autofill/AutofillFramework/afservice/src/main/java/com/example/android/autofill/service/MyAutofillService.java +++ b/input/autofill/AutofillFramework/afservice/src/main/java/com/example/android/autofill/service/MyAutofillService.java @@ -147,15 +147,7 @@ public class MyAutofillService extends AutofillService { private void fetchDataAndGenerateResponse( HashMap<String, FieldTypeWithHeuristics> fieldTypesByAutofillHint, boolean responseAuth, boolean datasetAuth, boolean manual, FillCallback callback) { - if (manual) { - IntentSender sender = ManualActivity.getManualIntentSenderForResponse(this); - RemoteViews remoteViews = RemoteViewsHelper.viewsWithNoAuth(getPackageName(), - getString(R.string.autofill_manual_prompt)); - FillResponse response = mResponseAdapter.buildManualResponse(sender, remoteViews); - if (response != null) { - callback.onSuccess(response); - } - } else if (responseAuth) { + if (responseAuth) { // If the entire Autofill Response is authenticated, AuthActivity is used // to generate Response. IntentSender sender = AuthActivity.getAuthIntentSenderForResponse(this); @@ -170,9 +162,22 @@ public class MyAutofillService extends AutofillService { new DataCallback<List<DatasetWithFilledAutofillFields>>() { @Override public void onLoaded(List<DatasetWithFilledAutofillFields> datasets) { - FillResponse response = mResponseAdapter.buildResponse( - fieldTypesByAutofillHint, datasets, datasetAuth); - callback.onSuccess(response); + if ((datasets == null || datasets.isEmpty()) && manual) { + IntentSender sender = ManualActivity + .getManualIntentSenderForResponse(MyAutofillService.this); + RemoteViews remoteViews = RemoteViewsHelper.viewsWithNoAuth( + getPackageName(), + getString(R.string.autofill_manual_prompt)); + FillResponse response = mResponseAdapter.buildManualResponse(sender, + remoteViews); + if (response != null) { + callback.onSuccess(response); + } + } else { + FillResponse response = mResponseAdapter.buildResponse( + fieldTypesByAutofillHint, datasets, datasetAuth); + callback.onSuccess(response); + } } @Override |