Merge "Fix the CredMan UI module to adopt the new credentials apis." into udc-dev am: a5e96235ae
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21694944 Change-Id: I16f85664ccd8febf08d884a2616cfc46f411bdf8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -52,9 +52,7 @@ import androidx.credentials.CreateCustomCredentialRequest
|
|||||||
import androidx.credentials.CreatePasswordRequest
|
import androidx.credentials.CreatePasswordRequest
|
||||||
import androidx.credentials.CredentialOption
|
import androidx.credentials.CredentialOption
|
||||||
import androidx.credentials.CreatePublicKeyCredentialRequest
|
import androidx.credentials.CreatePublicKeyCredentialRequest
|
||||||
import androidx.credentials.CreatePublicKeyCredentialRequestPrivileged
|
|
||||||
import androidx.credentials.GetPublicKeyCredentialOption
|
import androidx.credentials.GetPublicKeyCredentialOption
|
||||||
import androidx.credentials.GetPublicKeyCredentialOptionPrivileged
|
|
||||||
import androidx.credentials.PublicKeyCredential.Companion.TYPE_PUBLIC_KEY_CREDENTIAL
|
import androidx.credentials.PublicKeyCredential.Companion.TYPE_PUBLIC_KEY_CREDENTIAL
|
||||||
import androidx.credentials.provider.Action
|
import androidx.credentials.provider.Action
|
||||||
import androidx.credentials.provider.AuthenticationAction
|
import androidx.credentials.provider.AuthenticationAction
|
||||||
@@ -186,8 +184,6 @@ class GetFlowUtils {
|
|||||||
)
|
)
|
||||||
if (credentialOptionJetpack is GetPublicKeyCredentialOption) {
|
if (credentialOptionJetpack is GetPublicKeyCredentialOption) {
|
||||||
credentialOptionJetpack.preferImmediatelyAvailableCredentials
|
credentialOptionJetpack.preferImmediatelyAvailableCredentials
|
||||||
} else if (credentialOptionJetpack is GetPublicKeyCredentialOptionPrivileged) {
|
|
||||||
credentialOptionJetpack.preferImmediatelyAvailableCredentials
|
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
@@ -448,23 +444,14 @@ class CreateFlowUtils {
|
|||||||
createCredentialRequestJetpack.preferImmediatelyAvailableCredentials,
|
createCredentialRequestJetpack.preferImmediatelyAvailableCredentials,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is CreatePublicKeyCredentialRequestPrivileged -> {
|
|
||||||
newRequestDisplayInfoFromPasskeyJson(
|
|
||||||
requestJson = createCredentialRequestJetpack.requestJson,
|
|
||||||
appLabel = appLabel,
|
|
||||||
context = context,
|
|
||||||
preferImmediatelyAvailableCredentials =
|
|
||||||
createCredentialRequestJetpack.preferImmediatelyAvailableCredentials,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
is CreateCustomCredentialRequest -> {
|
is CreateCustomCredentialRequest -> {
|
||||||
// TODO: directly use the display info once made public
|
// TODO: directly use the display info once made public
|
||||||
val displayInfo = CreateCredentialRequest.DisplayInfo
|
val displayInfo = CreateCredentialRequest.DisplayInfo
|
||||||
.parseFromCredentialDataBundle(createCredentialRequest.credentialData)
|
.parseFromCredentialDataBundle(createCredentialRequest.credentialData)
|
||||||
?: return null
|
?: return null
|
||||||
RequestDisplayInfo(
|
RequestDisplayInfo(
|
||||||
title = displayInfo.userId,
|
title = displayInfo.userId.toString(),
|
||||||
subtitle = displayInfo.userDisplayName,
|
subtitle = displayInfo.userDisplayName?.toString(),
|
||||||
type = CredentialType.UNKNOWN,
|
type = CredentialType.UNKNOWN,
|
||||||
appName = appLabel,
|
appName = appLabel,
|
||||||
typeIcon = displayInfo.credentialTypeIcon?.loadDrawable(context)
|
typeIcon = displayInfo.credentialTypeIcon?.loadDrawable(context)
|
||||||
|
|||||||
@@ -25,7 +25,10 @@ import android.credentials.Credential.TYPE_PASSWORD_CREDENTIAL
|
|||||||
import android.credentials.ui.AuthenticationEntry
|
import android.credentials.ui.AuthenticationEntry
|
||||||
import android.credentials.ui.Entry
|
import android.credentials.ui.Entry
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.os.Bundle
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
|
import androidx.credentials.provider.BeginGetPasswordOption
|
||||||
|
import androidx.credentials.provider.BeginGetPublicKeyCredentialOption
|
||||||
import androidx.credentials.provider.CreateEntry
|
import androidx.credentials.provider.CreateEntry
|
||||||
import androidx.credentials.provider.PasswordCredentialEntry
|
import androidx.credentials.provider.PasswordCredentialEntry
|
||||||
import androidx.credentials.provider.PublicKeyCredentialEntry
|
import androidx.credentials.provider.PublicKeyCredentialEntry
|
||||||
@@ -82,7 +85,9 @@ class GetTestUtils {
|
|||||||
return Entry(
|
return Entry(
|
||||||
key,
|
key,
|
||||||
subkey,
|
subkey,
|
||||||
RemoteCredentialEntry(pendingIntent).slice
|
RemoteCredentialEntry(pendingIntent, BeginGetPublicKeyCredentialOption(
|
||||||
|
Bundle(), "id", "requestjson"
|
||||||
|
)).slice
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +142,8 @@ class GetTestUtils {
|
|||||||
intent, (PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
intent, (PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
or PendingIntent.FLAG_ONE_SHOT)
|
or PendingIntent.FLAG_ONE_SHOT)
|
||||||
)
|
)
|
||||||
val passwordEntry = PasswordCredentialEntry.Builder(context, userName, pendingIntent)
|
val passwordEntry = PasswordCredentialEntry.Builder(
|
||||||
|
context, userName, pendingIntent, BeginGetPasswordOption(Bundle(), "id"))
|
||||||
.setDisplayName(userDisplayName).setLastUsedTime(lastUsedTime).build()
|
.setDisplayName(userDisplayName).setLastUsedTime(lastUsedTime).build()
|
||||||
return Entry(key, subkey, passwordEntry.slice, Intent())
|
return Entry(key, subkey, passwordEntry.slice, Intent())
|
||||||
}
|
}
|
||||||
@@ -158,8 +164,12 @@ class GetTestUtils {
|
|||||||
intent, (PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
intent, (PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
or PendingIntent.FLAG_ONE_SHOT)
|
or PendingIntent.FLAG_ONE_SHOT)
|
||||||
)
|
)
|
||||||
val passkeyEntry = PublicKeyCredentialEntry.Builder(context, userName, pendingIntent)
|
val passkeyEntry = PublicKeyCredentialEntry.Builder(
|
||||||
.setDisplayName(userDisplayName).setLastUsedTime(lastUsedTime).build()
|
context,
|
||||||
|
userName,
|
||||||
|
pendingIntent,
|
||||||
|
BeginGetPublicKeyCredentialOption(Bundle(), "id", "requestjson")
|
||||||
|
).setDisplayName(userDisplayName).setLastUsedTime(lastUsedTime).build()
|
||||||
return Entry(key, subkey, passkeyEntry.slice, Intent())
|
return Entry(key, subkey, passkeyEntry.slice, Intent())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user