gpt4 book ai didi

android - 如何覆盖/修改 sdk 中的值或方法?

转载 作者:行者123 更新时间:2023-11-29 18:59:12 28 4
gpt4 key购买 nike

我想修改SDK中Notification.class中一个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);
}

最佳答案

Is this possible?

在您自己的自定义 ROM 中?是的。

在 Android 应用中?不。更准确地说,您无法通过您的应用程序影响 safeCharSequence(),除非是在已获得 root 权限的设备上。

关于android - 如何覆盖/修改 sdk 中的值或方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49394230/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com