safe_device icon indicating copy to clipboard operation
safe_device copied to clipboard

com.xamdesign.safe_device.MockLocation is causing ANR

Open tulioccalazans opened this issue 9 months ago • 5 comments

Hi, MockLocation is causing ANR, safe_device version 1.1.7

Before version 1.1.6, the same thing happened with the trust_location package

Both issues were noticed in Android 14

My application does not check mock location. But I see that the package performs some initialization when the application runs. This is probably causing the problem.

MockLocation (safe_device v1.1.6)

main (timed waiting):tid=1 systid=13472 at jdk.internal.misc.Unsafe.park(Native method) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:717) at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1074) at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:276) at com.google.android.gms.internal.location.zzey.zza(com.google.android.gms:play-services-location@@21.1.0:3) at com.google.android.gms.internal.location.zzbb.getLocationAvailability(com.google.android.gms:play-services-location@@21.1.0:11) at com.xamdesign.safe_device.MockLocation.LocationAssistant.checkLocationAvailability(LocationAssistant.java:519) at com.xamdesign.safe_device.MockLocation.LocationAssistant.acquireLocation(LocationAssistant.java:468) at com.xamdesign.safe_device.MockLocation.LocationAssistant.access$000(LocationAssistant.java:41) at com.xamdesign.safe_device.MockLocation.LocationAssistant$1.run(LocationAssistant.java:462) at android.os.Handler.handleCallback(Handler.java:1000) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loopOnce(Looper.java:242) at android.os.Looper.loop(Looper.java:362) at android.app.ActivityThread.main(ActivityThread.java:8407) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:992)

trust_location (safe_device v1.1.4) trust_location ANR issue

main (timed waiting):tid=1 systid=25919 at jdk.internal.misc.Unsafe.park(Native method) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:717) at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1074) at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:276) at com.google.android.gms.internal.location.zzau.getLastLocation(com.google.android.gms:play-services-location@@21.0.1:12) at com.wongpiwat.trust_location.LocationAssistant.checkInitialLocation(LocationAssistant.java:494) at com.wongpiwat.trust_location.LocationAssistant.access$600(LocationAssistant.java:57) at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:730) at com.wongpiwat.trust_location.LocationAssistant$8.onResult(LocationAssistant.java:722) at com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage(com.google.android.gms:play-services-base@@18.1.0:6) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:8893) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

tulioccalazans avatar May 07 '24 16:05 tulioccalazans

Hi, I created a fork removing all MockLocation checking part.

https://github.com/tulioccalazans/safe_device/tree/dev

If you want to use it in your project, use it this way:

  safe_device:
    git:
      url: https://github.com/tulioccalazans/safe_device.git
      ref: dev

tulioccalazans avatar May 07 '24 18:05 tulioccalazans

Any update on this? is there a PR for this?

jozefvodicka avatar Jun 04 '24 10:06 jozefvodicka

Any update on this? is there a PR for this?

I am trying version 1.1.4, it does not make my app freeze or not responding.

KhrisnaIndrawan avatar Jul 14 '24 12:07 KhrisnaIndrawan

Any update on this? is there a PR for this?

I am trying version 1.1.4, it does not make my app freeze or not responding.

did you use it on production project?

putrautama007 avatar Jul 15 '24 01:07 putrautama007

Any update on this? is there a PR for this?

I am trying version 1.1.4, it does not make my app freeze or not responding.

did you use it on production project?

My bad @putrautama007 , version 1.1.4 still have same issue. I am using @tulioccalazans workaround

KhrisnaIndrawan avatar Jul 20 '24 08:07 KhrisnaIndrawan

safe_device: git: url: https://github.com/tulioccalazans/safe_device.git ref: dev

i found the same issue that cause ANR. my previous release was using safe_device 1.1.4 upgraded to safe_device 1.1.5 and even 1.1.7 still got same problem.

Now i'm using @tulioccalazans workaround and temporarily disabled my isMockLocation checking and it works like a charm.

fahmisatrio avatar Aug 13 '24 02:08 fahmisatrio

safe_device: ^1.1.8

ufukhawk avatar Aug 20 '24 07:08 ufukhawk

I didn't see in the changelog or in the PR for 1.1.8 anything that addresses mock location, only the Sony issue. This isn't happening only on Sony devices. Is it really fixed?

quangduy-luong avatar Sep 04 '24 08:09 quangduy-luong