Skip to content
Snippets Groups Projects
Commit d07055dd authored by Helen Qin's avatar Helen Qin
Browse files

Deduplicate & group entries based on a designated dedup id

(entryGroupId)

Before, we deduplication entries based on password / passkey usernames
and unknown typed credential title. However, it is possible that the unknown
typed credential will want to customize the value used for
deduplication, a value that will be different from the entry title it
want to display. This change allows that.

Bug: 306722792
Test: Screenshots attached to bug
Change-Id: I854e7afca7e999493437736d29e9ab866dfafd7a
parent cd94108a
No related branches found
No related tags found
No related merge requests found
......@@ -132,6 +132,7 @@ private fun getCredentialOptionInfoList(
lastUsedTimeMillis = credentialEntry.lastUsedTime,
isAutoSelectable = credentialEntry.isAutoSelectAllowed &&
credentialEntry.isAutoSelectAllowedFromOption,
entryGroupId = credentialEntry.entryGroupId.toString(),
)
)
}
......@@ -155,6 +156,7 @@ private fun getCredentialOptionInfoList(
lastUsedTimeMillis = credentialEntry.lastUsedTime,
isAutoSelectable = credentialEntry.isAutoSelectAllowed &&
credentialEntry.isAutoSelectAllowedFromOption,
entryGroupId = credentialEntry.entryGroupId.toString(),
)
)
}
......@@ -177,6 +179,7 @@ private fun getCredentialOptionInfoList(
lastUsedTimeMillis = credentialEntry.lastUsedTime,
isAutoSelectable = credentialEntry.isAutoSelectAllowed &&
credentialEntry.isAutoSelectAllowedFromOption,
entryGroupId = credentialEntry.entryGroupId.toString(),
)
)
}
......
......@@ -40,6 +40,8 @@ class CredentialEntryInfo(
val shouldTintIcon: Boolean,
val lastUsedTimeMillis: Instant?,
val isAutoSelectable: Boolean,
val entryGroupId: String, // Used for deduplication, and displayed as the grouping title
// "For <value-of-entryGroupId>" on the more-option screen.
) : EntryInfo(
providerId,
entryKey,
......
......@@ -16,6 +16,7 @@
package com.android.credentialmanager.getflow
import android.credentials.flags.Flags.selectorUiImprovementsEnabled
import android.graphics.drawable.Drawable
import com.android.credentialmanager.model.get.ProviderInfo
import com.android.credentialmanager.model.EntryInfo
......@@ -133,7 +134,7 @@ fun toProviderDisplayInfo(
providerInfo.credentialEntryList.forEach {
userNameToCredentialEntryMap.compute(
it.userName
if (selectorUiImprovementsEnabled()) it.entryGroupId else it.userName
) { _, v ->
if (v == null) {
mutableListOf(it)
......
......@@ -146,7 +146,8 @@ class GetCredScreenshotTest(emulationSpec: DeviceEmulationSpec) {
icon = null,
shouldTintIcon = true,
lastUsedTimeMillis = null,
isAutoSelectable = false
isAutoSelectable = false,
entryGroupId = "username",
)
),
authenticationEntryList = emptyList(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment