am 52999685: Merge "Prevent poorly-extended ParcelableSpans from writing to parcels" into mnc-dev
* commit '52999685178656caba37fa0e9055ac26d707bdce': Prevent poorly-extended ParcelableSpans from writing to parcels
This commit is contained in:
@@ -38,6 +38,11 @@ public class Annotation implements ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.ANNOTATION;
|
return TextUtils.ANNOTATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,6 +51,11 @@ public class Annotation implements ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeString(mKey);
|
dest.writeString(mKey);
|
||||||
dest.writeString(mValue);
|
dest.writeString(mValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.text;
|
package android.text;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,5 +28,21 @@ public interface ParcelableSpan extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Return a special type identifier for this span class.
|
* Return a special type identifier for this span class.
|
||||||
*/
|
*/
|
||||||
public abstract int getSpanTypeId();
|
int getSpanTypeId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal implementation of {@link #getSpanTypeId()} that is not meant to
|
||||||
|
* be overridden outside of the framework.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
int getSpanTypeIdInternal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal implementation of {@link Parcelable#writeToParcel(Parcel, int)}
|
||||||
|
* that is not meant to be overridden outside of the framework.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
void writeToParcelInternal(Parcel dest, int flags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -622,8 +622,7 @@ public class TextUtils {
|
|||||||
* Flatten a CharSequence and whatever styles can be copied across processes
|
* Flatten a CharSequence and whatever styles can be copied across processes
|
||||||
* into the parcel.
|
* into the parcel.
|
||||||
*/
|
*/
|
||||||
public static void writeToParcel(CharSequence cs, Parcel p,
|
public static void writeToParcel(CharSequence cs, Parcel p, int parcelableFlags) {
|
||||||
int parcelableFlags) {
|
|
||||||
if (cs instanceof Spanned) {
|
if (cs instanceof Spanned) {
|
||||||
p.writeInt(0);
|
p.writeInt(0);
|
||||||
p.writeString(cs.toString());
|
p.writeString(cs.toString());
|
||||||
@@ -645,15 +644,15 @@ public class TextUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prop instanceof ParcelableSpan) {
|
if (prop instanceof ParcelableSpan) {
|
||||||
ParcelableSpan ps = (ParcelableSpan)prop;
|
final ParcelableSpan ps = (ParcelableSpan) prop;
|
||||||
int spanTypeId = ps.getSpanTypeId();
|
final int spanTypeId = ps.getSpanTypeIdInternal();
|
||||||
if (spanTypeId < FIRST_SPAN || spanTypeId > LAST_SPAN) {
|
if (spanTypeId < FIRST_SPAN || spanTypeId > LAST_SPAN) {
|
||||||
Log.e(TAG, "external class \"" + ps.getClass().getSimpleName()
|
Log.e(TAG, "External class \"" + ps.getClass().getSimpleName()
|
||||||
+ "\" is attempting to use the frameworks-only ParcelableSpan"
|
+ "\" is attempting to use the frameworks-only ParcelableSpan"
|
||||||
+ " interface");
|
+ " interface");
|
||||||
} else {
|
} else {
|
||||||
p.writeInt(spanTypeId);
|
p.writeInt(spanTypeId);
|
||||||
ps.writeToParcel(p, parcelableFlags);
|
ps.writeToParcelInternal(p, parcelableFlags);
|
||||||
writeWhere(p, sp, o);
|
writeWhere(p, sp, o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ public class AbsoluteSizeSpan extends MetricAffectingSpan implements ParcelableS
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.ABSOLUTE_SIZE_SPAN;
|
return TextUtils.ABSOLUTE_SIZE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +62,11 @@ public class AbsoluteSizeSpan extends MetricAffectingSpan implements ParcelableS
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mSize);
|
dest.writeInt(mSize);
|
||||||
dest.writeInt(mDip ? 1 : 0);
|
dest.writeInt(mDip ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,9 @@ import android.text.ParcelableSpan;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
public interface AlignmentSpan extends ParagraphStyle {
|
public interface AlignmentSpan extends ParagraphStyle {
|
||||||
public Layout.Alignment getAlignment();
|
Layout.Alignment getAlignment();
|
||||||
|
|
||||||
public static class Standard
|
class Standard implements AlignmentSpan, ParcelableSpan {
|
||||||
implements AlignmentSpan, ParcelableSpan {
|
|
||||||
public Standard(Layout.Alignment align) {
|
public Standard(Layout.Alignment align) {
|
||||||
mAlignment = align;
|
mAlignment = align;
|
||||||
}
|
}
|
||||||
@@ -35,6 +34,11 @@ public interface AlignmentSpan extends ParagraphStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.ALIGNMENT_SPAN;
|
return TextUtils.ALIGNMENT_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +47,11 @@ public interface AlignmentSpan extends ParagraphStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeString(mAlignment.name());
|
dest.writeString(mAlignment.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ public class BackgroundColorSpan extends CharacterStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.BACKGROUND_COLOR_SPAN;
|
return TextUtils.BACKGROUND_COLOR_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +48,11 @@ public class BackgroundColorSpan extends CharacterStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mColor);
|
dest.writeInt(mColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ public class BulletSpan implements LeadingMarginSpan, ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.BULLET_SPAN;
|
return TextUtils.BULLET_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +73,11 @@ public class BulletSpan implements LeadingMarginSpan, ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mGapWidth);
|
dest.writeInt(mGapWidth);
|
||||||
dest.writeInt(mWantColor ? 1 : 0);
|
dest.writeInt(mWantColor ? 1 : 0);
|
||||||
dest.writeInt(mColor);
|
dest.writeInt(mColor);
|
||||||
|
|||||||
@@ -91,12 +91,22 @@ public class EasyEditSpan implements ParcelableSpan {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeParcelable(mPendingIntent, 0);
|
dest.writeParcelable(mPendingIntent, 0);
|
||||||
dest.writeByte((byte) (mDeleteEnabled ? 1 : 0));
|
dest.writeByte((byte) (mDeleteEnabled ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.EASY_EDIT_SPAN;
|
return TextUtils.EASY_EDIT_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ public class ForegroundColorSpan extends CharacterStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.FOREGROUND_COLOR_SPAN;
|
return TextUtils.FOREGROUND_COLOR_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +49,11 @@ public class ForegroundColorSpan extends CharacterStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mColor);
|
dest.writeInt(mColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,11 @@ extends ParagraphStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.LEADING_MARGIN_SPAN;
|
return TextUtils.LEADING_MARGIN_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,6 +138,11 @@ extends ParagraphStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mFirst);
|
dest.writeInt(mFirst);
|
||||||
dest.writeInt(mRest);
|
dest.writeInt(mRest);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ public class LocaleSpan extends MetricAffectingSpan implements ParcelableSpan {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.LOCALE_SPAN;
|
return TextUtils.LOCALE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,6 +59,11 @@ public class LocaleSpan extends MetricAffectingSpan implements ParcelableSpan {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeString(mLocale.getLanguage());
|
dest.writeString(mLocale.getLanguage());
|
||||||
dest.writeString(mLocale.getCountry());
|
dest.writeString(mLocale.getCountry());
|
||||||
dest.writeString(mLocale.getVariant());
|
dest.writeString(mLocale.getVariant());
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ public class QuoteSpan implements LeadingMarginSpan, ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.QUOTE_SPAN;
|
return TextUtils.QUOTE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +58,11 @@ public class QuoteSpan implements LeadingMarginSpan, ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mColor);
|
dest.writeInt(mColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ public class RelativeSizeSpan extends MetricAffectingSpan implements ParcelableS
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.RELATIVE_SIZE_SPAN;
|
return TextUtils.RELATIVE_SIZE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +47,11 @@ public class RelativeSizeSpan extends MetricAffectingSpan implements ParcelableS
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeFloat(mProportion);
|
dest.writeFloat(mProportion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ public class ScaleXSpan extends MetricAffectingSpan implements ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.SCALE_X_SPAN;
|
return TextUtils.SCALE_X_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +47,11 @@ public class ScaleXSpan extends MetricAffectingSpan implements ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeFloat(mProportion);
|
dest.writeFloat(mProportion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,11 +54,21 @@ public class SpellCheckSpan implements ParcelableSpan {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mSpellCheckInProgress ? 1 : 0);
|
dest.writeInt(mSpellCheckInProgress ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.SPELL_CHECK_SPAN;
|
return TextUtils.SPELL_CHECK_SPAN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ public class StrikethroughSpan extends CharacterStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.STRIKETHROUGH_SPAN;
|
return TextUtils.STRIKETHROUGH_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +43,11 @@ public class StrikethroughSpan extends CharacterStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ public class StyleSpan extends MetricAffectingSpan implements ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.STYLE_SPAN;
|
return TextUtils.STYLE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +63,11 @@ public class StyleSpan extends MetricAffectingSpan implements ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mStyle);
|
dest.writeInt(mStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ public class SubscriptSpan extends MetricAffectingSpan implements ParcelableSpan
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.SUBSCRIPT_SPAN;
|
return TextUtils.SUBSCRIPT_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +42,11 @@ public class SubscriptSpan extends MetricAffectingSpan implements ParcelableSpan
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -46,11 +46,21 @@ public class SuggestionRangeSpan extends CharacterStyle implements ParcelableSpa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeInt(mBackgroundColor);
|
dest.writeInt(mBackgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.SUGGESTION_RANGE_SPAN;
|
return TextUtils.SUGGESTION_RANGE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,11 @@ public class SuggestionSpan extends CharacterStyle implements ParcelableSpan {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeStringArray(mSuggestions);
|
dest.writeStringArray(mSuggestions);
|
||||||
dest.writeInt(mFlags);
|
dest.writeInt(mFlags);
|
||||||
dest.writeString(mLocaleString);
|
dest.writeString(mLocaleString);
|
||||||
@@ -264,6 +269,11 @@ public class SuggestionSpan extends CharacterStyle implements ParcelableSpan {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.SUGGESTION_SPAN;
|
return TextUtils.SUGGESTION_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ public class SuperscriptSpan extends MetricAffectingSpan implements ParcelableSp
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.SUPERSCRIPT_SPAN;
|
return TextUtils.SUPERSCRIPT_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +42,11 @@ public class SuperscriptSpan extends MetricAffectingSpan implements ParcelableSp
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -136,6 +136,11 @@ public class TextAppearanceSpan extends MetricAffectingSpan implements Parcelabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.TEXT_APPEARANCE_SPAN;
|
return TextUtils.TEXT_APPEARANCE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,6 +149,11 @@ public class TextAppearanceSpan extends MetricAffectingSpan implements Parcelabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeString(mTypeface);
|
dest.writeString(mTypeface);
|
||||||
dest.writeInt(mStyle);
|
dest.writeInt(mStyle);
|
||||||
dest.writeInt(mTextSize);
|
dest.writeInt(mTextSize);
|
||||||
|
|||||||
@@ -495,12 +495,22 @@ public class TtsSpan implements ParcelableSpan {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeString(mType);
|
dest.writeString(mType);
|
||||||
dest.writePersistableBundle(mArgs);
|
dest.writePersistableBundle(mArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.TTS_SPAN;
|
return TextUtils.TTS_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ public class TypefaceSpan extends MetricAffectingSpan implements ParcelableSpan
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.TYPEFACE_SPAN;
|
return TextUtils.TYPEFACE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +55,11 @@ public class TypefaceSpan extends MetricAffectingSpan implements ParcelableSpan
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeString(mFamily);
|
dest.writeString(mFamily);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ public class URLSpan extends ClickableSpan implements ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.URL_SPAN;
|
return TextUtils.URL_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +53,11 @@ public class URLSpan extends ClickableSpan implements ParcelableSpan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
dest.writeString(mURL);
|
dest.writeString(mURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ public class UnderlineSpan extends CharacterStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSpanTypeId() {
|
public int getSpanTypeId() {
|
||||||
|
return getSpanTypeIdInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public int getSpanTypeIdInternal() {
|
||||||
return TextUtils.UNDERLINE_SPAN;
|
return TextUtils.UNDERLINE_SPAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,6 +43,11 @@ public class UnderlineSpan extends CharacterStyle
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
writeToParcelInternal(dest, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public void writeToParcelInternal(Parcel dest, int flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1044,42 +1044,26 @@ class CCParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Mutable version of BackgroundSpan to facilitate text rendering with edge
|
||||||
|
* styles.
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*
|
|
||||||
* MutableBackgroundColorSpan
|
|
||||||
*
|
|
||||||
* This is a mutable version of BackgroundSpan to facilitate text
|
|
||||||
* rendering with edge styles.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class MutableBackgroundColorSpan extends CharacterStyle
|
class MutableBackgroundColorSpan extends CharacterStyle implements UpdateAppearance {
|
||||||
implements UpdateAppearance, ParcelableSpan {
|
|
||||||
private int mColor;
|
private int mColor;
|
||||||
|
|
||||||
public MutableBackgroundColorSpan(int color) {
|
public MutableBackgroundColorSpan(int color) {
|
||||||
mColor = color;
|
mColor = color;
|
||||||
}
|
}
|
||||||
public MutableBackgroundColorSpan(Parcel src) {
|
|
||||||
mColor = src.readInt();
|
|
||||||
}
|
|
||||||
public void setBackgroundColor(int color) {
|
public void setBackgroundColor(int color) {
|
||||||
mColor = color;
|
mColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBackgroundColor() {
|
public int getBackgroundColor() {
|
||||||
return mColor;
|
return mColor;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public int getSpanTypeId() {
|
|
||||||
return TextUtils.BACKGROUND_COLOR_SPAN;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(mColor);
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDrawState(TextPaint ds) {
|
public void updateDrawState(TextPaint ds) {
|
||||||
ds.bgColor = mColor;
|
ds.bgColor = mColor;
|
||||||
|
|||||||
Reference in New Issue
Block a user