• 关于SecurityException RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED


    关于SecurityException RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED

    https://github.com/android/play-billing-samples/issues/618

    https://issuetracker.google.com/issues/277822279

    java.lang.SecurityException: com.mercandalli.android.apps.sample: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
    1. Caused by: java.lang.SecurityException: com.mercandalli.android.apps.sample: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
    2. at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
    3. at android.os.Parcel.createException(Parcel.java:3041)
    4. at android.os.Parcel.readException(Parcel.java:3024)
    5. at android.os.Parcel.readException(Parcel.java:2966)
    6. at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5372)
    7. at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1851)
    8. at android.app.ContextImpl.registerReceiver(ContextImpl.java:1791)
    9. at android.app.ContextImpl.registerReceiver(ContextImpl.java:1779)
    10. at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:754)
    11. at com.android.billingclient.api.zzn.zzc(com.android.billingclient:billing@@5.2.0:1)
    12. at com.android.billingclient.api.zzo.zze(com.android.billingclient:billing@@5.2.0:3)
    13. at com.android.billingclient.api.BillingClientImpl.startConnection(com.android.billingclient:billing@@5.2.0:36)

    这个例子里,是调用到

    IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5393)

    在server端写入了Exception,

    查看源码 https://cs.android.com/?hl=zh-cn

    frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java

    1. // Don't enforce the flag check if we're EITHER registering for only protected
    2. // broadcasts, or the receiver is null (a sticky broadcast). Sticky broadcasts should
    3. // not be used generally, so we will be marking them as exported by default
    4. final boolean requireExplicitFlagForDynamicReceivers = CompatChanges.isChangeEnabled(
    5. DYNAMIC_RECEIVER_EXPLICIT_EXPORT_REQUIRED, callingUid);
    6. if (!onlyProtectedBroadcasts) {
    7. if (receiver == null && !explicitExportStateDefined) {
    8. // sticky broadcast, no flag specified (flag isn't required)
    9. flags |= Context.RECEIVER_EXPORTED;
    10. } else if (requireExplicitFlagForDynamicReceivers && !explicitExportStateDefined) {
    11. throw new SecurityException(
    12. callerPackage + ": One of RECEIVER_EXPORTED or "
    13. + "RECEIVER_NOT_EXPORTED should be specified when a receiver "
    14. + "isn't being registered exclusively for system broadcasts");
    15. // Assume default behavior-- flag check is not enforced
    16. } else if (!requireExplicitFlagForDynamicReceivers && (

    可以根据抛异常的原因去分析处理

  • 相关阅读:
    第7章——链接
    服务器数据恢复-EMC存储磁盘损坏的RAID5数据恢复案例
    Linux:时间指令 - cal & date
    【github】初学者使用指南
    西部数据硬盘查询
    会议OA项目之我的会议排座&批审功能
    分布式事务——分布式事务简介、分布式事务框架 Seata(AT模式、Tcc模式、Tcc Vs AT)、分布式事务—MQ
    STL 中的string 容器方法与API
    BGP联盟实验
    R语言鸢尾花iris数据集的层次聚类分析
  • 原文地址:https://blog.csdn.net/aaajj/article/details/132723975