Add auto-select bit to provider's pending intent

Bug: 285390594
Test: Built & deployed locally

Change-Id: I7bf43827585b3f4d49284ed93cfa666aa27ee367
This commit is contained in:
Reema Bajwa
2023-06-01 18:15:36 +00:00
parent cf2e76555e
commit a1d462fb55
2 changed files with 5 additions and 2 deletions

View File

@@ -118,8 +118,10 @@ class CredentialSelectorViewModel(
if (entry != null && entry.pendingIntent != null) {
Log.d(Constants.LOG_TAG, "Launching provider activity")
uiState = uiState.copy(providerActivityState = ProviderActivityState.PENDING)
val entryIntent = entry.fillInIntent
entryIntent?.putExtra(Constants.IS_AUTO_SELECTED_KEY, uiState.isAutoSelectFlow)
val intentSenderRequest = IntentSenderRequest.Builder(entry.pendingIntent)
.setFillInIntent(entry.fillInIntent).build()
.setFillInIntent(entryIntent).build()
try {
launcher.launch(intentSenderRequest)
} catch (e: Exception) {

View File

@@ -21,5 +21,6 @@ class Constants {
const val LOG_TAG = "CredentialSelector"
const val BUNDLE_KEY_PREFER_IMMEDIATELY_AVAILABLE_CREDENTIALS =
"androidx.credentials.BUNDLE_KEY_IS_AUTO_SELECT_ALLOWED"
const val IS_AUTO_SELECTED_KEY = "IS_AUTO_SELECTED"
}
}
}