100mslive/100ms-flutter

Crash: live.hms.hmssdk_flutter.views.HMSVideoView.onAttachedToWindow

Jai05-techie opened this issue ยท 14 comments

We are currently encountering a crash that has been reported in Firebase on Android OS 14.

Plugin,

hmssdk_flutter: ^1.7.5

Screenshot 2024-01-21 at 10 01 46โ€ฏAM
One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

Fatal Exception: java.lang.SecurityException: com.myapplication: 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:3087)
       at android.os.Parcel.createException(Parcel.java:3071)
       at android.os.Parcel.readException(Parcel.java:3054)
       at android.os.Parcel.readException(Parcel.java:2996)
       at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684)
       at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1860)
       at android.app.ContextImpl.registerReceiver(ContextImpl.java:1796)
       at android.app.ContextImpl.registerReceiver(ContextImpl.java:1784)
       at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:765)
       at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:765)
       at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:765)
       at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:765)
       at live.hms.hmssdk_flutter.views.HMSVideoView.onAttachedToWindow(:35)
       at android.view.View.dispatchAttachedToWindow(View.java:22235)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3543)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3550)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3550)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3550)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3550)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3550)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3349)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2730)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10100)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1552)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1561)
       at android.view.Choreographer.doCallbacks(Choreographer.java:1117)
       at android.view.Choreographer.doFrame(Choreographer.java:1002)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1535)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:257)
       at android.os.Looper.loop(Looper.java:368)
       at android.app.ActivityThread.main(ActivityThread.java:8821)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)


Caused by android.os.RemoteException
Remote stack trace: at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14845) at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2985) at android.os.Binder.execTransactInternal(Binder.java:1387) at android.os.Binder.execTransact(Binder.java:1299)


Caused by android.os.RemoteException: Remote stack trace:
	at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14845)
	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2985)
	at android.os.Binder.execTransactInternal(Binder.java:1387)
	at android.os.Binder.execTransact(Binder.java:1299)

Hello! Thank you for filing an issue.

Please include relevant logs or detailed description for faster resolutions.

We really appreciate your contribution!

Yes, I have included the logs and identified the specific device where this crash is occurring as well.

Hi @Jai05-techie is this only happening on android 14 ?

@Decoder07 Yes, this issue is occurring on Android OS 14. While we have a significant number of users on Android 11, 12, and 13, they have not been affected. We've observed that this new crash is specific to Android OS 14 and during runtime.

@Decoder07 It appears that the Android version is higher than Tiramisu. We need to register the receiver with RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED based on whether the broadcast receiver should receive from other apps or not.

Please take a look at this similar issue. https://stackoverflow.com/a/77276774/10688995

Thanks @Jai05-techie will check this and share the updates.

Hey @Jai05-techie can you try out hmssdk_flutter package from github branch. Just update your pubspec.yaml to below:

hmssdk_flutter: 
   git:
      url: https://github.com/100mslive/100ms-flutter.git
      path: packages/hmssdk_flutter
      ref: broadcast-receiver-fix

Let us know if this fixes your issue.

ygit commented

@Jai05-techie Were you able to resolve this issue?

Hi, @Decoder07 @ygit am trying it today. Will update you by EOD.

Hi @Decoder07 @ygit,
We have tested the broadcast receiver fix with the reference "broadcast-receiver-fix" on two devices running Android OS 14, specifically Oneplus and Google Pixel. We did not encounter any crashes during the video call. It appears that the issue has been successfully resolved.

ygit commented

@Jai05-techie Also check on non-Android 14 devices i.e. devices with Android 9, 11, 12, 13, etc

@ygit We conducted testing on Android versions 13 and 14, and no issues were encountered. Unfortunately, we do not have devices running OS versions lower than 13 for further testing.

ygit commented

alright

ygit commented

A fix for this was released in version 1.9.8
Closing this issue now.