Loading core/api/current.txt +0 −4 Original line number Diff line number Diff line Loading @@ -47966,7 +47966,6 @@ package android.view { field public static final int AUTOFILL_TYPE_DATE = 4; // 0x4 field public static final int AUTOFILL_TYPE_LIST = 3; // 0x3 field public static final int AUTOFILL_TYPE_NONE = 0; // 0x0 field public static final int AUTOFILL_TYPE_RICH_CONTENT = 5; // 0x5 field public static final int AUTOFILL_TYPE_TEXT = 1; // 0x1 field public static final int AUTOFILL_TYPE_TOGGLE = 2; // 0x2 field public static final int DRAG_FLAG_GLOBAL = 256; // 0x100 Loading Loading @@ -50239,17 +50238,14 @@ package android.view.autofill { method public int describeContents(); method public static android.view.autofill.AutofillValue forDate(long); method public static android.view.autofill.AutofillValue forList(int); method @NonNull public static android.view.autofill.AutofillValue forRichContent(@NonNull android.content.ClipData); method public static android.view.autofill.AutofillValue forText(@Nullable CharSequence); method public static android.view.autofill.AutofillValue forToggle(boolean); method public long getDateValue(); method public int getListValue(); method @NonNull public android.content.ClipData getRichContentValue(); method @NonNull public CharSequence getTextValue(); method public boolean getToggleValue(); method public boolean isDate(); method public boolean isList(); method public boolean isRichContent(); method public boolean isText(); method public boolean isToggle(); method public void writeToParcel(android.os.Parcel, int); core/java/android/view/View.java +0 −12 Original line number Diff line number Diff line Loading @@ -1274,7 +1274,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, AUTOFILL_TYPE_TOGGLE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_RICH_CONTENT }) @Retention(RetentionPolicy.SOURCE) public @interface AutofillType {} Loading Loading @@ -1338,17 +1337,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public static final int AUTOFILL_TYPE_DATE = 4; /** * Autofill type for a field that can accept rich content (text, images, etc). * * <p>{@link AutofillValue} instances for autofilling a {@link View} can be obtained through * {@link AutofillValue#forRichContent(ClipData)}, and the values passed to * autofill a {@link View} can be fetched through {@link AutofillValue#getRichContentValue()}. * * @see #getAutofillType() */ public static final int AUTOFILL_TYPE_RICH_CONTENT = 5; /** @hide */ @IntDef(prefix = { "IMPORTANT_FOR_AUTOFILL_" }, value = { core/java/android/view/autofill/AutofillValue.java +0 −45 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.view.autofill; import static android.view.View.AUTOFILL_TYPE_DATE; import static android.view.View.AUTOFILL_TYPE_LIST; import static android.view.View.AUTOFILL_TYPE_RICH_CONTENT; import static android.view.View.AUTOFILL_TYPE_TEXT; import static android.view.View.AUTOFILL_TYPE_TOGGLE; import static android.view.autofill.Helper.sDebug; Loading @@ -26,7 +25,6 @@ import static android.view.autofill.Helper.sVerbose; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ClipData; import android.os.Looper; import android.os.Parcel; import android.os.Parcelable; Loading Loading @@ -141,28 +139,6 @@ public final class AutofillValue implements Parcelable { return mType == AUTOFILL_TYPE_DATE; } /** * Gets the value to autofill a field that accepts rich content (text, images, etc). * * <p>See {@link View#AUTOFILL_TYPE_RICH_CONTENT} for more info.</p> * * @throws IllegalStateException if the value is not a content value */ public @NonNull ClipData getRichContentValue() { Preconditions.checkState(isRichContent(), "value must be a rich content value, not type=%d", mType); return (ClipData) mValue; } /** * Checks if this is a rich content value (represented by {@link ClipData}). * * <p>See {@link View#AUTOFILL_TYPE_RICH_CONTENT} for more info.</p> */ public boolean isRichContent() { return mType == AUTOFILL_TYPE_RICH_CONTENT; } /** * Used to define whether a field is empty so it's not sent to service on save. * Loading Loading @@ -208,10 +184,6 @@ public final class AutofillValue implements Parcelable { .append(", value="); if (isText()) { Helper.appendRedacted(string, (CharSequence) mValue); } else if (isRichContent()) { string.append("{"); getRichContentValue().getDescription().toShortStringTypesOnly(string); string.append("}"); } else { string.append(mValue); } Loading Loading @@ -244,9 +216,6 @@ public final class AutofillValue implements Parcelable { case AUTOFILL_TYPE_DATE: parcel.writeLong((Long) mValue); break; case AUTOFILL_TYPE_RICH_CONTENT: ((ClipData) mValue).writeToParcel(parcel, flags); break; } } Loading @@ -267,9 +236,6 @@ public final class AutofillValue implements Parcelable { case AUTOFILL_TYPE_DATE: mValue = parcel.readLong(); break; case AUTOFILL_TYPE_RICH_CONTENT: mValue = ClipData.CREATOR.createFromParcel(parcel); break; default: throw new IllegalArgumentException("type=" + mType + " not valid"); } Loading Loading @@ -337,15 +303,4 @@ public final class AutofillValue implements Parcelable { public static AutofillValue forDate(long value) { return new AutofillValue(AUTOFILL_TYPE_DATE, value); } /** * Creates a new {@link AutofillValue} to autofill a {@link View} that accepts rich content * (text, images, etc). * * <p>See {@link View#AUTOFILL_TYPE_RICH_CONTENT} for more info. */ public static @NonNull AutofillValue forRichContent(@NonNull ClipData value) { Objects.requireNonNull(value.getDescription(), "clip description must not be null"); return new AutofillValue(AUTOFILL_TYPE_RICH_CONTENT, value); } } core/java/android/widget/TextView.java +2 −6 Original line number Diff line number Diff line Loading @@ -11862,16 +11862,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener Log.w(LOG_TAG, "cannot autofill non-editable TextView: " + this); return; } final ClipData clip; if (value.isRichContent()) { clip = value.getRichContentValue(); } else if (value.isText()) { clip = ClipData.newPlainText("", value.getTextValue()); } else { if (!value.isText()) { Log.w(LOG_TAG, "value of type " + value.describeContents() + " cannot be autofilled into " + this); return; } final ClipData clip = ClipData.newPlainText("", value.getTextValue()); final ContentInfo payload = new ContentInfo.Builder(clip, SOURCE_AUTOFILL).build(); performReceiveContent(payload); } Loading core/tests/coretests/src/android/view/autofill/AutofillValueTest.java +0 −17 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.view.autofill; import static com.google.common.truth.Truth.assertThat; import android.content.ClipData; import android.os.Parcel; import org.junit.Test; Loading @@ -39,20 +38,4 @@ public class AutofillValueTest { assertThat(result.isText()).isTrue(); assertThat(result.getTextValue()).isEqualTo("hello"); } @Test public void testWriteToParcel_richContent() throws Exception { ClipData clip = ClipData.newPlainText("my label", "hello"); AutofillValue value = AutofillValue.forRichContent(clip); Parcel parcel = Parcel.obtain(); value.writeToParcel(parcel, 0); parcel.setDataPosition(0); AutofillValue result = AutofillValue.CREATOR.createFromParcel(parcel); assertThat(result.isRichContent()).isTrue(); ClipData resultClip = result.getRichContentValue(); assertThat(resultClip.getDescription().getLabel()).isEqualTo("my label"); assertThat(resultClip.getItemAt(0).getText()).isEqualTo("hello"); assertThat(resultClip.getDescription().getMimeType(0)).isEqualTo("text/plain"); } } Loading
core/api/current.txt +0 −4 Original line number Diff line number Diff line Loading @@ -47966,7 +47966,6 @@ package android.view { field public static final int AUTOFILL_TYPE_DATE = 4; // 0x4 field public static final int AUTOFILL_TYPE_LIST = 3; // 0x3 field public static final int AUTOFILL_TYPE_NONE = 0; // 0x0 field public static final int AUTOFILL_TYPE_RICH_CONTENT = 5; // 0x5 field public static final int AUTOFILL_TYPE_TEXT = 1; // 0x1 field public static final int AUTOFILL_TYPE_TOGGLE = 2; // 0x2 field public static final int DRAG_FLAG_GLOBAL = 256; // 0x100 Loading Loading @@ -50239,17 +50238,14 @@ package android.view.autofill { method public int describeContents(); method public static android.view.autofill.AutofillValue forDate(long); method public static android.view.autofill.AutofillValue forList(int); method @NonNull public static android.view.autofill.AutofillValue forRichContent(@NonNull android.content.ClipData); method public static android.view.autofill.AutofillValue forText(@Nullable CharSequence); method public static android.view.autofill.AutofillValue forToggle(boolean); method public long getDateValue(); method public int getListValue(); method @NonNull public android.content.ClipData getRichContentValue(); method @NonNull public CharSequence getTextValue(); method public boolean getToggleValue(); method public boolean isDate(); method public boolean isList(); method public boolean isRichContent(); method public boolean isText(); method public boolean isToggle(); method public void writeToParcel(android.os.Parcel, int);
core/java/android/view/View.java +0 −12 Original line number Diff line number Diff line Loading @@ -1274,7 +1274,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, AUTOFILL_TYPE_TOGGLE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_RICH_CONTENT }) @Retention(RetentionPolicy.SOURCE) public @interface AutofillType {} Loading Loading @@ -1338,17 +1337,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public static final int AUTOFILL_TYPE_DATE = 4; /** * Autofill type for a field that can accept rich content (text, images, etc). * * <p>{@link AutofillValue} instances for autofilling a {@link View} can be obtained through * {@link AutofillValue#forRichContent(ClipData)}, and the values passed to * autofill a {@link View} can be fetched through {@link AutofillValue#getRichContentValue()}. * * @see #getAutofillType() */ public static final int AUTOFILL_TYPE_RICH_CONTENT = 5; /** @hide */ @IntDef(prefix = { "IMPORTANT_FOR_AUTOFILL_" }, value = {
core/java/android/view/autofill/AutofillValue.java +0 −45 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.view.autofill; import static android.view.View.AUTOFILL_TYPE_DATE; import static android.view.View.AUTOFILL_TYPE_LIST; import static android.view.View.AUTOFILL_TYPE_RICH_CONTENT; import static android.view.View.AUTOFILL_TYPE_TEXT; import static android.view.View.AUTOFILL_TYPE_TOGGLE; import static android.view.autofill.Helper.sDebug; Loading @@ -26,7 +25,6 @@ import static android.view.autofill.Helper.sVerbose; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ClipData; import android.os.Looper; import android.os.Parcel; import android.os.Parcelable; Loading Loading @@ -141,28 +139,6 @@ public final class AutofillValue implements Parcelable { return mType == AUTOFILL_TYPE_DATE; } /** * Gets the value to autofill a field that accepts rich content (text, images, etc). * * <p>See {@link View#AUTOFILL_TYPE_RICH_CONTENT} for more info.</p> * * @throws IllegalStateException if the value is not a content value */ public @NonNull ClipData getRichContentValue() { Preconditions.checkState(isRichContent(), "value must be a rich content value, not type=%d", mType); return (ClipData) mValue; } /** * Checks if this is a rich content value (represented by {@link ClipData}). * * <p>See {@link View#AUTOFILL_TYPE_RICH_CONTENT} for more info.</p> */ public boolean isRichContent() { return mType == AUTOFILL_TYPE_RICH_CONTENT; } /** * Used to define whether a field is empty so it's not sent to service on save. * Loading Loading @@ -208,10 +184,6 @@ public final class AutofillValue implements Parcelable { .append(", value="); if (isText()) { Helper.appendRedacted(string, (CharSequence) mValue); } else if (isRichContent()) { string.append("{"); getRichContentValue().getDescription().toShortStringTypesOnly(string); string.append("}"); } else { string.append(mValue); } Loading Loading @@ -244,9 +216,6 @@ public final class AutofillValue implements Parcelable { case AUTOFILL_TYPE_DATE: parcel.writeLong((Long) mValue); break; case AUTOFILL_TYPE_RICH_CONTENT: ((ClipData) mValue).writeToParcel(parcel, flags); break; } } Loading @@ -267,9 +236,6 @@ public final class AutofillValue implements Parcelable { case AUTOFILL_TYPE_DATE: mValue = parcel.readLong(); break; case AUTOFILL_TYPE_RICH_CONTENT: mValue = ClipData.CREATOR.createFromParcel(parcel); break; default: throw new IllegalArgumentException("type=" + mType + " not valid"); } Loading Loading @@ -337,15 +303,4 @@ public final class AutofillValue implements Parcelable { public static AutofillValue forDate(long value) { return new AutofillValue(AUTOFILL_TYPE_DATE, value); } /** * Creates a new {@link AutofillValue} to autofill a {@link View} that accepts rich content * (text, images, etc). * * <p>See {@link View#AUTOFILL_TYPE_RICH_CONTENT} for more info. */ public static @NonNull AutofillValue forRichContent(@NonNull ClipData value) { Objects.requireNonNull(value.getDescription(), "clip description must not be null"); return new AutofillValue(AUTOFILL_TYPE_RICH_CONTENT, value); } }
core/java/android/widget/TextView.java +2 −6 Original line number Diff line number Diff line Loading @@ -11862,16 +11862,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener Log.w(LOG_TAG, "cannot autofill non-editable TextView: " + this); return; } final ClipData clip; if (value.isRichContent()) { clip = value.getRichContentValue(); } else if (value.isText()) { clip = ClipData.newPlainText("", value.getTextValue()); } else { if (!value.isText()) { Log.w(LOG_TAG, "value of type " + value.describeContents() + " cannot be autofilled into " + this); return; } final ClipData clip = ClipData.newPlainText("", value.getTextValue()); final ContentInfo payload = new ContentInfo.Builder(clip, SOURCE_AUTOFILL).build(); performReceiveContent(payload); } Loading
core/tests/coretests/src/android/view/autofill/AutofillValueTest.java +0 −17 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.view.autofill; import static com.google.common.truth.Truth.assertThat; import android.content.ClipData; import android.os.Parcel; import org.junit.Test; Loading @@ -39,20 +38,4 @@ public class AutofillValueTest { assertThat(result.isText()).isTrue(); assertThat(result.getTextValue()).isEqualTo("hello"); } @Test public void testWriteToParcel_richContent() throws Exception { ClipData clip = ClipData.newPlainText("my label", "hello"); AutofillValue value = AutofillValue.forRichContent(clip); Parcel parcel = Parcel.obtain(); value.writeToParcel(parcel, 0); parcel.setDataPosition(0); AutofillValue result = AutofillValue.CREATOR.createFromParcel(parcel); assertThat(result.isRichContent()).isTrue(); ClipData resultClip = result.getRichContentValue(); assertThat(resultClip.getDescription().getLabel()).isEqualTo("my label"); assertThat(resultClip.getItemAt(0).getText()).isEqualTo("hello"); assertThat(resultClip.getDescription().getMimeType(0)).isEqualTo("text/plain"); } }