Skip to content

Crash on Android 14 devices #12

@jintoga

Description

@jintoga

Hello! I recently increased our app's targetSdk to 34. And the app crashes on devices with android 14.

java.lang.SecurityException: 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:3183)
at android.os.Parcel.createException(Parcel.java:3167)
at android.os.Parcel.readException(Parcel.java:3150)
at android.os.Parcel.readException(Parcel.java:3092)
at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5860)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1853)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1793)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1781)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:757)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:757)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:757)
at co.nimblehq.recentapps.thumbnailhiding.HardwareKeyWatcher.startWatch(HardwareKeyWatcher.java:37)
at co.nimblehq.recentapps.thumbnailhiding.RecentAppsThumbnailHidingLifecycleTracker.onActivityStarted(RecentAppsThumbnailHidingLifecycleTracker.kt:51)
at android.app.Application.dispatchActivityStarted(Application.java:401)
at android.app.Activity.dispatchActivityStarted(Activity.java:1548)
at android.app.Activity.onStart(Activity.java:2087)

It seems like the problem here is Android 14 requires flag RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED for the registerReceiver method. And class HardwareKeyWatcher doesn't provide such flag in method startWatch()

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions