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

Commit d8416b7e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "New Autofill API: SaveInfo.addSanitizer()"

parents 4b9646b3 cd2969c8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -37225,6 +37225,9 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.RegexValidator> CREATOR;
  }
  public abstract interface Sanitizer {
  }
  public final class SaveCallback {
    method public void onFailure(java.lang.CharSequence);
    method public void onSuccess();
@@ -37248,6 +37251,7 @@ package android.service.autofill {
  public static final class SaveInfo.Builder {
    ctor public SaveInfo.Builder(int, android.view.autofill.AutofillId[]);
    ctor public SaveInfo.Builder(int);
    method public android.service.autofill.SaveInfo.Builder addSanitizer(android.service.autofill.Sanitizer, android.view.autofill.AutofillId...);
    method public android.service.autofill.SaveInfo build();
    method public android.service.autofill.SaveInfo.Builder setCustomDescription(android.service.autofill.CustomDescription);
    method public android.service.autofill.SaveInfo.Builder setDescription(java.lang.CharSequence);
@@ -37266,6 +37270,13 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveRequest> CREATOR;
  }
  public final class TextValueSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
    ctor public TextValueSanitizer(java.util.regex.Pattern, java.lang.String);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.TextValueSanitizer> CREATOR;
  }
  public abstract interface Transformation {
  }
+11 −0
Original line number Diff line number Diff line
@@ -40321,6 +40321,9 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.RegexValidator> CREATOR;
  }
  public abstract interface Sanitizer {
  }
  public final class SaveCallback {
    method public void onFailure(java.lang.CharSequence);
    method public void onSuccess();
@@ -40344,6 +40347,7 @@ package android.service.autofill {
  public static final class SaveInfo.Builder {
    ctor public SaveInfo.Builder(int, android.view.autofill.AutofillId[]);
    ctor public SaveInfo.Builder(int);
    method public android.service.autofill.SaveInfo.Builder addSanitizer(android.service.autofill.Sanitizer, android.view.autofill.AutofillId...);
    method public android.service.autofill.SaveInfo build();
    method public android.service.autofill.SaveInfo.Builder setCustomDescription(android.service.autofill.CustomDescription);
    method public android.service.autofill.SaveInfo.Builder setDescription(java.lang.CharSequence);
@@ -40362,6 +40366,13 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveRequest> CREATOR;
  }
  public final class TextValueSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
    ctor public TextValueSanitizer(java.util.regex.Pattern, java.lang.String);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.TextValueSanitizer> CREATOR;
  }
  public abstract interface Transformation {
  }
+16 −0
Original line number Diff line number Diff line
@@ -37501,6 +37501,10 @@ package android.service.autofill {
    method public android.service.autofill.ImageTransformation build();
  }
  public abstract class InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
    ctor public InternalSanitizer();
  }
  public final class LuhnChecksumValidator implements android.os.Parcelable android.service.autofill.Validator {
    ctor public LuhnChecksumValidator(android.view.autofill.AutofillId...);
    method public int describeContents();
@@ -37517,6 +37521,9 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.RegexValidator> CREATOR;
  }
  public abstract interface Sanitizer {
  }
  public final class SaveCallback {
    method public void onFailure(java.lang.CharSequence);
    method public void onSuccess();
@@ -37540,6 +37547,7 @@ package android.service.autofill {
  public static final class SaveInfo.Builder {
    ctor public SaveInfo.Builder(int, android.view.autofill.AutofillId[]);
    ctor public SaveInfo.Builder(int);
    method public android.service.autofill.SaveInfo.Builder addSanitizer(android.service.autofill.Sanitizer, android.view.autofill.AutofillId...);
    method public android.service.autofill.SaveInfo build();
    method public android.service.autofill.SaveInfo.Builder setCustomDescription(android.service.autofill.CustomDescription);
    method public android.service.autofill.SaveInfo.Builder setDescription(java.lang.CharSequence);
@@ -37558,6 +37566,14 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveRequest> CREATOR;
  }
  public final class TextValueSanitizer extends android.service.autofill.InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
    ctor public TextValueSanitizer(java.util.regex.Pattern, java.lang.String);
    method public int describeContents();
    method public android.view.autofill.AutofillValue sanitize(android.view.autofill.AutofillValue);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.TextValueSanitizer> CREATOR;
  }
  public abstract interface Transformation {
  }
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.service.autofill;

import android.annotation.NonNull;
import android.annotation.TestApi;
import android.os.Parcelable;
import android.view.autofill.AutofillValue;

/**
 * Superclass of all sanitizers the system understands. As this is not public all public subclasses
 * have to implement {@link Sanitizer} again.
 *
 * @hide
 */
@TestApi
public abstract class InternalSanitizer implements Sanitizer, Parcelable {

    /**
     * Sanitizes an {@link AutofillValue}.
     *
     * @hide
     */
    public abstract AutofillValue sanitize(@NonNull AutofillValue value);
}
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.service.autofill;

/**
 * Helper class used to sanitize user input before using it in a save request.
 *
 * <p>Typically used to avoid displaying the save UI for values that are autofilled but reformatted
 * by the app&mdash;for example, if the autofill service sends a credit card number
 * value as "004815162342108" and the app automatically changes it to "0048 1516 2342 108".
 */
public interface Sanitizer {
}
Loading