OneSignal / OneSignal-Unity-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Unity app with OneSignal. https://onesignal.com
Other
222 stars 61 forks source link

[Bug]: com.onesignal.FocusTimeController.getTimeFocusedElapsed #621

Open shefich opened 1 year ago

shefich commented 1 year ago

What happened?

Devices: Samsung, Motorola, Huawei, General Mobile. OSs: Android 8, 10, 12, 13.

Steps to reproduce?

1. Don't know how

What did you expect to happen?

I expected not to see these crashes

Unity version

2021.2.12 (latest)

OneSignal Unity SDK version

3.0.10

Platform

Android

Relevant log output

Caused by java.lang.RuntimeException: Unable to pause activity {com.xxx.xxx/com.bytedance.sdk.openadsdk.activity.TTFullScreenExpressVideoActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
       at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5704)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5655)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5607)
       at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:47)
       at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8741)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
       at com.onesignal.FocusTimeController.getTimeFocusedElapsed(FocusTimeController.java:98)
       at com.onesignal.FocusTimeController.appStopped(FocusTimeController.java:50)
       at com.onesignal.ActivityLifecycleHandler.handleLostFocus(ActivityLifecycleHandler.java:182)
       at com.onesignal.ActivityLifecycleHandler.onActivityPaused(ActivityLifecycleHandler.java:102)
       at com.onesignal.ActivityLifecycleListener.onActivityPaused(ActivityLifecycleListener.java:97)
       at android.app.Application.dispatchActivityPaused(Application.java:480)
       at android.app.Activity.dispatchActivityPaused(Activity.java:1523)
       at android.app.Activity.onPause(Activity.java:2445)
       at com.bytedance.sdk.openadsdk.activity.TTBaseVideoActivity.onPause(TTBaseVideoActivity.java:277)
       at android.app.Activity.performPause(Activity.java:8765)
       at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1585)
       at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5694)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5655)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5607)
       at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:47)
       at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8741)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Code of Conduct

emawby commented 1 year ago

Thank you for reporting we will investigate

nan-li commented 1 year ago

Hi @shefich,

Can you let us know many devices and crashes you are seeing? How often does this happen?

shefich commented 1 year ago

Hi @nan-li, 67 crashes, 70 devices for the last 90 days. So not often. But this for the readable crashes. I'm not sure, but I think some unreadable logs can be connected to the same issue. Attached devices and Android versions:

img img2