我们有一些运行了很长时间的旧代码:
public static Intent getIntent(PendingIntent pendingIntent) {
Intent intent = null;
try {
Method getIntent = PendingIntent.class.getDeclaredMethod("getIntent");
intent = (Intent) getIntent.invoke(pendingIntent);
} catch (Exception e) {
// Log line
}
return intent;
}
我们现在收到一个安全异常:
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.company.util.IntentUtils.getIntent(IntentUtils.java:160)
Caused by: java.lang.SecurityException: Permission Denial: getIntentForIntentSender() from pid=28128, uid=10127 requires android.permission.GET_INTENT_SENDER_INTENT
at android.os.Parcel.readException(Parcel.java:1683)
at android.os.Parcel.readException(Parcel.java:1636)
at android.app.ActivityManagerProxy.getIntentForIntentSender(ActivityManagerNative.java:5924)
at android.app.PendingIntent.getIntent(PendingIntent.java:987)
... 17 more
看起来这可能与 AOSP 更改有关:https://android.googlesource.com/platform/frameworks/base/+/e5ad41b%5E!/ https://android.googlesource.com/platform/frameworks/base/+/e5ad41b%5E!/
任何帮助实现目的的帮助将不胜感激。
没有解决方法:根据错误消息和提交,从未属于公共 API 的隐藏方法现在需要一个signature
只有使用系统签名的应用程序才能拥有的权限。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)