Provider Activity Interruption Fix
This fixes an issue where the provider activity, for whatever reason,
may interrupt the BiometricFlow. Usually, as this exploraiton
identified, this leads to a default cancellation in the finish() term of
activities. This requires properly capturing the state change in the
framework, which is what is done here.
Bug: 335094602
Test: Build Test
Change-Id: I23c7049702445c0ef7340339dd4b693d157de250
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/CredentialSelectorViewModel.kt b/packages/CredentialManager/src/com/android/credentialmanager/CredentialSelectorViewModel.kt
index d4a8110..7bc25ed 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/CredentialSelectorViewModel.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/CredentialSelectorViewModel.kt
@@ -174,11 +174,8 @@
onUserCancel()
} else {
Log.d(Constants.LOG_TAG, "The provider activity was cancelled," +
- " re-displaying our UI.")
- uiState = uiState.copy(
- selectedEntry = null,
- providerActivityState = ProviderActivityState.NOT_APPLICABLE,
- )
+ " re-displaying our UI.")
+ resetUiStateForReLaunch()
}
} else {
if (entry != null) {
@@ -202,6 +199,15 @@
}
}
+ // Resets UI states for any situation that re-launches the UI
+ private fun resetUiStateForReLaunch() {
+ onBiometricPromptStateChange(BiometricPromptState.INACTIVE)
+ uiState = uiState.copy(
+ selectedEntry = null,
+ providerActivityState = ProviderActivityState.NOT_APPLICABLE,
+ )
+ }
+
fun onLastLockedAuthEntryNotFoundError() {
Log.d(Constants.LOG_TAG, "Unable to find the last unlocked entry")
onInternalError()
@@ -502,4 +508,4 @@
fun logUiEvent(uiEventEnum: UiEventEnum) {
this.uiMetrics.log(uiEventEnum, credManRepo.requestInfo?.packageName)
}
-}
\ No newline at end of file
+}