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

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

Merge "Make CustomDescription safe against crashes"

parents 72c32396 3858aa67
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -36950,7 +36950,7 @@ package android.service.autofill {
    field public static final java.lang.String SERVICE_META_DATA = "android.autofill";
  }
  public final class CharSequenceTransformation implements android.os.Parcelable {
  public final class CharSequenceTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.CharSequenceTransformation> CREATOR;
@@ -37047,7 +37047,7 @@ package android.service.autofill {
    method public android.service.autofill.FillResponse.Builder setSaveInfo(android.service.autofill.SaveInfo);
  }
  public final class ImageTransformation implements android.os.Parcelable {
  public final class ImageTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.ImageTransformation> CREATOR;
+2 −2
Original line number Diff line number Diff line
@@ -40031,7 +40031,7 @@ package android.service.autofill {
    field public static final java.lang.String SERVICE_META_DATA = "android.autofill";
  }
  public final class CharSequenceTransformation implements android.os.Parcelable {
  public final class CharSequenceTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.CharSequenceTransformation> CREATOR;
@@ -40128,7 +40128,7 @@ package android.service.autofill {
    method public android.service.autofill.FillResponse.Builder setSaveInfo(android.service.autofill.SaveInfo);
  }
  public final class ImageTransformation implements android.os.Parcelable {
  public final class ImageTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.ImageTransformation> CREATOR;
+2 −2
Original line number Diff line number Diff line
@@ -37123,7 +37123,7 @@ package android.service.autofill {
    field public static final java.lang.String SERVICE_META_DATA = "android.autofill";
  }
  public final class CharSequenceTransformation implements android.os.Parcelable {
  public final class CharSequenceTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public void apply(android.service.autofill.ValueFinder, android.widget.RemoteViews, int);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
@@ -37221,7 +37221,7 @@ package android.service.autofill {
    method public android.service.autofill.FillResponse.Builder setSaveInfo(android.service.autofill.SaveInfo);
  }
  public final class ImageTransformation implements android.os.Parcelable {
  public final class ImageTransformation implements android.os.Parcelable android.service.autofill.Transformation {
    method public void apply(android.service.autofill.ValueFinder, android.widget.RemoteViews, int);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
+2 −1
Original line number Diff line number Diff line
@@ -55,7 +55,8 @@ import java.util.regex.Pattern;
 *   .addField(ccExpYearId, "^(\\d\\d\\d\\d)$", " / $1");
 * </pre>
 */
public final class CharSequenceTransformation extends InternalTransformation implements Parcelable {
public final class CharSequenceTransformation extends InternalTransformation implements
        Transformation, Parcelable {
    private static final String TAG = "CharSequenceTransformation";
    @NonNull private final ArrayMap<AutofillId, Pair<Pattern, String>> mFields;

+7 −3
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ import com.android.internal.util.Preconditions;
 * <p>See {@link ImageTransformation}, {@link CharSequenceTransformation} for more info about these
 * transformations.
 */
// TODO(b/62534917): add integration tests
public final class CustomDescription implements Parcelable {

    private static final String TAG = "CustomDescription";
@@ -93,7 +92,6 @@ public final class CustomDescription implements Parcelable {

    /** @hide */
    public RemoteViews getPresentation(ValueFinder finder) {
        // TODO(b/62534917): need to handler errors, like not finding the ID
        if (mTransformations != null) {
            final int size = mTransformations.size();
            if (sDebug) Log.d(TAG, "getPresentation(): applying " + size + " transformations");
@@ -101,7 +99,13 @@ public final class CustomDescription implements Parcelable {
                final int id = mTransformations.keyAt(i);
                final InternalTransformation transformation = mTransformations.valueAt(i);
                if (sDebug) Log.d(TAG, "#" + i + ": " + transformation);

                try {
                    transformation.apply(finder, mPresentation, id);
                } catch (Exception e) {
                    Log.e(TAG, "Could not apply transformation " + transformation + ". "
                            + e.getClass());
                }
            }
        }
        return mPresentation;
Loading