Loading core/java/android/app/assist/AssistStructure.java +2 −2 Original line number Diff line number Diff line Loading @@ -1559,14 +1559,14 @@ public class AssistStructure implements Parcelable { @Override public void setText(CharSequence text) { ViewNodeText t = getNodeText(); t.mText = text; t.mText = TextUtils.trimNoCopySpans(text); t.mTextSelectionStart = t.mTextSelectionEnd = -1; } @Override public void setText(CharSequence text, int selectionStart, int selectionEnd) { ViewNodeText t = getNodeText(); t.mText = text; t.mText = TextUtils.trimNoCopySpans(text); t.mTextSelectionStart = selectionStart; t.mTextSelectionEnd = selectionEnd; } Loading core/java/android/text/TextUtils.java +16 −0 Original line number Diff line number Diff line Loading @@ -1921,6 +1921,22 @@ public class TextUtils { return false; } /** * If the {@code charSequence} is instance of {@link Spanned}, creates a new copy and * {@link NoCopySpan}'s are removed from the copy. Otherwise the given {@code charSequence} is * returned as it is. * * @hide */ @Nullable public static CharSequence trimNoCopySpans(@Nullable CharSequence charSequence) { if (charSequence != null && charSequence instanceof Spanned) { // SpannableStringBuilder copy constructor trims NoCopySpans. return new SpannableStringBuilder(charSequence); } return charSequence; } private static Object sLock = new Object(); private static char[] sTemp = null; Loading core/java/android/view/autofill/AutofillValue.java +3 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.view.View; import com.android.internal.util.Preconditions; Loading Loading @@ -257,7 +258,8 @@ public final class AutofillValue implements Parcelable { * <p>See {@link View#AUTOFILL_TYPE_TEXT} for more info. */ public static AutofillValue forText(@Nullable CharSequence value) { return value == null ? null : new AutofillValue(AUTOFILL_TYPE_TEXT, value); return value == null ? null : new AutofillValue(AUTOFILL_TYPE_TEXT, TextUtils.trimNoCopySpans(value)); } /** Loading Loading
core/java/android/app/assist/AssistStructure.java +2 −2 Original line number Diff line number Diff line Loading @@ -1559,14 +1559,14 @@ public class AssistStructure implements Parcelable { @Override public void setText(CharSequence text) { ViewNodeText t = getNodeText(); t.mText = text; t.mText = TextUtils.trimNoCopySpans(text); t.mTextSelectionStart = t.mTextSelectionEnd = -1; } @Override public void setText(CharSequence text, int selectionStart, int selectionEnd) { ViewNodeText t = getNodeText(); t.mText = text; t.mText = TextUtils.trimNoCopySpans(text); t.mTextSelectionStart = selectionStart; t.mTextSelectionEnd = selectionEnd; } Loading
core/java/android/text/TextUtils.java +16 −0 Original line number Diff line number Diff line Loading @@ -1921,6 +1921,22 @@ public class TextUtils { return false; } /** * If the {@code charSequence} is instance of {@link Spanned}, creates a new copy and * {@link NoCopySpan}'s are removed from the copy. Otherwise the given {@code charSequence} is * returned as it is. * * @hide */ @Nullable public static CharSequence trimNoCopySpans(@Nullable CharSequence charSequence) { if (charSequence != null && charSequence instanceof Spanned) { // SpannableStringBuilder copy constructor trims NoCopySpans. return new SpannableStringBuilder(charSequence); } return charSequence; } private static Object sLock = new Object(); private static char[] sTemp = null; Loading
core/java/android/view/autofill/AutofillValue.java +3 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.view.View; import com.android.internal.util.Preconditions; Loading Loading @@ -257,7 +258,8 @@ public final class AutofillValue implements Parcelable { * <p>See {@link View#AUTOFILL_TYPE_TEXT} for more info. */ public static AutofillValue forText(@Nullable CharSequence value) { return value == null ? null : new AutofillValue(AUTOFILL_TYPE_TEXT, value); return value == null ? null : new AutofillValue(AUTOFILL_TYPE_TEXT, TextUtils.trimNoCopySpans(value)); } /** Loading