Loading core/java/android/credentials/ui/Constants.java +7 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,13 @@ public class Constants { public static final String EXTRA_RESULT_RECEIVER = "android.credentials.ui.extra.RESULT_RECEIVER"; /** * The intent extra key for indicating whether the bottom sheet should be started directly * on the 'All Options' screen. */ public static final String EXTRA_REQ_FOR_ALL_OPTIONS = "android.credentials.ui.extra.REQ_FOR_ALL_OPTIONS"; /** The intent action for when the enabled Credential Manager providers has been updated. */ public static final String CREDMAN_ENABLED_PROVIDERS_UPDATED = "android.credentials.ui.action.CREDMAN_ENABLED_PROVIDERS_UPDATED"; Loading core/java/android/credentials/ui/IntentFactory.java +25 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,31 @@ import java.util.ArrayList; */ @TestApi public class IntentFactory { /** * Generate a new launch intent to the Credential Selector UI. * * @hide */ @NonNull public static Intent createCredentialSelectorIntent( @NonNull RequestInfo requestInfo, @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @NonNull ArrayList<ProviderData> enabledProviderDataList, @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @NonNull ArrayList<DisabledProviderData> disabledProviderDataList, @NonNull ResultReceiver resultReceiver, boolean isRequestForAllOptions) { Intent intent = createCredentialSelectorIntent(requestInfo, enabledProviderDataList, disabledProviderDataList, resultReceiver); intent.putExtra(Constants.EXTRA_REQ_FOR_ALL_OPTIONS, isRequestForAllOptions); return intent; } /** Generate a new launch intent to the Credential Selector UI. */ @NonNull public static Intent createCredentialSelectorIntent( Loading packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +15 −4 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ class CredentialManagerRepo( isNewActivity: Boolean, ) { val requestInfo: RequestInfo? var isReqForAllOptions: Boolean = false private val providerEnabledList: List<ProviderData> private val providerDisabledList: List<DisabledProviderData>? val resultReceiver: ResultReceiver? Loading Loading @@ -102,6 +103,11 @@ class CredentialManagerRepo( ResultReceiver::class.java ) isReqForAllOptions = intent.getBooleanExtra( Constants.EXTRA_REQ_FOR_ALL_OPTIONS, /*defaultValue=*/ false ) val cancellationRequest = getCancelUiRequest(intent) val cancelUiRequestState = cancellationRequest?.let { CancelUiRequestState(getAppLabel(context.getPackageManager(), it.appPackageName)) Loading Loading @@ -141,7 +147,8 @@ class CredentialManagerRepo( ) } RequestInfo.TYPE_GET -> { val getCredentialInitialUiState = getCredentialInitialUiState(originName)!! val getCredentialInitialUiState = getCredentialInitialUiState(originName, isReqForAllOptions)!! val autoSelectEntry = findAutoSelectEntry(getCredentialInitialUiState.providerDisplayInfo) UiState( Loading Loading @@ -216,14 +223,18 @@ class CredentialManagerRepo( } // IMPORTANT: new invocation should be mindful that this method can throw. private fun getCredentialInitialUiState(originName: String?): GetCredentialUiState? { private fun getCredentialInitialUiState( originName: String?, isReqForAllOptions: Boolean ): GetCredentialUiState? { val providerEnabledList = GetFlowUtils.toProviderList( providerEnabledList as List<GetCredentialProviderData>, context ) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo, context, originName) return GetCredentialUiState( isReqForAllOptions, providerEnabledList, requestDisplayInfo ?: return null, requestDisplayInfo ?: return null ) } Loading packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt +7 −2 Original line number Diff line number Diff line Loading @@ -26,10 +26,12 @@ import com.android.credentialmanager.model.get.RemoteEntryInfo import com.android.internal.util.Preconditions data class GetCredentialUiState( val isRequestForAllOptions: Boolean, val providerInfoList: List<ProviderInfo>, val requestDisplayInfo: RequestDisplayInfo, val providerDisplayInfo: ProviderDisplayInfo = toProviderDisplayInfo(providerInfoList), val currentScreenState: GetScreenState = toGetScreenState(providerDisplayInfo), val currentScreenState: GetScreenState = toGetScreenState( providerDisplayInfo, isRequestForAllOptions), val activeEntry: EntryInfo? = toActiveEntry(providerDisplayInfo), val isNoAccount: Boolean = false, ) Loading Loading @@ -184,7 +186,8 @@ private fun toActiveEntry( } private fun toGetScreenState( providerDisplayInfo: ProviderDisplayInfo providerDisplayInfo: ProviderDisplayInfo, isRequestForAllOptions: Boolean ): GetScreenState { return if (providerDisplayInfo.sortedUserNameToCredentialEntryList.isEmpty() && providerDisplayInfo.remoteEntry == null && Loading @@ -194,6 +197,8 @@ private fun toGetScreenState( providerDisplayInfo.authenticationEntryList.isEmpty() && providerDisplayInfo.remoteEntry != null) GetScreenState.REMOTE_ONLY else if (isRequestForAllOptions) GetScreenState.ALL_SIGN_IN_OPTIONS else GetScreenState.PRIMARY_SELECTION } Loading services/credentials/java/com/android/server/credentials/CreateRequestSession.java +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR PermissionUtils.hasPermission(mContext, mClientAppInfo.getPackageName(), Manifest.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS), /*defaultProviderId=*/flattenedPrimaryProviders), providerDataList); providerDataList, /*isRequestForAllOptions=*/ false); mClientCallback.onPendingIntent(mPendingIntent); } catch (RemoteException e) { mRequestSessionMetric.collectUiReturnedFinalPhase(/*uiReturned=*/ false); Loading Loading
core/java/android/credentials/ui/Constants.java +7 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,13 @@ public class Constants { public static final String EXTRA_RESULT_RECEIVER = "android.credentials.ui.extra.RESULT_RECEIVER"; /** * The intent extra key for indicating whether the bottom sheet should be started directly * on the 'All Options' screen. */ public static final String EXTRA_REQ_FOR_ALL_OPTIONS = "android.credentials.ui.extra.REQ_FOR_ALL_OPTIONS"; /** The intent action for when the enabled Credential Manager providers has been updated. */ public static final String CREDMAN_ENABLED_PROVIDERS_UPDATED = "android.credentials.ui.action.CREDMAN_ENABLED_PROVIDERS_UPDATED"; Loading
core/java/android/credentials/ui/IntentFactory.java +25 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,31 @@ import java.util.ArrayList; */ @TestApi public class IntentFactory { /** * Generate a new launch intent to the Credential Selector UI. * * @hide */ @NonNull public static Intent createCredentialSelectorIntent( @NonNull RequestInfo requestInfo, @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @NonNull ArrayList<ProviderData> enabledProviderDataList, @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @NonNull ArrayList<DisabledProviderData> disabledProviderDataList, @NonNull ResultReceiver resultReceiver, boolean isRequestForAllOptions) { Intent intent = createCredentialSelectorIntent(requestInfo, enabledProviderDataList, disabledProviderDataList, resultReceiver); intent.putExtra(Constants.EXTRA_REQ_FOR_ALL_OPTIONS, isRequestForAllOptions); return intent; } /** Generate a new launch intent to the Credential Selector UI. */ @NonNull public static Intent createCredentialSelectorIntent( Loading
packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +15 −4 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ class CredentialManagerRepo( isNewActivity: Boolean, ) { val requestInfo: RequestInfo? var isReqForAllOptions: Boolean = false private val providerEnabledList: List<ProviderData> private val providerDisabledList: List<DisabledProviderData>? val resultReceiver: ResultReceiver? Loading Loading @@ -102,6 +103,11 @@ class CredentialManagerRepo( ResultReceiver::class.java ) isReqForAllOptions = intent.getBooleanExtra( Constants.EXTRA_REQ_FOR_ALL_OPTIONS, /*defaultValue=*/ false ) val cancellationRequest = getCancelUiRequest(intent) val cancelUiRequestState = cancellationRequest?.let { CancelUiRequestState(getAppLabel(context.getPackageManager(), it.appPackageName)) Loading Loading @@ -141,7 +147,8 @@ class CredentialManagerRepo( ) } RequestInfo.TYPE_GET -> { val getCredentialInitialUiState = getCredentialInitialUiState(originName)!! val getCredentialInitialUiState = getCredentialInitialUiState(originName, isReqForAllOptions)!! val autoSelectEntry = findAutoSelectEntry(getCredentialInitialUiState.providerDisplayInfo) UiState( Loading Loading @@ -216,14 +223,18 @@ class CredentialManagerRepo( } // IMPORTANT: new invocation should be mindful that this method can throw. private fun getCredentialInitialUiState(originName: String?): GetCredentialUiState? { private fun getCredentialInitialUiState( originName: String?, isReqForAllOptions: Boolean ): GetCredentialUiState? { val providerEnabledList = GetFlowUtils.toProviderList( providerEnabledList as List<GetCredentialProviderData>, context ) val requestDisplayInfo = GetFlowUtils.toRequestDisplayInfo(requestInfo, context, originName) return GetCredentialUiState( isReqForAllOptions, providerEnabledList, requestDisplayInfo ?: return null, requestDisplayInfo ?: return null ) } Loading
packages/CredentialManager/src/com/android/credentialmanager/getflow/GetModel.kt +7 −2 Original line number Diff line number Diff line Loading @@ -26,10 +26,12 @@ import com.android.credentialmanager.model.get.RemoteEntryInfo import com.android.internal.util.Preconditions data class GetCredentialUiState( val isRequestForAllOptions: Boolean, val providerInfoList: List<ProviderInfo>, val requestDisplayInfo: RequestDisplayInfo, val providerDisplayInfo: ProviderDisplayInfo = toProviderDisplayInfo(providerInfoList), val currentScreenState: GetScreenState = toGetScreenState(providerDisplayInfo), val currentScreenState: GetScreenState = toGetScreenState( providerDisplayInfo, isRequestForAllOptions), val activeEntry: EntryInfo? = toActiveEntry(providerDisplayInfo), val isNoAccount: Boolean = false, ) Loading Loading @@ -184,7 +186,8 @@ private fun toActiveEntry( } private fun toGetScreenState( providerDisplayInfo: ProviderDisplayInfo providerDisplayInfo: ProviderDisplayInfo, isRequestForAllOptions: Boolean ): GetScreenState { return if (providerDisplayInfo.sortedUserNameToCredentialEntryList.isEmpty() && providerDisplayInfo.remoteEntry == null && Loading @@ -194,6 +197,8 @@ private fun toGetScreenState( providerDisplayInfo.authenticationEntryList.isEmpty() && providerDisplayInfo.remoteEntry != null) GetScreenState.REMOTE_ONLY else if (isRequestForAllOptions) GetScreenState.ALL_SIGN_IN_OPTIONS else GetScreenState.PRIMARY_SELECTION } Loading
services/credentials/java/com/android/server/credentials/CreateRequestSession.java +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR PermissionUtils.hasPermission(mContext, mClientAppInfo.getPackageName(), Manifest.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS), /*defaultProviderId=*/flattenedPrimaryProviders), providerDataList); providerDataList, /*isRequestForAllOptions=*/ false); mClientCallback.onPendingIntent(mPendingIntent); } catch (RemoteException e) { mRequestSessionMetric.collectUiReturnedFinalPhase(/*uiReturned=*/ false); Loading