mattprecious / telescope

A simple tool to allow easy bug report capturing within your app.
Apache License 2.0
1.18k stars 116 forks source link

SecurityException: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified #82

Closed dpreussler closed 8 months ago

dpreussler commented 8 months ago

is not usable on Android 14 anymore as of :

Runtime-registered broadcasts receivers must specify export behavior Apps and services that target Android 14 and use context-registered receivers are required to specify a flag to indicate whether or not the receiver should be exported to all other apps on the device: either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED, respectively. This requirement helps protect apps from security vulnerabilities by leveraging the features for these receivers introduced in Android 13. https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

Fatal Exception: java.lang.SecurityException: com.soundcloud.android: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
       at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
       at android.os.Parcel.createException(Parcel.java:3053)
       at android.os.Parcel.readException(Parcel.java:3036)
       at android.os.Parcel.readException(Parcel.java:2978)
       at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6137)
       at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1913)
       at android.app.ContextImpl.registerReceiver(ContextImpl.java:1853)
       at android.app.ContextImpl.registerReceiver(ContextImpl.java:1841)
       at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
       at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
       at com.mattprecious.telescope.TelescopeLayout.registerRequestCaptureReceiver(TelescopeLayout.java:593)
       at com.mattprecious.telescope.TelescopeLayout.trigger(TelescopeLayout.java:413)
mattprecious commented 8 months ago

Thanks! I'll try to take a look soon. PRs are welcome, though.

dpreussler commented 8 months ago

couldnt get the project to run... otherwise would have opened a PR 🙈 change is quite simple, sth like that:

  private void registerRequestCaptureReceiver() {
    if (SDK_INT >= Build.VERSION_CODES.O) {
      getContext().registerReceiver(requestCaptureReceiver, requestCaptureFilter, RECEIVER_NOT_EXPORTED);
    } else {
      getContext().registerReceiver(requestCaptureReceiver, requestCaptureFilter);
    }
  }
dpreussler commented 7 months ago

@mattprecious any idea when to get a new release?

mattprecious commented 7 months ago

2.3.0 has been released.