OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

[Bug]: ANR related to location services

Open AlexTip opened this issue 2 years ago • 2 comments

What happened?

Sometimes app track ANR issue this related to https://github.com/OneSignal/OneSignal-Android-SDK/issues/1612 but problem in another place

Steps to reproduce?

No simple way to reproduce it. But you can see problem place by trace

What did you expect to happen?

Calculating in background thread

OneSignal Android SDK version

4.8.6

Android version

13, 12, 11, 10

Specific Android models

No specific configurations

Relevant log output

"main" tid=1 Blocked
  at com.onesignal.LocationController.onFocusChange (LocationController.java)
  at com.onesignal.OneSignal.onAppFocus (OneSignal.java)
  at com.onesignal.OSFocusHandler.startOnFocusWork (OSFocusHandler.java)
  at com.onesignal.ActivityLifecycleHandler.handleFocus (ActivityLifecycleHandler.java)
  at com.onesignal.ActivityLifecycleHandler.onActivityResumed (ActivityLifecycleHandler.java)
  at com.onesignal.ActivityLifecycleListener.onActivityResumed (ActivityLifecycleListener.java)
  at android.app.Application.dispatchActivityResumed (Application.java:438)
  at android.app.Activity.dispatchActivityResumed (Activity.java:1446)
  at android.app.Activity.onResume (Activity.java:1985)
  at androidx.fragment.app.FragmentActivity.onResume (FragmentActivity.java)
  at android.app.Instrumentation.callActivityOnResume (Instrumentation.java:1457)
  at android.app.Activity.performResume (Activity.java:8312)
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4553)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:4595)
  at android.app.servertransaction.ResumeActivityItem.execute (ResumeActivityItem.java:52)
  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:2146)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:236)
  at android.app.ActivityThread.main (ActivityThread.java:8057)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:656)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:967)

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

AlexTip avatar Aug 01 '23 10:08 AlexTip

Hello @AlexTip thank you for reaching out! This does indeed appear to be related to https://github.com/OneSignal/OneSignal-Android-SDK/issues/1612.

As a workaround while we investigate solutions, if you don't need location points in OneSignal, you can call OneSignal.setLocationShared(false) to disable these location updates.

Thanks!

jennantilla avatar Aug 01 '23 19:08 jennantilla

@jennantilla Thanks, I'll try

Another point, you marked this issue as duplicate https://github.com/OneSignal/OneSignal-Android-SDK/issues/1612 But I think I have different root cause place (not sure but my opinion)

in my case it happened on handleFocus (ActivityLifecycleHandler.java) in #1612 - handleLostFocus (ActivityLifecycleHandler.java) - already fixed in previous release

AlexTip avatar Aug 07 '23 10:08 AlexTip