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

Commit 601d2200 authored by Felipe Leme's avatar Felipe Leme
Browse files

Minor improvements on autofill javadocs and logging.

Test: m update-api
Bug: 69456547

Change-Id: I2cab6d7d6ecbe7c1842a5be37af923dd20355b73
parent 911fbd23
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -216,7 +216,12 @@ public final class Dataset implements Parcelable {
        }

        /**
         * Requires a dataset authentication before autofilling the activity with this dataset.
         * Triggers a custom UI before before autofilling the screen with the contents of this
         * dataset.
         *
         * <p><b>Note:</b> Although the name of this method suggests that it should be used just for
         * authentication flow, it can be used for other advanced flows; see {@link AutofillService}
         * for examples.
         *
         * <p>This method is called when you need to provide an authentication
         * UI for the data set. For example, when a data set contains credit card information
@@ -335,9 +340,11 @@ public final class Dataset implements Parcelable {
        /**
         * Sets the value of a field using an <a href="#Filtering">explicit filter</a>.
         *
         * <p>This method is typically used when the dataset is not authenticated and the field
         * value is not {@link AutofillValue#isText() text} but the service still wants to allow
         * the user to filter it out.
         * <p>This method is typically used when the dataset is authenticated and the service
         * does not know its value but wants to hide the dataset after the user enters a minimum
         * number of characters. For example, if the dataset represents a credit card number and the
         * service does not want to show the "Tap to authenticate" message until the user tapped
         * 4 digits, in which case the filter would be {@code Pattern.compile("\\d.{4,}")}.
         *
         * @param id id returned by {@link
         *         android.app.assist.AssistStructure.ViewNode#getAutofillId()}.
@@ -364,11 +371,11 @@ public final class Dataset implements Parcelable {
         * Sets the value of a field, using a custom {@link RemoteViews presentation} to
         * visualize it and a <a href="#Filtering">explicit filter</a>.
         *
         * <p>Typically used to allow filtering on
         * {@link Dataset.Builder#setAuthentication(IntentSender) authenticated datasets}. For
         * example, if the dataset represents a credit card number and the service does not want to
         * show the "Tap to authenticate" message until the user tapped 4 digits, in which case
         * the filter would be {@code Pattern.compile("\\d.{4,}")}.
         * <p>This method is typically used when the dataset is authenticated and the service
         * does not know its value but wants to hide the dataset after the user enters a minimum
         * number of characters. For example, if the dataset represents a credit card number and the
         * service does not want to show the "Tap to authenticate" message until the user tapped
         * 4 digits, in which case the filter would be {@code Pattern.compile("\\d.{4,}")}.
         *
         * @param id id returned by {@link
         *         android.app.assist.AssistStructure.ViewNode#getAutofillId()}.
+6 −2
Original line number Diff line number Diff line
@@ -180,8 +180,12 @@ public final class FillResponse implements Parcelable {
        private boolean mDestroyed;

        /**
         * Requires a fill response authentication before autofilling the screen with
         * any data set in this response.
         * Triggers a custom UI before before autofilling the screen with any data set in this
         * response.
         *
         * <p><b>Note:</b> Although the name of this method suggests that it should be used just for
         * authentication flow, it can be used for other advanced flows; see {@link AutofillService}
         * for examples.
         *
         * <p>This is typically useful when a user interaction is required to unlock their
         * data vault if you encrypt the data set labels and data set data. It is recommended
+6 −6
Original line number Diff line number Diff line
@@ -599,9 +599,9 @@ public final class SaveInfo implements Parcelable {
         * credit card number:
         *
         * <pre class="prettyprint">
         * builder.addSanitizer(
         *     new TextValueSanitizer(Pattern.compile("^(\\d{4}\s?\\d{4}\s?\\d{4}\s?\\d{4})$"),
         *         "$1$2$3$4"), ccNumberId);
         * builder.addSanitizer(new TextValueSanitizer(
         *     Pattern.compile("^(\\d{4})\\s?(\\d{4})\\s?(\\d{4})\\s?(\\d{4})$", "$1$2$3$4")),
         *     ccNumberId);
         * </pre>
         *
         * <p>The same sanitizer can be reused to sanitize multiple fields. For example, to trim
@@ -614,9 +614,9 @@ public final class SaveInfo implements Parcelable {
         * </pre>
         *
         * <p>The sanitizer can also be used as an alternative for a
         * {@link #setValidator(Validator) validator}&mdashif any of the {@code ids} is a
         * {@link #SaveInfo.Builder(int, AutofillId[]) required id} and the {@code sanitizer} fail
         * for it, then the save UI is not shown.
         * {@link #setValidator(Validator) validator}. If any of the {@code ids} is a
         * {@link #SaveInfo.Builder(int, AutofillId[]) required id} and the {@code sanitizer} fails
         * because of it, then the save UI is not shown.
         *
         * @param sanitizer an implementation provided by the Android System.
         * @param ids id of fields whose value will be sanitized.
+2 −1
Original line number Diff line number Diff line
@@ -37,7 +37,8 @@ import java.util.regex.Pattern;
 * <p>For example, to remove spaces from groups of 4-digits in a credit card:
 *
 * <pre class="prettyprint">
 * new TextValueSanitizer(Pattern.compile("^(\\d{4}\s?\\d{4}\s?\\d{4}\s?\\d{4})$"), "$1$2$3$4")
 * new TextValueSanitizer(Pattern.compile("^(\\d{4})\\s?(\\d{4})\\s?(\\d{4})\\s?(\\d{4})$",
 *     "$1$2$3$4")
 * </pre>
 */
public final class TextValueSanitizer extends InternalSanitizer implements
+2 −0
Original line number Diff line number Diff line
@@ -908,6 +908,7 @@ public final class AutofillManager {
        }
        synchronized (mLock) {
            if (mSaveOnFinish) {
                if (sDebug) Log.d(TAG, "Committing session on finish() as requested by service");
                commitLocked();
            } else {
                if (sDebug) Log.d(TAG, "Cancelling session on finish() as requested by service");
@@ -955,6 +956,7 @@ public final class AutofillManager {
     * methods such as {@link android.app.Activity#finish()}.
     */
    public void cancel() {
        if (sVerbose) Log.v(TAG, "cancel() called by app");
        if (!hasAutofillFeature()) {
            return;
        }