Loading packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +5 −5 Original line number Diff line number Diff line Loading @@ -128,7 +128,7 @@ class CredentialManagerRepo( val providerEnabledList = GetFlowUtils.toProviderList( // TODO: handle runtime cast error providerEnabledList as List<GetCredentialProviderData>, context) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo, context) return GetCredentialUiState( providerEnabledList, requestDisplayInfo, Loading Loading @@ -427,7 +427,7 @@ class CredentialManagerRepo( /*candidateQueryData=*/ Bundle(), /*requireSystemProvider=*/ false ), "tribank" "com.google.android.youtube" ) } Loading @@ -442,7 +442,7 @@ class CredentialManagerRepo( /*candidateQueryData=*/ Bundle(), /*requireSystemProvider=*/ false ), "tribank" "com.google.android.youtube" ) } Loading @@ -456,7 +456,7 @@ class CredentialManagerRepo( /*candidateQueryData=*/ Bundle(), /*requireSystemProvider=*/ false ), "tribank" "com.google.android.youtube" ) } Loading @@ -471,7 +471,7 @@ class CredentialManagerRepo( TYPE_PUBLIC_KEY_CREDENTIAL, Bundle(), Bundle(), /*requireSystemProvider=*/ false) ) .build(), "tribank.us" "com.google.android.youtube" ) } } packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt +18 −8 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.credentials.ui.CreateCredentialProviderData import android.credentials.ui.DisabledProviderData import android.credentials.ui.RequestInfo import android.graphics.drawable.Drawable import android.text.TextUtils import com.android.credentialmanager.createflow.CreateOptionInfo import com.android.credentialmanager.createflow.RemoteInfo import com.android.credentialmanager.createflow.RequestDisplayInfo Loading Loading @@ -58,7 +59,6 @@ class GetFlowUtils { ): List<ProviderInfo> { val packageManager = context.packageManager return providerDataList.map { // TODO: get from the actual service info val componentName = ComponentName.unflattenFromString(it.providerFlattenedComponentName) var packageName = componentName?.packageName if (componentName == null) { Loading @@ -70,8 +70,7 @@ class GetFlowUtils { .getPackageInfo(packageName!!, PackageManager.PackageInfoFlags.of(0)) val providerDisplayName = pkgInfo.applicationInfo.loadLabel(packageManager).toString() // TODO: get the provider icon from the service // and decide what to do when failed to load a provider icon // TODO: decide what to do when failed to load a provider icon val providerIcon = pkgInfo.applicationInfo.loadIcon(packageManager)!! ProviderInfo( id = it.providerFlattenedComponentName, Loading @@ -94,9 +93,15 @@ class GetFlowUtils { fun toRequestDisplayInfo( requestInfo: RequestInfo, context: Context, ): com.android.credentialmanager.getflow.RequestDisplayInfo { val packageName = requestInfo.appPackageName val pkgInfo = context.packageManager.getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(0)) val appLabel = pkgInfo.applicationInfo.loadSafeLabel(context.packageManager, 0f, TextUtils.SAFE_STRING_FLAG_FIRST_LINE or TextUtils.SAFE_STRING_FLAG_TRIM) return com.android.credentialmanager.getflow.RequestDisplayInfo( appDomainName = requestInfo.appPackageName appName = appLabel.toString() ) } Loading Loading @@ -251,6 +256,11 @@ class CreateFlowUtils { requestInfo: RequestInfo, context: Context, ): RequestDisplayInfo { val packageName = requestInfo.appPackageName val pkgInfo = context.packageManager.getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(0)) val appLabel = pkgInfo.applicationInfo.loadSafeLabel(context.packageManager, 0f, TextUtils.SAFE_STRING_FLAG_FIRST_LINE or TextUtils.SAFE_STRING_FLAG_TRIM) val createCredentialRequest = requestInfo.createCredentialRequest val createCredentialRequestJetpack = createCredentialRequest?.let { CreateCredentialRequest.createFrom( Loading @@ -263,7 +273,7 @@ class CreateFlowUtils { createCredentialRequestJetpack.id, createCredentialRequestJetpack.password, createCredentialRequestJetpack.type, requestInfo.appPackageName, appLabel.toString(), context.getDrawable(R.drawable.ic_password)!! ) } Loading @@ -281,7 +291,7 @@ class CreateFlowUtils { name, displayName, createCredentialRequestJetpack.type, requestInfo.appPackageName, appLabel.toString(), context.getDrawable(R.drawable.ic_passkey)!!) } // TODO: correctly parsing for other sign-ins Loading @@ -290,7 +300,7 @@ class CreateFlowUtils { "beckett-bakert@gmail.com", "Elisa Beckett", "other-sign-ins", requestInfo.appPackageName, appLabel.toString(), context.getDrawable(R.drawable.ic_other_sign_in)!!) } } Loading packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt +4 −4 Original line number Diff line number Diff line Loading @@ -550,15 +550,15 @@ fun CreationSelectionCard( text = when (requestDisplayInfo.type) { TYPE_PUBLIC_KEY_CREDENTIAL -> stringResource( R.string.choose_create_option_passkey_title, requestDisplayInfo.appDomainName requestDisplayInfo.appName ) TYPE_PASSWORD_CREDENTIAL -> stringResource( R.string.choose_create_option_password_title, requestDisplayInfo.appDomainName requestDisplayInfo.appName ) else -> stringResource( R.string.choose_create_option_sign_in_title, requestDisplayInfo.appDomainName requestDisplayInfo.appName ) }, style = MaterialTheme.typography.titleMedium, Loading Loading @@ -615,7 +615,7 @@ fun CreationSelectionCard( TextSecondary( text = stringResource( R.string.choose_create_option_description, requestDisplayInfo.appDomainName, requestDisplayInfo.appName, when (requestDisplayInfo.type) { TYPE_PUBLIC_KEY_CREDENTIAL -> stringResource(R.string.passkey) TYPE_PASSWORD_CREDENTIAL -> stringResource(R.string.password) Loading packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ data class RequestDisplayInfo( val title: String, val subtitle: String?, val type: String, val appDomainName: String, val appName: String, val typeIcon: Drawable, ) Loading packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt +1 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ fun PrimarySelectionCard( ) { R.string.get_dialog_title_use_sign_in_for } else R.string.get_dialog_title_choose_sign_in_for, requestDisplayInfo.appDomainName requestDisplayInfo.appName ), ) Loading Loading
packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +5 −5 Original line number Diff line number Diff line Loading @@ -128,7 +128,7 @@ class CredentialManagerRepo( val providerEnabledList = GetFlowUtils.toProviderList( // TODO: handle runtime cast error providerEnabledList as List<GetCredentialProviderData>, context) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo, context) return GetCredentialUiState( providerEnabledList, requestDisplayInfo, Loading Loading @@ -427,7 +427,7 @@ class CredentialManagerRepo( /*candidateQueryData=*/ Bundle(), /*requireSystemProvider=*/ false ), "tribank" "com.google.android.youtube" ) } Loading @@ -442,7 +442,7 @@ class CredentialManagerRepo( /*candidateQueryData=*/ Bundle(), /*requireSystemProvider=*/ false ), "tribank" "com.google.android.youtube" ) } Loading @@ -456,7 +456,7 @@ class CredentialManagerRepo( /*candidateQueryData=*/ Bundle(), /*requireSystemProvider=*/ false ), "tribank" "com.google.android.youtube" ) } Loading @@ -471,7 +471,7 @@ class CredentialManagerRepo( TYPE_PUBLIC_KEY_CREDENTIAL, Bundle(), Bundle(), /*requireSystemProvider=*/ false) ) .build(), "tribank.us" "com.google.android.youtube" ) } }
packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt +18 −8 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.credentials.ui.CreateCredentialProviderData import android.credentials.ui.DisabledProviderData import android.credentials.ui.RequestInfo import android.graphics.drawable.Drawable import android.text.TextUtils import com.android.credentialmanager.createflow.CreateOptionInfo import com.android.credentialmanager.createflow.RemoteInfo import com.android.credentialmanager.createflow.RequestDisplayInfo Loading Loading @@ -58,7 +59,6 @@ class GetFlowUtils { ): List<ProviderInfo> { val packageManager = context.packageManager return providerDataList.map { // TODO: get from the actual service info val componentName = ComponentName.unflattenFromString(it.providerFlattenedComponentName) var packageName = componentName?.packageName if (componentName == null) { Loading @@ -70,8 +70,7 @@ class GetFlowUtils { .getPackageInfo(packageName!!, PackageManager.PackageInfoFlags.of(0)) val providerDisplayName = pkgInfo.applicationInfo.loadLabel(packageManager).toString() // TODO: get the provider icon from the service // and decide what to do when failed to load a provider icon // TODO: decide what to do when failed to load a provider icon val providerIcon = pkgInfo.applicationInfo.loadIcon(packageManager)!! ProviderInfo( id = it.providerFlattenedComponentName, Loading @@ -94,9 +93,15 @@ class GetFlowUtils { fun toRequestDisplayInfo( requestInfo: RequestInfo, context: Context, ): com.android.credentialmanager.getflow.RequestDisplayInfo { val packageName = requestInfo.appPackageName val pkgInfo = context.packageManager.getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(0)) val appLabel = pkgInfo.applicationInfo.loadSafeLabel(context.packageManager, 0f, TextUtils.SAFE_STRING_FLAG_FIRST_LINE or TextUtils.SAFE_STRING_FLAG_TRIM) return com.android.credentialmanager.getflow.RequestDisplayInfo( appDomainName = requestInfo.appPackageName appName = appLabel.toString() ) } Loading Loading @@ -251,6 +256,11 @@ class CreateFlowUtils { requestInfo: RequestInfo, context: Context, ): RequestDisplayInfo { val packageName = requestInfo.appPackageName val pkgInfo = context.packageManager.getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(0)) val appLabel = pkgInfo.applicationInfo.loadSafeLabel(context.packageManager, 0f, TextUtils.SAFE_STRING_FLAG_FIRST_LINE or TextUtils.SAFE_STRING_FLAG_TRIM) val createCredentialRequest = requestInfo.createCredentialRequest val createCredentialRequestJetpack = createCredentialRequest?.let { CreateCredentialRequest.createFrom( Loading @@ -263,7 +273,7 @@ class CreateFlowUtils { createCredentialRequestJetpack.id, createCredentialRequestJetpack.password, createCredentialRequestJetpack.type, requestInfo.appPackageName, appLabel.toString(), context.getDrawable(R.drawable.ic_password)!! ) } Loading @@ -281,7 +291,7 @@ class CreateFlowUtils { name, displayName, createCredentialRequestJetpack.type, requestInfo.appPackageName, appLabel.toString(), context.getDrawable(R.drawable.ic_passkey)!!) } // TODO: correctly parsing for other sign-ins Loading @@ -290,7 +300,7 @@ class CreateFlowUtils { "beckett-bakert@gmail.com", "Elisa Beckett", "other-sign-ins", requestInfo.appPackageName, appLabel.toString(), context.getDrawable(R.drawable.ic_other_sign_in)!!) } } Loading
packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateCredentialComponents.kt +4 −4 Original line number Diff line number Diff line Loading @@ -550,15 +550,15 @@ fun CreationSelectionCard( text = when (requestDisplayInfo.type) { TYPE_PUBLIC_KEY_CREDENTIAL -> stringResource( R.string.choose_create_option_passkey_title, requestDisplayInfo.appDomainName requestDisplayInfo.appName ) TYPE_PASSWORD_CREDENTIAL -> stringResource( R.string.choose_create_option_password_title, requestDisplayInfo.appDomainName requestDisplayInfo.appName ) else -> stringResource( R.string.choose_create_option_sign_in_title, requestDisplayInfo.appDomainName requestDisplayInfo.appName ) }, style = MaterialTheme.typography.titleMedium, Loading Loading @@ -615,7 +615,7 @@ fun CreationSelectionCard( TextSecondary( text = stringResource( R.string.choose_create_option_description, requestDisplayInfo.appDomainName, requestDisplayInfo.appName, when (requestDisplayInfo.type) { TYPE_PUBLIC_KEY_CREDENTIAL -> stringResource(R.string.passkey) TYPE_PASSWORD_CREDENTIAL -> stringResource(R.string.password) Loading
packages/CredentialManager/src/com/android/credentialmanager/createflow/CreateModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ data class RequestDisplayInfo( val title: String, val subtitle: String?, val type: String, val appDomainName: String, val appName: String, val typeIcon: Drawable, ) Loading
packages/CredentialManager/src/com/android/credentialmanager/getflow/GetCredentialComponents.kt +1 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ fun PrimarySelectionCard( ) { R.string.get_dialog_title_use_sign_in_for } else R.string.get_dialog_title_choose_sign_in_for, requestDisplayInfo.appDomainName requestDisplayInfo.appName ), ) Loading