diff options
| author | 2023-03-06 00:00:45 +0000 | |
|---|---|---|
| committer | 2023-03-06 00:00:45 +0000 | |
| commit | d76e83d623ee5695c5c8b479b84f2490a822f8e7 (patch) | |
| tree | eb11c014b39a5cb1cfaa05760cafc4a6e964a4f6 | |
| parent | 279661f07260534f4ed161cf9ed7a6cb1d3f1f88 (diff) | |
[CredManUi] Show provider name in get flow.
Also change the separator from " - " to "•" according to the spec.
Bug: 267814761
Test: manual (see screenshot in bug)
Change-Id: I26596afca23c9ab16bbf74b8da40b11a563bef83
4 files changed, 19 insertions, 10 deletions
diff --git a/packages/CredentialManager/res/values/strings.xml b/packages/CredentialManager/res/values/strings.xml index e12eff9ce20b..f655d6b174d5 100644 --- a/packages/CredentialManager/res/values/strings.xml +++ b/packages/CredentialManager/res/values/strings.xml @@ -110,7 +110,7 @@ <!-- This is a label for a button that takes user to the next screen. [CHAR LIMIT=20] --> <string name="get_dialog_button_label_continue">Continue</string> <!-- Separator for sign-in type and username in a sign-in entry. --> - <string name="get_dialog_sign_in_type_username_separator" translatable="false">" - "</string> + <string name="get_dialog_sign_in_type_username_separator" translatable="false">" • "</string> <!-- This text is followed by a list of one or more options. [CHAR LIMIT=80] --> <string name="get_dialog_title_sign_in_options">Sign-in options</string> <!-- Column heading for displaying sign-ins for a specific username. [CHAR LIMIT=80] --> diff --git a/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt b/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt index 43912c26f3c8..96e2d3f4e357 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt @@ -149,7 +149,10 @@ class GetFlowUtils { icon = providerIcon, displayName = providerLabel, credentialEntryList = getCredentialOptionInfoList( - it.providerFlattenedComponentName, it.credentialEntries, context + providerId = it.providerFlattenedComponentName, + providerLabel = providerLabel, + credentialEntries = it.credentialEntries, + context = context ), authenticationEntryList = getAuthenticationEntryList( it.providerFlattenedComponentName, @@ -202,6 +205,7 @@ class GetFlowUtils { */ private fun getCredentialOptionInfoList( providerId: String, + providerLabel: String, credentialEntries: List<Entry>, context: Context, ): List<CredentialEntryInfo> { @@ -212,6 +216,7 @@ class GetFlowUtils { is PasswordCredentialEntry -> { result.add(CredentialEntryInfo( providerId = providerId, + providerDisplayName = providerLabel, entryKey = it.key, entrySubkey = it.subkey, pendingIntent = credentialEntry.pendingIntent, @@ -227,6 +232,7 @@ class GetFlowUtils { is PublicKeyCredentialEntry -> { result.add(CredentialEntryInfo( providerId = providerId, + providerDisplayName = providerLabel, entryKey = it.key, entrySubkey = it.subkey, pendingIntent = credentialEntry.pendingIntent, @@ -242,6 +248,7 @@ class GetFlowUtils { is CustomCredentialEntry -> { result.add(CredentialEntryInfo( providerId = providerId, + providerDisplayName = providerLabel, entryKey = it.key, entrySubkey = it.subkey, pendingIntent = credentialEntry.pendingIntent, diff --git a/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt b/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt index 9a826f20fe03..ea56f46716f4 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt @@ -415,14 +415,15 @@ fun CredentialEntryRow( credentialEntryInfo.credentialType == CredentialType.PASSWORD) { "••••••••••••" } else { - if (TextUtils.isEmpty(credentialEntryInfo.displayName)) - credentialEntryInfo.credentialTypeDisplayName - else - credentialEntryInfo.credentialTypeDisplayName + - stringResource( - R.string.get_dialog_sign_in_type_username_separator - ) + - credentialEntryInfo.displayName + val itemsToDisplay = listOf( + credentialEntryInfo.displayName, + credentialEntryInfo.credentialTypeDisplayName, + credentialEntryInfo.providerDisplayName + ).filterNot(TextUtils::isEmpty) + if (itemsToDisplay.isEmpty()) null + else itemsToDisplay.joinToString( + separator = stringResource(R.string.get_dialog_sign_in_type_username_separator) + ) }, ) } diff --git a/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt b/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt index 9727d3f39c4a..56bc19ae7041 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt @@ -77,6 +77,7 @@ class CredentialEntryInfo( val credentialType: CredentialType, /** Localized type value of this credential used for display purpose. */ val credentialTypeDisplayName: String, + val providerDisplayName: String, val userName: String, val displayName: String?, val icon: Drawable?, |