dji-sdk / Mobile-SDK-Android

DJI Mobile SDK for Android: http://developer.dji.com/mobile-sdk/
Other
972 stars 580 forks source link

java.lang.SecurityException registerReceiver crash on Android 14 #1256

Open shaji-Dev opened 7 months ago

shaji-Dev commented 7 months ago

The library is crashing on registerApp.

With Android 14, registerReceiver() now has a required field, Context.RECEIVER_EXPORTED or Context.RECEIVER_NOT_EXPORTED.

Please add this parameter to your context.registerReceiver() calls so we can use the library in Android 14. Thank you.

Usind versions:

implementation('com.dji:dji-sdk:4.17') {
  exclude module: 'library-anti-distortion'
  exclude module: 'fly-safe-database'
}
compileOnly ('com.dji:dji-sdk-provided:4.17')
implementation ('com.dji:dji-uxsdk:4.16.2')

Log:

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: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 dji.midware.usb.P3.UsbAccessoryService.registerAoaReceiver(Unknown Source:75)
                                                                                                        at dji.midware.dgh.fdd(Unknown Source:42)
                                                                                                        at dji.sdksharedlib.fdd.fdd(Unknown Source:6)
                                                                                                        at dji.sdk.sdkmanager.DJISDKManager.initParams(Unknown Source:15)
                                                                                                        at dji.sdk.sdkmanager.DJISDKManager.initSDKManager(Unknown Source:27)
                                                                                                        at dji.sdk.sdkmanager.DJISDKManager.registerApp(Unknown Source:37)
                                                                                                        at dji.sdk.sdkmanager.DJISDKManager.access$1400(Unknown Source:0)
                                                                                                        at dji.sdk.sdkmanager.DJISDKManager$8.onDownloadSuccess(Unknown Source:6)
                                                                                                        at dji.internal.jhg.fdd.fdd(Unknown Source:19)
                                                                                                        at dji.sdk.sdkmanager.DJISDKManager.lambda$registerApp$2(Unknown Source:27)
                                                                                                        at dji.sdk.sdkmanager.DJISDKManager$$Lambda$4.run(Unknown Source:2)
                                                                                                        at dji.sdksharedlib.dgh.dgh$fdd.run(Unknown Source:5)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                        at java.lang.Thread.run(Thread.java:1012)
dji-dev commented 7 months ago

Agent comment from yating.liao in Zendesk ticket #94778:

The issue you are experiencing seems to be a new requirement introduced by Android 14 regarding broadcast reception. However, please note that the current version, 4.17, is only compatible with Android 13. To learn more about the new features introduced in Android 14, you can visit the following link: https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

°°°

shaji-Dev commented 7 months ago

I know that, but is there any plans to update this version to be compatible with Android 14? It seems to be a simple fix, I think you only have one line of context.registerReceiver() in your SDK which is when registerApp is called, you just need to add the Context.RECEIVER_EXPORTED or Context.RECEIVER_NOT_EXPORTED flag.

Android 14 is starting to roll out and it doesn't make sense that most our users would have their app not supported anymore because of a simple fix.

Thank you.

dji-dev commented 7 months ago

Agent comment from yating.liao in Zendesk ticket #94778:

MSDK will continue to strive for compatibility with more Android devices, but the current version cannot set the targetVersion to Android 14. If it is urgent for you, can you please let us know the reason? I will provide this feedback to the team.

°°°

shaji-Dev commented 7 months ago

I think I explained the urgency, most of our users have had the Android OS update popup and some have updated to Android 14 without realizing that the app will not work if they update, and as you know the problem is they cannot rollback to version 13 in their devices. So now there's no way they can use the app on their device unless the MSDK supports Android 14 because they cannot go back to Android 13, making their devices useless at the moment.

I think the fix should be simple enough to support Android 14, it seems that the error is coming from that line of code I mentioned earlier, please inform your team to try and target Android 14 (34) as this is urgent for our business, we have client complaints because of this issue that we cannot resolve for them, maybe a MSDK quick fix release to the alpha channel for now?

Thank you.

dji-dev commented 7 months ago

Agent comment from yating.liao in Zendesk ticket #94778:

You can submit your requirements through this address(https://sdk-forum.dji.net/hc/en-us/requests/new). If possible, we would appreciate it if you could let us know the industry you are in and provide some background information about your company. We will collect user requirements through this channel, and the communication here can only be viewed internally.

°°°

shaji-Dev commented 7 months ago

I submitted the request as you suggested (ID #95053).

Unfortunately I cannot provide information about the company through this channel as our products are not for commercial use.

Thank you.

dji-dev commented 7 months ago

Agent comment from yating.liao in Zendesk ticket #94778:

We have received your new issue and will proceed to address your concerns. However, please note that all SDK requirements need to go through a team review before we can determine the scheduling. Therefore, we are unable to decide on the SDK development plan.

°°°

andrewdittmer commented 6 months ago

+1 This bug is accounting for over 60% of our app crashes. I really hope this can be addressed soon. Thank you.

Padreco-lbr commented 4 months ago

+1 The longer this bug takes to be fixed, the more clients you will be dismissing/frustrating. Please fix this as soon as possible.

Sugar666666tang commented 4 months ago

这是来自QQ邮箱的自动回复邮件。   您好,您的邮件我已收到。

shaji-Dev commented 3 months ago

Any news on a fix for this?

Padreco-lbr commented 1 month ago

Please, provide any kind of feedback for the sdk developers and companies depending on you. This is a major blocker since Android 14 usage is growing rapidly.