frameworks/base
リビジョン | 820614a394f75ea7f82dbc63029da8dcf43cb8a4 (tree) |
---|---|
日時 | 2020-11-06 08:32:38 |
作者 | Julia Reynolds <juliacr@goog...> |
コミッター | syphyr |
Sanitize more of the notification text fields
Test: manual; monitor SystemUI performance when an app tries to
post a messaging style notification with messages with long text
Bug: 158304295
Bug: 147358092
Merged-In: c953fdf6bc498ca791aed49df04e5a07c935b63a
Change-Id: I0e2ea12fc3351b1a56645b556720ea2306f5422a
(cherry picked from commit c953fdf6bc498ca791aed49df04e5a07c935b63a)
(cherry picked from commit a19f9ed2b1c04fe7e73bab1a8ca51400dbf8a07a)
@@ -154,7 +154,7 @@ public class Notification implements Parcelable | ||
154 | 154 | * <p> |
155 | 155 | * Avoids spamming the system with overly large strings such as full e-mails. |
156 | 156 | */ |
157 | - private static final int MAX_CHARSEQUENCE_LENGTH = 5 * 1024; | |
157 | + private static final int MAX_CHARSEQUENCE_LENGTH = 1024; | |
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Maximum entries of reply text that are accepted by Builder and friends. |
@@ -4973,7 +4973,7 @@ public class Notification implements Parcelable | ||
4973 | 4973 | * consistent during re-posts of the notification. |
4974 | 4974 | */ |
4975 | 4975 | public Message(CharSequence text, long timestamp, CharSequence sender){ |
4976 | - mText = text; | |
4976 | + mText = safeCharSequence(text); | |
4977 | 4977 | mTimestamp = timestamp; |
4978 | 4978 | mSender = sender; |
4979 | 4979 | } |
@@ -5055,7 +5055,7 @@ public class Notification implements Parcelable | ||
5055 | 5055 | } |
5056 | 5056 | bundle.putLong(KEY_TIMESTAMP, mTimestamp); |
5057 | 5057 | if (mSender != null) { |
5058 | - bundle.putCharSequence(KEY_SENDER, mSender); | |
5058 | + bundle.putCharSequence(KEY_SENDER, safeCharSequence(mSender)); | |
5059 | 5059 | } |
5060 | 5060 | if (mDataMimeType != null) { |
5061 | 5061 | bundle.putString(KEY_DATA_MIME_TYPE, mDataMimeType); |