summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorNikita Dubrovsky <dubrovsky@google.com>2021-01-07 04:56:24 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-01-07 04:56:24 +0000
commit22a635fb25ca09727b06a0284a2d89fdf1b961df (patch)
tree90f5acba11e5b5c6f379a76deaf3fcc58fe8ebbc /core/java
parent1d8bab6106c23658e6e5349ed89a2cf94adafa70 (diff)
parent7c2e5bb7c5e6ee426ad05cca5d70b1bc7d6be11c (diff)
Merge "Remove AUTOFILL_TYPE_RICH_CONTENT and related code"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/View.java12
-rw-r--r--core/java/android/view/autofill/AutofillValue.java45
-rw-r--r--core/java/android/widget/TextView.java8
3 files changed, 2 insertions, 63 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 24b71abe5bc1..0f5321548f95 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -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 {}
@@ -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 = {
diff --git a/core/java/android/view/autofill/AutofillValue.java b/core/java/android/view/autofill/AutofillValue.java
index e92c30fcbc3b..f5eef3513e30 100644
--- a/core/java/android/view/autofill/AutofillValue.java
+++ b/core/java/android/view/autofill/AutofillValue.java
@@ -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;
@@ -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;
@@ -142,28 +140,6 @@ public final class AutofillValue implements Parcelable {
}
/**
- * 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.
*
* <p>Only applies to some types, like text.
@@ -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);
}
@@ -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;
}
}
@@ -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");
}
@@ -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);
- }
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 977a0e89a143..4edfc5f309b2 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -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);
}