Reader ANR on generateKey

Hi,

A user of ours is receiving an ANR when using their Lenovo TB125FU (Lenovo Tab M10 Plus 3rd Gen) and the Square Reader SDK.

Google Play returns the following crash:

at android.os.BinderProxy.transactNative (Native method)
This Binder call may be taking too long, causing the main thread to wait, and triggering the ANR.
"main" tid=1 Native
  #00  pc 0x00000000000ac184  /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+4)
  #01  pc 0x000000000005dc9c  /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+156)
  #02  pc 0x000000000005b3ac  /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver+284)
  #03  pc 0x000000000005c768  /system/lib64/libbinder.so (android::IPCThreadState::waitForResponse+72)
  #04  pc 0x000000000005c458  /system/lib64/libbinder.so (android::IPCThreadState::transact+216)
  #05  pc 0x0000000000053a3c  /system/lib64/libbinder.so (android::BpBinder::transact+188)
  #06  pc 0x000000000017492c  /system/lib64/libandroid_runtime.so (android_os_BinderProxy_transact+188)
  at android.os.BinderProxy.transactNative (Native method)
  at android.os.BinderProxy.transact (BinderProxy.java:591)
  at android.system.keystore2.IKeystoreSecurityLevel$Stub$Proxy.generateKey (IKeystoreSecurityLevel.java:259)
  at android.security.KeyStoreSecurityLevel.lambda$generateKey$0$android-security-KeyStoreSecurityLevel (KeyStoreSecurityLevel.java:145)
  at android.security.KeyStoreSecurityLevel$$ExternalSyntheticLambda1.execute (unavailable:12)
  at android.security.KeyStoreSecurityLevel.handleExceptions (KeyStoreSecurityLevel.java:55)
  at android.security.KeyStoreSecurityLevel.generateKey (KeyStoreSecurityLevel.java:145)
  at android.security.keystore2.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPairHelper (AndroidKeyStoreKeyPairGeneratorSpi.java:690)
  at android.security.keystore2.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair (AndroidKeyStoreKeyPairGeneratorSpi.java:627)
  at java.security.KeyPairGenerator$Delegate.generateKeyPair (KeyPairGenerator.java:746)
  at com.squareup.cryptoattestation.compatibilitycheck.KeyStoreCipherUtilities.generateKey (KeyStoreCipherUtilities.kt:91)
  at com.squareup.cryptoattestation.compatibilitycheck.KeyStoreCipherUtilities.generateKey (KeyStoreCipherUtilities.kt:53)
  at com.squareup.cryptoattestation.compatibilitycheck.RealKeyProvisionCompatibilityChecker.testKeyGeneration (RealKeyProvisionCompatibilityChecker.kt:226)
  at com.squareup.cryptoattestation.compatibilitycheck.RealKeyProvisionCompatibilityChecker.generateReport (RealKeyProvisionCompatibilityChecker.kt:154)
  at com.squareup.cryptoattestation.compatibilitycheck.RealKeyProvisionCompatibilityChecker.getReport (RealKeyProvisionCompatibilityChecker.kt:103)
  at com.squareup.cryptoattestation.compatibilitycheck.RealKeyProvisionCompatibilityChecker.meetsRequirement (RealKeyProvisionCompatibilityChecker.kt:118)
  at com.squareup.encryption.RealHieroglyphKeyProviderRequirementChecker$meetsRequirement$2.invoke (RealHieroglyphKeyProviderRequirementChecker.kt:22)
  at com.squareup.encryption.RealHieroglyphKeyProviderRequirementChecker$meetsRequirement$2.invoke (RealHieroglyphKeyProviderRequirementChecker.kt:20)
  at kotlin.SynchronizedLazyImpl.getValue (LazyJVM.kt:74)
.... (more stack available if requested)

This device is listed as compatible. It is running Android 13 (SDK 33).

We are running Reader version 1.7.5 and targeting android sdk 33.

Any advice or help would be appreciated. I am happy to provide more info on request.

Thanks!

Just realized there was no follow up here. Were you able to figure out the issue? :slightly_smiling_face:

Hi Bryan,
No, we have not heard of a solution yet. I assumed it was something with the hardware, or how Square interacts with the device itself.

Are you are performing network requests, heavy computations, or any other long-running operations on the main thread, it can block the UI thread and lead to ANR? Or making synchronous IPC calls that take a long time to complete can block the main thread? Performing complex or heavy UI operations on the main thread can also contribute to this issue. :slightly_smiling_face: