Skip to content
Snippets Groups Projects
Commit 8306040f authored by Reema Bajwa's avatar Reema Bajwa Committed by Android (Google) Code Review
Browse files

Merge "Pass crypto object to biometric prompt" into main

parents 3931f8dc 5ab03d2c
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ import android.content.Context
import android.graphics.Bitmap
import android.hardware.biometrics.BiometricManager
import android.hardware.biometrics.BiometricPrompt
import android.hardware.biometrics.CryptoObject
import android.os.CancellationSignal
import android.util.Log
import androidx.core.content.ContextCompat.getMainExecutor
......@@ -221,13 +222,24 @@ private fun runBiometricFlow(
val executor = getMainExecutor(context)
try {
biometricPrompt.authenticate(cancellationSignal, executor, callback)
val cryptoOpId = getCryptoOpId(biometricDisplayInfo)
if (cryptoOpId != null) {
biometricPrompt.authenticate(
BiometricPrompt.CryptoObject(cryptoOpId.toLong()),
cancellationSignal, executor, callback)
} else {
biometricPrompt.authenticate(cancellationSignal, executor, callback)
}
} catch (e: IllegalArgumentException) {
Log.w(TAG, "Calling the biometric prompt API failed with: /n${e.localizedMessage}\n")
onBiometricFailureFallback(biometricFlowType)
}
}
private fun getCryptoOpId(biometricDisplayInfo: BiometricDisplayInfo): Int? {
return biometricDisplayInfo.biometricRequestInfo.opId
}
/**
* Sets up the biometric prompt with the UI specific bits.
* // TODO(b/333445112) : Pass in opId once dependency is confirmed via CryptoObject
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment