The app session should not have Application Not Responding errors or crashes.
Actual Behavior
We're getting reports of Application Not Responding (ANRs).
Steps to Reproduce
The issue is intermittent and we have not been able to reproduce it.
Context
From the stack trace it appears to happen when the library is checking for permissions. This permission check is happening on the main thread.
Debug logs
Logs
```
native: #00 pc 00085c6c /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28) (BuildId: 92dcb8f8db809270471890b0f763858b)
native: #01 pc 00232670 /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks+140) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
native: #02 pc 0045a5e4 /apex/com.android.art/lib64/libart.so (artJniMethodEnd+336) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
native: #03 pc 005be57c /apex/com.android.art/lib64/libart.so (art_jni_method_end+12) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
at android.os.BinderProxy.transactNative(Native method)
at android.os.BinderProxy.transact(BinderProxy.java:571)
at android.app.IActivityManager$Stub$Proxy.checkPermission(IActivityManager.java:5375)
at android.permission.PermissionManager.checkPermissionUncached(PermissionManager.java:1243)
at android.permission.PermissionManager.access$100(PermissionManager.java:80)
at android.permission.PermissionManager$1.recompute(PermissionManager.java:1311)
at android.permission.PermissionManager$1.recompute(PermissionManager.java:1308)
at android.app.PropertyInvalidatedCache.query(PropertyInvalidatedCache.java:562)
at android.permission.PermissionManager.checkPermission(PermissionManager.java:1317)
at android.app.ContextImpl.checkPermission(ContextImpl.java:2119)
at android.content.ContextWrapper.checkPermission(ContextWrapper.java:869)
at android.content.ContextWrapper.checkPermission(ContextWrapper.java:869)
at androidx.core.content.a.checkSelfPermission(SourceFile:42)
at com.transistorsoft.locationmanager.util.LocationAuthorization.hasBackgroundPermission(unavailable:9)
at com.transistorsoft.locationmanager.location.SingleLocationRequest.g(unavailable:17)
at com.transistorsoft.locationmanager.location.TSLocationManager$a.onLocation(unavailable:26)
at com.transistorsoft.locationmanager.location.TSLocationManager.a(SourceFile:11)
at com.transistorsoft.locationmanager.location.TSLocationManager.a(SourceFile:1)
at com.transistorsoft.locationmanager.location.j.onSuccess(SourceFile:1)
at java.lang.reflect.Method.invoke(Native method)
at com.transistorsoft.xms.g.utils.Utils.invokeImprecise(unavailable:39)
at com.transistorsoft.xms.g.utils.Utils.invokeMethod(SourceFile:2)
at com.transistorsoft.xms.g.utils.Utils.invokeMethod(SourceFile:1)
at com.transistorsoft.xms.g.tasks.OnSuccessListener$1.onSuccess(unavailable:16)
at com.google.android.gms.tasks.zzm.run(SourceFile:26)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:231)
at android.os.Looper.loop(Looper.java:338)
at android.app.ActivityThread.main(ActivityThread.java:8065)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:579)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
```
Your Environment
react-native -v
): 0.74.3Expected Behavior
The app session should not have Application Not Responding errors or crashes.
Actual Behavior
We're getting reports of Application Not Responding (ANRs).
Steps to Reproduce
The issue is intermittent and we have not been able to reproduce it.
Context
From the stack trace it appears to happen when the library is checking for permissions. This permission check is happening on the
main
thread.Debug logs
Logs
``` native: #00 pc 00085c6c /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28) (BuildId: 92dcb8f8db809270471890b0f763858b) native: #01 pc 00232670 /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks+140) (BuildId: 5b1e3dce5abfbdc410d71d256d308227) native: #02 pc 0045a5e4 /apex/com.android.art/lib64/libart.so (artJniMethodEnd+336) (BuildId: 5b1e3dce5abfbdc410d71d256d308227) native: #03 pc 005be57c /apex/com.android.art/lib64/libart.so (art_jni_method_end+12) (BuildId: 5b1e3dce5abfbdc410d71d256d308227) at android.os.BinderProxy.transactNative(Native method) at android.os.BinderProxy.transact(BinderProxy.java:571) at android.app.IActivityManager$Stub$Proxy.checkPermission(IActivityManager.java:5375) at android.permission.PermissionManager.checkPermissionUncached(PermissionManager.java:1243) at android.permission.PermissionManager.access$100(PermissionManager.java:80) at android.permission.PermissionManager$1.recompute(PermissionManager.java:1311) at android.permission.PermissionManager$1.recompute(PermissionManager.java:1308) at android.app.PropertyInvalidatedCache.query(PropertyInvalidatedCache.java:562) at android.permission.PermissionManager.checkPermission(PermissionManager.java:1317) at android.app.ContextImpl.checkPermission(ContextImpl.java:2119) at android.content.ContextWrapper.checkPermission(ContextWrapper.java:869) at android.content.ContextWrapper.checkPermission(ContextWrapper.java:869) at androidx.core.content.a.checkSelfPermission(SourceFile:42) at com.transistorsoft.locationmanager.util.LocationAuthorization.hasBackgroundPermission(unavailable:9) at com.transistorsoft.locationmanager.location.SingleLocationRequest.g(unavailable:17) at com.transistorsoft.locationmanager.location.TSLocationManager$a.onLocation(unavailable:26) at com.transistorsoft.locationmanager.location.TSLocationManager.a(SourceFile:11) at com.transistorsoft.locationmanager.location.TSLocationManager.a(SourceFile:1) at com.transistorsoft.locationmanager.location.j.onSuccess(SourceFile:1) at java.lang.reflect.Method.invoke(Native method) at com.transistorsoft.xms.g.utils.Utils.invokeImprecise(unavailable:39) at com.transistorsoft.xms.g.utils.Utils.invokeMethod(SourceFile:2) at com.transistorsoft.xms.g.utils.Utils.invokeMethod(SourceFile:1) at com.transistorsoft.xms.g.tasks.OnSuccessListener$1.onSuccess(unavailable:16) at com.google.android.gms.tasks.zzm.run(SourceFile:26) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:231) at android.os.Looper.loop(Looper.java:338) at android.app.ActivityThread.main(ActivityThread.java:8065) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:579) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045) ```