Device: Samsung 10e
SDK Level: 31
OS: Android 12
Exception From Play Console:
at java.lang.Thread.sleep (Native method)
at java.lang.Thread.sleep (Thread.java:451)
at java.lang.Thread.sleep (Thread.java:356)
at android.security.KeyStoreSecurityLevel.interruptedPreservingSleep (KeyStoreSecurityLevel.java:261)
at android.security.KeyStoreSecurityLevel.createOperation (KeyStoreSecurityLevel.java:117)
at android.security.keystore2.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized (AndroidKeyStoreCipherSpiBase.java:340)
at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineInit (AndroidKeyStoreCipherSpiBase.java:240)
at javax.crypto.Cipher.tryTransformWithProvider (Cipher.java:2980)
at javax.crypto.Cipher.tryCombinations (Cipher.java:2891)
at javax.crypto.Cipher$SpiAndProviderUpdater.updateAndGetSpiAndProvider (Cipher.java:2796)
at javax.crypto.Cipher.chooseProvider (Cipher.java:773)
at javax.crypto.Cipher.init (Cipher.java:1288)
at javax.crypto.Cipher.init (Cipher.java:1223)
at design.codeux.biometric_storage.CryptographyManagerImpl.getInitializedCipherForDecryption (CryptographyManagerImpl.java:104)
at design.codeux.biometric_storage.CryptographyManagerImpl.getInitializedCipherForDecryption (CryptographyManagerImpl.java:114)
at design.codeux.biometric_storage.BiometricStorageFile.cipherForDecrypt (BiometricStorageFile.kt:85)
at design.codeux.biometric_storage.BiometricStoragePlugin.onMethodCall$withAuth$cipherForMode (BiometricStoragePlugin.kt:177)
at design.codeux.biometric_storage.BiometricStoragePlugin.onMethodCall$withAuth (BiometricStoragePlugin.kt:183)
at design.codeux.biometric_storage.BiometricStoragePlugin.onMethodCall$lambda$18 (BiometricStoragePlugin.kt:247)
at design.codeux.biometric_storage.BiometricStoragePlugin.onMethodCall$withStorage (BiometricStoragePlugin.kt:149)
at design.codeux.biometric_storage.BiometricStoragePlugin.onMethodCall (BiometricStoragePlugin.kt:245)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage (MethodChannel.java:267)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler (DartMessenger.java:292)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0 (DartMessenger.java:319)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8663)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)
One of our users are getting this issue and our app hangs. I have done some research and this could happen if the system can't handle any more cryptographic operations [1][2]. From the code [3], AFAIU, Android will try to retry the operation if it receives the ResponseCode.BACKEND_BUSY error code.
What I'm confused about is that, according to the code comments, the retry behavior only occurs on Android versions before 12. Starting from Android 12, it's supposed to throw an exception instead. But interestingly, we're not seeing that exception in the Play Console. So I'm not sure whether this issue should be created here or if it's actually an Android API issue. However, I'm opening this issue in case anyone else is experiencing the same problem and found any workarounds.
Device: Samsung 10e
SDK Level: 31
OS: Android 12
Exception From Play Console:
One of our users are getting this issue and our app hangs. I have done some research and this could happen if the system can't handle any more cryptographic operations [1][2]. From the code [3], AFAIU, Android will try to retry the operation if it receives the
ResponseCode.BACKEND_BUSYerror code.What I'm confused about is that, according to the code comments, the retry behavior only occurs on Android versions before 12. Starting from Android 12, it's supposed to throw an exception instead. But interestingly, we're not seeing that exception in the Play Console. So I'm not sure whether this issue should be created here or if it's actually an Android API issue. However, I'm opening this issue in case anyone else is experiencing the same problem and found any workarounds.