Loading packages/CredentialManager/src/com/android/credentialmanager/common/BiometricHandler.kt +22 −21 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import com.android.credentialmanager.model.EntryInfo import com.android.credentialmanager.model.creation.CreateOptionInfo import com.android.credentialmanager.model.get.CredentialEntryInfo import com.android.credentialmanager.model.get.ProviderInfo import java.lang.Exception /** * Aggregates common display information used for the Biometric Flow. Loading Loading @@ -121,11 +120,11 @@ fun runBiometricFlowForGet( getBiometricCancellationSignal: () -> CancellationSignal, getRequestDisplayInfo: RequestDisplayInfo? = null, getProviderInfoList: List<ProviderInfo>? = null, getProviderDisplayInfo: ProviderDisplayInfo? = null, ) { getProviderDisplayInfo: ProviderDisplayInfo? = null ): Boolean { if (getBiometricPromptState() != BiometricPromptState.INACTIVE) { // Screen is already up, do not re-launch return return false } onBiometricPromptStateChange(BiometricPromptState.PENDING) val biometricDisplayInfo = validateAndRetrieveBiometricGetDisplayInfo( Loading @@ -137,7 +136,7 @@ fun runBiometricFlowForGet( if (biometricDisplayInfo == null) { onBiometricFailureFallback(BiometricFlowType.GET) return return false } val callback: BiometricPrompt.AuthenticationCallback = Loading @@ -146,7 +145,7 @@ fun runBiometricFlowForGet( getBiometricPromptState) Log.d(TAG, "The BiometricPrompt API call begins for Get.") runBiometricFlow(context, biometricDisplayInfo, callback, openMoreOptionsPage, return runBiometricFlow(context, biometricDisplayInfo, callback, openMoreOptionsPage, onBiometricFailureFallback, BiometricFlowType.GET, onCancelFlowAndFinish, getBiometricCancellationSignal) } Loading @@ -169,11 +168,11 @@ fun runBiometricFlowForCreate( getBiometricCancellationSignal: () -> CancellationSignal, createRequestDisplayInfo: com.android.credentialmanager.createflow .RequestDisplayInfo? = null, createProviderInfo: EnabledProviderInfo? = null, ) { createProviderInfo: EnabledProviderInfo? = null ): Boolean { if (getBiometricPromptState() != BiometricPromptState.INACTIVE) { // Screen is already up, do not re-launch return return false } onBiometricPromptStateChange(BiometricPromptState.PENDING) val biometricDisplayInfo = validateAndRetrieveBiometricCreateDisplayInfo( Loading @@ -184,7 +183,7 @@ fun runBiometricFlowForCreate( if (biometricDisplayInfo == null) { onBiometricFailureFallback(BiometricFlowType.CREATE) return return false } val callback: BiometricPrompt.AuthenticationCallback = Loading @@ -193,7 +192,7 @@ fun runBiometricFlowForCreate( getBiometricPromptState) Log.d(TAG, "The BiometricPrompt API call begins for Create.") runBiometricFlow(context, biometricDisplayInfo, callback, openMoreOptionsPage, return runBiometricFlow(context, biometricDisplayInfo, callback, openMoreOptionsPage, onBiometricFailureFallback, BiometricFlowType.CREATE, onCancelFlowAndFinish, getBiometricCancellationSignal) } Loading @@ -213,12 +212,12 @@ private fun runBiometricFlow( onBiometricFailureFallback: (BiometricFlowType) -> Unit, biometricFlowType: BiometricFlowType, onCancelFlowAndFinish: () -> Unit, getBiometricCancellationSignal: () -> CancellationSignal, ) { getBiometricCancellationSignal: () -> CancellationSignal ): Boolean { try { if (!canCallBiometricPrompt(biometricDisplayInfo, context)) { onBiometricFailureFallback(biometricFlowType) return return false } val biometricPrompt = setupBiometricPrompt(context, biometricDisplayInfo, Loading @@ -239,7 +238,9 @@ private fun runBiometricFlow( } catch (e: IllegalArgumentException) { Log.w(TAG, "Calling the biometric prompt API failed with: /n${e.localizedMessage}\n") onBiometricFailureFallback(biometricFlowType) return false } return true } private fun getCryptoOpId(biometricDisplayInfo: BiometricDisplayInfo): Int? { Loading packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt +8 −3 Original line number Diff line number Diff line Loading @@ -123,7 +123,8 @@ fun CreateCredentialScreen( onBiometricPromptStateChange = viewModel::onBiometricPromptStateChange, getBiometricCancellationSignal = viewModel::getBiometricCancellationSignal viewModel::getBiometricCancellationSignal, onLog = { viewModel.logUiEvent(it) }, ) CreateScreenState.MORE_OPTIONS_SELECTION_ONLY -> MoreOptionsSelectionCard( requestDisplayInfo = createCredentialUiState.requestDisplayInfo, Loading Loading @@ -642,12 +643,13 @@ internal fun BiometricSelectionPage( getBiometricPromptState: () -> BiometricPromptState, onBiometricPromptStateChange: (BiometricPromptState) -> Unit, getBiometricCancellationSignal: () -> CancellationSignal, onLog: @Composable (UiEventEnum) -> Unit ) { if (biometricEntry == null) { fallbackToOriginalFlow(BiometricFlowType.CREATE) return } runBiometricFlowForCreate( val biometricFlowCalled = runBiometricFlowForCreate( biometricEntry = biometricEntry, context = LocalContext.current, openMoreOptionsPage = onMoreOptionSelected, Loading @@ -659,6 +661,9 @@ internal fun BiometricSelectionPage( createProviderInfo = enabledProviderInfo, onBiometricFailureFallback = fallbackToOriginalFlow, onIllegalStateAndFinish = onIllegalScreenStateAndFinish, getBiometricCancellationSignal = getBiometricCancellationSignal, getBiometricCancellationSignal = getBiometricCancellationSignal ) if (biometricFlowCalled) { onLog(CreateCredentialEvent.CREDMAN_CREATE_CRED_BIOMETRIC_FLOW_LAUNCHED) } } packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt +7 −2 Original line number Diff line number Diff line Loading @@ -166,7 +166,8 @@ fun GetCredentialScreen( onBiometricPromptStateChange = viewModel::onBiometricPromptStateChange, getBiometricCancellationSignal = viewModel::getBiometricCancellationSignal viewModel::getBiometricCancellationSignal, onLog = { viewModel.logUiEvent(it) }, ) } else if (credmanBiometricApiEnabled() && getCredentialUiState.currentScreenState Loading Loading @@ -260,12 +261,13 @@ internal fun BiometricSelectionPage( getBiometricPromptState: () -> BiometricPromptState, onBiometricPromptStateChange: (BiometricPromptState) -> Unit, getBiometricCancellationSignal: () -> CancellationSignal, onLog: @Composable (UiEventEnum) -> Unit, ) { if (biometricEntry == null) { fallbackToOriginalFlow(BiometricFlowType.GET) return } runBiometricFlowForGet( val biometricFlowCalled = runBiometricFlowForGet( biometricEntry = biometricEntry, context = LocalContext.current, openMoreOptionsPage = onMoreOptionSelected, Loading @@ -280,6 +282,9 @@ internal fun BiometricSelectionPage( onBiometricFailureFallback = fallbackToOriginalFlow, getBiometricCancellationSignal = getBiometricCancellationSignal ) if (biometricFlowCalled) { onLog(GetCredentialEvent.CREDMAN_GET_CRED_BIOMETRIC_FLOW_LAUNCHED) } } /** Draws the primary credential selection page, used in Android U. */ Loading packages/CredentialManager/src/com/android/credentialmanager/logging/CreateCredentialEvent.kt +5 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.credentialmanager.logging import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEventLogger import com.android.internal.logging.UiEventLogger.UiEventEnum.RESERVE_NEW_UI_EVENT_ID enum class CreateCredentialEvent(private val id: Int) : UiEventLogger.UiEventEnum { Loading Loading @@ -52,7 +53,10 @@ enum class CreateCredentialEvent(private val id: Int) : UiEventLogger.UiEventEnu CREDMAN_CREATE_CRED_EXTERNAL_ONLY_SELECTION(1327), @UiEvent(doc = "The more about passkeys intro card is visible on screen.") CREDMAN_CREATE_CRED_MORE_ABOUT_PASSKEYS_INTRO(1328); CREDMAN_CREATE_CRED_MORE_ABOUT_PASSKEYS_INTRO(1328), @UiEvent(doc = "The single tap biometric flow is launched.") CREDMAN_CREATE_CRED_BIOMETRIC_FLOW_LAUNCHED(RESERVE_NEW_UI_EVENT_ID); override fun getId(): Int { return this.id Loading packages/CredentialManager/src/com/android/credentialmanager/logging/GetCredentialEvent.kt +5 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.credentialmanager.logging import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEventLogger import com.android.internal.logging.UiEventLogger.UiEventEnum.RESERVE_NEW_UI_EVENT_ID enum class GetCredentialEvent(private val id: Int) : UiEventLogger.UiEventEnum { Loading Loading @@ -54,7 +55,10 @@ enum class GetCredentialEvent(private val id: Int) : UiEventLogger.UiEventEnum { CREDMAN_GET_CRED_PRIMARY_SELECTION_CARD(1341), @UiEvent(doc = "The all sign in option card is visible on screen.") CREDMAN_GET_CRED_ALL_SIGN_IN_OPTION_CARD(1342); CREDMAN_GET_CRED_ALL_SIGN_IN_OPTION_CARD(1342), @UiEvent(doc = "The single tap biometric flow is launched.") CREDMAN_GET_CRED_BIOMETRIC_FLOW_LAUNCHED(RESERVE_NEW_UI_EVENT_ID); override fun getId(): Int { return this.id Loading Loading
packages/CredentialManager/src/com/android/credentialmanager/common/BiometricHandler.kt +22 −21 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import com.android.credentialmanager.model.EntryInfo import com.android.credentialmanager.model.creation.CreateOptionInfo import com.android.credentialmanager.model.get.CredentialEntryInfo import com.android.credentialmanager.model.get.ProviderInfo import java.lang.Exception /** * Aggregates common display information used for the Biometric Flow. Loading Loading @@ -121,11 +120,11 @@ fun runBiometricFlowForGet( getBiometricCancellationSignal: () -> CancellationSignal, getRequestDisplayInfo: RequestDisplayInfo? = null, getProviderInfoList: List<ProviderInfo>? = null, getProviderDisplayInfo: ProviderDisplayInfo? = null, ) { getProviderDisplayInfo: ProviderDisplayInfo? = null ): Boolean { if (getBiometricPromptState() != BiometricPromptState.INACTIVE) { // Screen is already up, do not re-launch return return false } onBiometricPromptStateChange(BiometricPromptState.PENDING) val biometricDisplayInfo = validateAndRetrieveBiometricGetDisplayInfo( Loading @@ -137,7 +136,7 @@ fun runBiometricFlowForGet( if (biometricDisplayInfo == null) { onBiometricFailureFallback(BiometricFlowType.GET) return return false } val callback: BiometricPrompt.AuthenticationCallback = Loading @@ -146,7 +145,7 @@ fun runBiometricFlowForGet( getBiometricPromptState) Log.d(TAG, "The BiometricPrompt API call begins for Get.") runBiometricFlow(context, biometricDisplayInfo, callback, openMoreOptionsPage, return runBiometricFlow(context, biometricDisplayInfo, callback, openMoreOptionsPage, onBiometricFailureFallback, BiometricFlowType.GET, onCancelFlowAndFinish, getBiometricCancellationSignal) } Loading @@ -169,11 +168,11 @@ fun runBiometricFlowForCreate( getBiometricCancellationSignal: () -> CancellationSignal, createRequestDisplayInfo: com.android.credentialmanager.createflow .RequestDisplayInfo? = null, createProviderInfo: EnabledProviderInfo? = null, ) { createProviderInfo: EnabledProviderInfo? = null ): Boolean { if (getBiometricPromptState() != BiometricPromptState.INACTIVE) { // Screen is already up, do not re-launch return return false } onBiometricPromptStateChange(BiometricPromptState.PENDING) val biometricDisplayInfo = validateAndRetrieveBiometricCreateDisplayInfo( Loading @@ -184,7 +183,7 @@ fun runBiometricFlowForCreate( if (biometricDisplayInfo == null) { onBiometricFailureFallback(BiometricFlowType.CREATE) return return false } val callback: BiometricPrompt.AuthenticationCallback = Loading @@ -193,7 +192,7 @@ fun runBiometricFlowForCreate( getBiometricPromptState) Log.d(TAG, "The BiometricPrompt API call begins for Create.") runBiometricFlow(context, biometricDisplayInfo, callback, openMoreOptionsPage, return runBiometricFlow(context, biometricDisplayInfo, callback, openMoreOptionsPage, onBiometricFailureFallback, BiometricFlowType.CREATE, onCancelFlowAndFinish, getBiometricCancellationSignal) } Loading @@ -213,12 +212,12 @@ private fun runBiometricFlow( onBiometricFailureFallback: (BiometricFlowType) -> Unit, biometricFlowType: BiometricFlowType, onCancelFlowAndFinish: () -> Unit, getBiometricCancellationSignal: () -> CancellationSignal, ) { getBiometricCancellationSignal: () -> CancellationSignal ): Boolean { try { if (!canCallBiometricPrompt(biometricDisplayInfo, context)) { onBiometricFailureFallback(biometricFlowType) return return false } val biometricPrompt = setupBiometricPrompt(context, biometricDisplayInfo, Loading @@ -239,7 +238,9 @@ private fun runBiometricFlow( } catch (e: IllegalArgumentException) { Log.w(TAG, "Calling the biometric prompt API failed with: /n${e.localizedMessage}\n") onBiometricFailureFallback(biometricFlowType) return false } return true } private fun getCryptoOpId(biometricDisplayInfo: BiometricDisplayInfo): Int? { Loading
packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt +8 −3 Original line number Diff line number Diff line Loading @@ -123,7 +123,8 @@ fun CreateCredentialScreen( onBiometricPromptStateChange = viewModel::onBiometricPromptStateChange, getBiometricCancellationSignal = viewModel::getBiometricCancellationSignal viewModel::getBiometricCancellationSignal, onLog = { viewModel.logUiEvent(it) }, ) CreateScreenState.MORE_OPTIONS_SELECTION_ONLY -> MoreOptionsSelectionCard( requestDisplayInfo = createCredentialUiState.requestDisplayInfo, Loading Loading @@ -642,12 +643,13 @@ internal fun BiometricSelectionPage( getBiometricPromptState: () -> BiometricPromptState, onBiometricPromptStateChange: (BiometricPromptState) -> Unit, getBiometricCancellationSignal: () -> CancellationSignal, onLog: @Composable (UiEventEnum) -> Unit ) { if (biometricEntry == null) { fallbackToOriginalFlow(BiometricFlowType.CREATE) return } runBiometricFlowForCreate( val biometricFlowCalled = runBiometricFlowForCreate( biometricEntry = biometricEntry, context = LocalContext.current, openMoreOptionsPage = onMoreOptionSelected, Loading @@ -659,6 +661,9 @@ internal fun BiometricSelectionPage( createProviderInfo = enabledProviderInfo, onBiometricFailureFallback = fallbackToOriginalFlow, onIllegalStateAndFinish = onIllegalScreenStateAndFinish, getBiometricCancellationSignal = getBiometricCancellationSignal, getBiometricCancellationSignal = getBiometricCancellationSignal ) if (biometricFlowCalled) { onLog(CreateCredentialEvent.CREDMAN_CREATE_CRED_BIOMETRIC_FLOW_LAUNCHED) } }
packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt +7 −2 Original line number Diff line number Diff line Loading @@ -166,7 +166,8 @@ fun GetCredentialScreen( onBiometricPromptStateChange = viewModel::onBiometricPromptStateChange, getBiometricCancellationSignal = viewModel::getBiometricCancellationSignal viewModel::getBiometricCancellationSignal, onLog = { viewModel.logUiEvent(it) }, ) } else if (credmanBiometricApiEnabled() && getCredentialUiState.currentScreenState Loading Loading @@ -260,12 +261,13 @@ internal fun BiometricSelectionPage( getBiometricPromptState: () -> BiometricPromptState, onBiometricPromptStateChange: (BiometricPromptState) -> Unit, getBiometricCancellationSignal: () -> CancellationSignal, onLog: @Composable (UiEventEnum) -> Unit, ) { if (biometricEntry == null) { fallbackToOriginalFlow(BiometricFlowType.GET) return } runBiometricFlowForGet( val biometricFlowCalled = runBiometricFlowForGet( biometricEntry = biometricEntry, context = LocalContext.current, openMoreOptionsPage = onMoreOptionSelected, Loading @@ -280,6 +282,9 @@ internal fun BiometricSelectionPage( onBiometricFailureFallback = fallbackToOriginalFlow, getBiometricCancellationSignal = getBiometricCancellationSignal ) if (biometricFlowCalled) { onLog(GetCredentialEvent.CREDMAN_GET_CRED_BIOMETRIC_FLOW_LAUNCHED) } } /** Draws the primary credential selection page, used in Android U. */ Loading
packages/CredentialManager/src/com/android/credentialmanager/logging/CreateCredentialEvent.kt +5 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.credentialmanager.logging import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEventLogger import com.android.internal.logging.UiEventLogger.UiEventEnum.RESERVE_NEW_UI_EVENT_ID enum class CreateCredentialEvent(private val id: Int) : UiEventLogger.UiEventEnum { Loading Loading @@ -52,7 +53,10 @@ enum class CreateCredentialEvent(private val id: Int) : UiEventLogger.UiEventEnu CREDMAN_CREATE_CRED_EXTERNAL_ONLY_SELECTION(1327), @UiEvent(doc = "The more about passkeys intro card is visible on screen.") CREDMAN_CREATE_CRED_MORE_ABOUT_PASSKEYS_INTRO(1328); CREDMAN_CREATE_CRED_MORE_ABOUT_PASSKEYS_INTRO(1328), @UiEvent(doc = "The single tap biometric flow is launched.") CREDMAN_CREATE_CRED_BIOMETRIC_FLOW_LAUNCHED(RESERVE_NEW_UI_EVENT_ID); override fun getId(): Int { return this.id Loading
packages/CredentialManager/src/com/android/credentialmanager/logging/GetCredentialEvent.kt +5 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.credentialmanager.logging import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEventLogger import com.android.internal.logging.UiEventLogger.UiEventEnum.RESERVE_NEW_UI_EVENT_ID enum class GetCredentialEvent(private val id: Int) : UiEventLogger.UiEventEnum { Loading Loading @@ -54,7 +55,10 @@ enum class GetCredentialEvent(private val id: Int) : UiEventLogger.UiEventEnum { CREDMAN_GET_CRED_PRIMARY_SELECTION_CARD(1341), @UiEvent(doc = "The all sign in option card is visible on screen.") CREDMAN_GET_CRED_ALL_SIGN_IN_OPTION_CARD(1342); CREDMAN_GET_CRED_ALL_SIGN_IN_OPTION_CARD(1342), @UiEvent(doc = "The single tap biometric flow is launched.") CREDMAN_GET_CRED_BIOMETRIC_FLOW_LAUNCHED(RESERVE_NEW_UI_EVENT_ID); override fun getId(): Int { return this.id Loading