我想修改SDK中Notification.class
中int的值。这可能吗?这可以实现吗?
这是我要修改的int,覆盖:
public class Notification implements Parcelable {
.......
/**
* Maximum length of CharSequences accepted by Builder and friends.
*
* <p>
* Avoids spamming the system with overly large strings such as full e-mails.
*/
private static final int MAX_CHARSEQUENCE_LENGTH = 10 * 1024;
/**
... 或者,我想从同一个类重写此方法:
/**
* Make sure this CharSequence is safe to put into a bundle, which basically
* means it had better not be some custom Parcelable implementation.
* @hide
*/
public static CharSequence safeCharSequence(CharSequence cs) {
if (cs == null) return cs;
if (cs.length() > MAX_CHARSEQUENCE_LENGTH) {
cs = cs.subSequence(0, MAX_CHARSEQUENCE_LENGTH);
}
if (cs instanceof Parcelable) {
Log.e(TAG, "warning: " + cs.getClass().getCanonicalName()
+ " instance is a custom Parcelable and not allowed in Notification");
return cs.toString();
}
return removeTextSizeSpans(cs);
}
答案 0 :(得分:2)
这可能吗?
在您自己的自定义ROM中?是。
在Android应用中?不可以。更准确地说,除了根设备之外,您无法从应用中影响safeCharSequence()
。