From 33681a94cff6b48bcf82fda1fcb53b8cf7cd38fe Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Fri, 28 Jul 2017 09:14:38 -0700 Subject: [PATCH] Cherry-picked some Autofill Javadoc improvements from master. Test: m update-api Bug: 64125551 Bug: 63669555 Bug: 63985284 Merged-in: Iba4817f682670e9fd6d891ae221e1fa415252e99 Change-Id: I82cbb54a522b2cf1dfb11aacc9735c932aa9af90 --- .../android/service/autofill/FillResponse.java | 7 +++++++ .../android/view/autofill/AutofillManager.java | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/core/java/android/service/autofill/FillResponse.java b/core/java/android/service/autofill/FillResponse.java index e13fdf68c831a..80ef3aa9ebea3 100644 --- a/core/java/android/service/autofill/FillResponse.java +++ b/core/java/android/service/autofill/FillResponse.java @@ -205,6 +205,13 @@ public final class FillResponse implements Parcelable { /** * Adds a new {@link Dataset} to this response. * + *

Note: the total number of datasets is limited by the Binder transaction size, + * so it's recommended to keep it small (in the range of 10-20 at most) and use pagination + * by adding a fake + * {@link Dataset.Builder#setAuthentication(IntentSender) authenticated dataset} + * at the end with a presentation string like "Next 10" that would return a new + * {@link FillResponse} with the next 10 datasets, and so on. + * * @return This builder. */ public @NonNull Builder addDataset(@Nullable Dataset dataset) { diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index e1e8317d8ccb1..3505c2900beeb 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -671,8 +671,13 @@ public final class AutofillManager { /** * Called to indicate the current autofill context should be commited. * - *

For example, when a virtual view is rendering an {@code HTML} page with a form, it should - * call this method after the form is submitted and another page is rendered. + *

This method is typically called by {@link View Views} that manage virtual views; for + * example, when the view is rendering an {@code HTML} page with a form and virtual views + * that represent the HTML elements, it should call this method after the form is submitted and + * another page is rendered. + * + *

Note: This method does not need to be called on regular application lifecycle + * methods such as {@link android.app.Activity#finish()}. */ public void commit() { if (!hasAutofillFeature()) { @@ -690,8 +695,13 @@ public final class AutofillManager { /** * Called to indicate the current autofill context should be cancelled. * - *

For example, when a virtual view is rendering an {@code HTML} page with a form, it should - * call this method if the user does not post the form but moves to another form in this page. + *

This method is typically called by {@link View Views} that manage virtual views; for + * example, when the view is rendering an {@code HTML} page with a form and virtual views + * that represent the HTML elements, it should call this method if the user does not post the + * form but moves to another form in this page. + * + *

Note: This method does not need to be called on regular application lifecycle + * methods such as {@link android.app.Activity#finish()}. */ public void cancel() { if (!hasAutofillFeature()) {