diff options
author | Alan Viverette <alanv@google.com> | 2015-06-02 16:11:00 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2015-06-02 16:11:00 -0700 |
commit | a70d4a90a029910f788c3e7f8715cf3b842b1e2b (patch) | |
tree | 9c7e3361c9606a66c9da091b5530809b4161d608 /media | |
parent | 5431000830551959db15038da8f057c2e993d01a (diff) | |
download | frameworks_base-a70d4a90a029910f788c3e7f8715cf3b842b1e2b.zip frameworks_base-a70d4a90a029910f788c3e7f8715cf3b842b1e2b.tar.gz frameworks_base-a70d4a90a029910f788c3e7f8715cf3b842b1e2b.tar.bz2 |
Prevent poorly-extended ParcelableSpans from writing to parcels
If a developer extends an existing ParcelableSpan and overwrites
writeToParcel, TextUtils will crash when attempting to unparcel
since the span type ID is not accurate. This CL makes a separate
framework-private method for writeToParcel to ensure that even if
a developer extends a ParcelableSpan class, they won't modify the
parceling or unparceling code that's tied to the span type ID.
Bug: 21274544
Change-Id: If4c3506a55999df7a3b6d87cb8d550235d7a02c6
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/ClosedCaptionRenderer.java | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/media/java/android/media/ClosedCaptionRenderer.java b/media/java/android/media/ClosedCaptionRenderer.java index e3680e9..8403c1c 100644 --- a/media/java/android/media/ClosedCaptionRenderer.java +++ b/media/java/android/media/ClosedCaptionRenderer.java @@ -1044,42 +1044,26 @@ class CCParser { } /** - * @hide - * - * MutableBackgroundColorSpan - * - * This is a mutable version of BackgroundSpan to facilitate text - * rendering with edge styles. + * Mutable version of BackgroundSpan to facilitate text rendering with edge + * styles. * + * @hide */ -class MutableBackgroundColorSpan extends CharacterStyle - implements UpdateAppearance, ParcelableSpan { +class MutableBackgroundColorSpan extends CharacterStyle implements UpdateAppearance { private int mColor; public MutableBackgroundColorSpan(int color) { mColor = color; } - public MutableBackgroundColorSpan(Parcel src) { - mColor = src.readInt(); - } + public void setBackgroundColor(int color) { mColor = color; } + public int getBackgroundColor() { 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 public void updateDrawState(TextPaint ds) { ds.bgColor = mColor; |