Loading packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +16 −7 Original line number Diff line number Diff line Loading @@ -72,6 +72,12 @@ class CredentialManagerRepo( RequestInfo::class.java ) ?: testCreatePasswordRequestInfo() val originName: String? = when (requestInfo.type) { RequestInfo.TYPE_CREATE -> requestInfo.createCredentialRequest?.origin RequestInfo.TYPE_GET -> requestInfo.getCredentialRequest?.origin else -> null } providerEnabledList = when (requestInfo.type) { RequestInfo.TYPE_CREATE -> intent.extras?.getParcelableArrayList( Loading Loading @@ -105,14 +111,15 @@ class CredentialManagerRepo( val isPasskeyFirstUse = userConfigRepo.getIsPasskeyFirstUse() val providerEnableListUiState = getCreateProviderEnableListInitialUiState() val providerDisableListUiState = getCreateProviderDisableListInitialUiState() val requestDisplayInfoUiState = getCreateRequestDisplayInfoInitialUiState()!! val requestDisplayInfoUiState = getCreateRequestDisplayInfoInitialUiState(originName)!! UiState( createCredentialUiState = CreateFlowUtils.toCreateCredentialUiState( providerEnableListUiState, providerDisableListUiState, defaultProviderId, requestDisplayInfoUiState, /** isOnPasskeyIntroStateAlready = */ /** isOnPasskeyIntroStateAlready */ false, isPasskeyFirstUse )!!, Loading @@ -121,7 +128,7 @@ class CredentialManagerRepo( } RequestInfo.TYPE_GET -> UiState( createCredentialUiState = null, getCredentialUiState = getCredentialInitialUiState()!!, getCredentialUiState = getCredentialInitialUiState(originName)!!, ) else -> throw IllegalStateException("Unrecognized request type: ${requestInfo.type}") } Loading Loading @@ -172,11 +179,11 @@ class CredentialManagerRepo( } // IMPORTANT: new invocation should be mindful that this method can throw. private fun getCredentialInitialUiState(): GetCredentialUiState? { private fun getCredentialInitialUiState(originName: String?): GetCredentialUiState? { val providerEnabledList = GetFlowUtils.toProviderList( providerEnabledList as List<GetCredentialProviderData>, context ) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo, context) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo, context, originName) return GetCredentialUiState( providerEnabledList, requestDisplayInfo ?: return null, Loading @@ -198,8 +205,10 @@ class CredentialManagerRepo( ) } private fun getCreateRequestDisplayInfoInitialUiState(): RequestDisplayInfo? { return CreateFlowUtils.toRequestDisplayInfo(requestInfo, context) private fun getCreateRequestDisplayInfoInitialUiState( originName: String? ): RequestDisplayInfo? { return CreateFlowUtils.toRequestDisplayInfo(requestInfo, context, originName) } companion object { Loading packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt +6 −2 Original line number Diff line number Diff line Loading @@ -170,9 +170,11 @@ class GetFlowUtils { fun toRequestDisplayInfo( requestInfo: RequestInfo, context: Context, originName: String?, ): com.android.credentialmanager.getflow.RequestDisplayInfo? { return com.android.credentialmanager.getflow.RequestDisplayInfo( appName = getAppLabel(context.packageManager, requestInfo.appPackageName) appName = originName ?: getAppLabel(context.packageManager, requestInfo.appPackageName) ?: return null ) } Loading Loading @@ -395,8 +397,10 @@ class CreateFlowUtils { fun toRequestDisplayInfo( requestInfo: RequestInfo, context: Context, originName: String?, ): RequestDisplayInfo? { val appLabel = getAppLabel(context.packageManager, requestInfo.appPackageName) val appLabel = originName ?: getAppLabel(context.packageManager, requestInfo.appPackageName) ?: return null val createCredentialRequest = requestInfo.createCredentialRequest ?: return null val createCredentialRequestJetpack = CreateCredentialRequest.createFrom( Loading Loading
packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +16 −7 Original line number Diff line number Diff line Loading @@ -72,6 +72,12 @@ class CredentialManagerRepo( RequestInfo::class.java ) ?: testCreatePasswordRequestInfo() val originName: String? = when (requestInfo.type) { RequestInfo.TYPE_CREATE -> requestInfo.createCredentialRequest?.origin RequestInfo.TYPE_GET -> requestInfo.getCredentialRequest?.origin else -> null } providerEnabledList = when (requestInfo.type) { RequestInfo.TYPE_CREATE -> intent.extras?.getParcelableArrayList( Loading Loading @@ -105,14 +111,15 @@ class CredentialManagerRepo( val isPasskeyFirstUse = userConfigRepo.getIsPasskeyFirstUse() val providerEnableListUiState = getCreateProviderEnableListInitialUiState() val providerDisableListUiState = getCreateProviderDisableListInitialUiState() val requestDisplayInfoUiState = getCreateRequestDisplayInfoInitialUiState()!! val requestDisplayInfoUiState = getCreateRequestDisplayInfoInitialUiState(originName)!! UiState( createCredentialUiState = CreateFlowUtils.toCreateCredentialUiState( providerEnableListUiState, providerDisableListUiState, defaultProviderId, requestDisplayInfoUiState, /** isOnPasskeyIntroStateAlready = */ /** isOnPasskeyIntroStateAlready */ false, isPasskeyFirstUse )!!, Loading @@ -121,7 +128,7 @@ class CredentialManagerRepo( } RequestInfo.TYPE_GET -> UiState( createCredentialUiState = null, getCredentialUiState = getCredentialInitialUiState()!!, getCredentialUiState = getCredentialInitialUiState(originName)!!, ) else -> throw IllegalStateException("Unrecognized request type: ${requestInfo.type}") } Loading Loading @@ -172,11 +179,11 @@ class CredentialManagerRepo( } // IMPORTANT: new invocation should be mindful that this method can throw. private fun getCredentialInitialUiState(): GetCredentialUiState? { private fun getCredentialInitialUiState(originName: String?): GetCredentialUiState? { val providerEnabledList = GetFlowUtils.toProviderList( providerEnabledList as List<GetCredentialProviderData>, context ) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo, context) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo, context, originName) return GetCredentialUiState( providerEnabledList, requestDisplayInfo ?: return null, Loading @@ -198,8 +205,10 @@ class CredentialManagerRepo( ) } private fun getCreateRequestDisplayInfoInitialUiState(): RequestDisplayInfo? { return CreateFlowUtils.toRequestDisplayInfo(requestInfo, context) private fun getCreateRequestDisplayInfoInitialUiState( originName: String? ): RequestDisplayInfo? { return CreateFlowUtils.toRequestDisplayInfo(requestInfo, context, originName) } companion object { Loading
packages/CredentialManager/src/com/android/credentialmanager/DataConverter.kt +6 −2 Original line number Diff line number Diff line Loading @@ -170,9 +170,11 @@ class GetFlowUtils { fun toRequestDisplayInfo( requestInfo: RequestInfo, context: Context, originName: String?, ): com.android.credentialmanager.getflow.RequestDisplayInfo? { return com.android.credentialmanager.getflow.RequestDisplayInfo( appName = getAppLabel(context.packageManager, requestInfo.appPackageName) appName = originName ?: getAppLabel(context.packageManager, requestInfo.appPackageName) ?: return null ) } Loading Loading @@ -395,8 +397,10 @@ class CreateFlowUtils { fun toRequestDisplayInfo( requestInfo: RequestInfo, context: Context, originName: String?, ): RequestDisplayInfo? { val appLabel = getAppLabel(context.packageManager, requestInfo.appPackageName) val appLabel = originName ?: getAppLabel(context.packageManager, requestInfo.appPackageName) ?: return null val createCredentialRequest = requestInfo.createCredentialRequest ?: return null val createCredentialRequestJetpack = CreateCredentialRequest.createFrom( Loading