Merge "[CredManUi] Show provider name in get flow." into udc-dev am: b66d21c077

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21792791

Change-Id: I7e0d8597f8b9a69d45761f295841bbdba6931e58
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Helen Qin
2023-03-06 05:15:04 +00:00
committed by Automerger Merge Worker
4 changed files with 19 additions and 10 deletions

View File

@@ -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] -->

View File

@@ -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,

View File

@@ -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)
)
},
)
}

View File

@@ -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?,