Do not crash ui app upon bad provider pending intent.

Test: manual
Bug: 281335878
Change-Id: I37eb8ecf9d24131cfedc4a5344a5f7c608f44534
This commit is contained in:
Helen Qin
2023-05-08 03:11:47 +00:00
parent 76694b6ebb
commit b2f96a28bc

View File

@@ -119,7 +119,12 @@ class CredentialSelectorViewModel(
uiState = uiState.copy(providerActivityState = ProviderActivityState.PENDING)
val intentSenderRequest = IntentSenderRequest.Builder(entry.pendingIntent)
.setFillInIntent(entry.fillInIntent).build()
launcher.launch(intentSenderRequest)
try {
launcher.launch(intentSenderRequest)
} catch (e: Exception) {
Log.w(Constants.LOG_TAG, "Failed to launch provider UI: $e")
onInternalError()
}
} else {
Log.d(Constants.LOG_TAG, "No provider UI to launch")
onInternalError()