Assigned
Status Update
Comments
kr...@gmail.com <kr...@gmail.com> #2
Also there looked over the code and it seems that the fragments were intended to be transparent but the passcode fragment is not and ends up triggering the spawning activity's onStop.
Description
Biometrics: 1.0.0
Android 8 Huawei P10 VTR-L09 | Android 9 Galaxy S10E SM-G970F
Reproducible 10/10
Steps:
1#
Using the below code and 2 random activities just for transitioning.
Splash = Launcher / Main activity
- choose passcode
- provide input to reach either error or successful callbacks
- press back button
Expected:
To see my homescreen and be able to click / interact with it, application fully closed in task manager
Observed:
The ui is blocked on home screen(can't swipe nor click other apps), task manager is frozen showing the app still there, only after pressing the back button again will it actually release and allow to close the application.
Task manager shows the process but no activity in it?
Happens when both fingerprints are available and not, doesn't matter even if it defaults to the passcode from launch.
Does not happen if the passcode fragment isn't shown at any point.
2#
Apart from this the lifecycles I see in SplashActivity differ when using fingerprint scanning vs passcode.
Fingerprint: onResume -> authenticate callback -> onResume
Passcode: onResume -> onResume -> authenticate callback
Even on the main looper, this latter part might not be a bug but me failing to understand Android
```
package com.example.sampleapplication.activities
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import androidx.appcompat.app.AppCompatActivity
import androidx.biometric.BiometricPrompt
import com.example.sampleapplication.R
import java.util.concurrent.Executor
class SplashActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash)
}
override fun onResume() {
authenticate()
super.onResume()
}
private fun authenticate() {
val subtitle = "Subtitle"
val title = "Title"
val promptInfo = BiometricPrompt.PromptInfo.Builder()
.setTitle(title)
.setDescription(subtitle)
.setDeviceCredentialAllowed(true)
.build()
val promptCallback = object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
startActivity(Intent(this@SplashActivity, ErrorActivity::class.java))
this@SplashActivity.finish()
super.onAuthenticationError(errorCode, errString)
}
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
startActivity(Intent(this@SplashActivity, DashboardActivity::class.java))
this@SplashActivity.finish()
super.onAuthenticationSucceeded(result)
}
}
val biometricPrompt = BiometricPrompt(this, MainThreadExecutor, promptCallback)
biometricPrompt.authenticate(promptInfo)
}
}
object MainThreadExecutor : Executor {
private val handler = Handler(Looper.getMainLooper())
override fun execute(r: Runnable) {
}
}
```