Loading core/java/android/credentials/selection/Constants.java +0 −7 Original line number Original line Diff line number Diff line Loading @@ -29,13 +29,6 @@ public class Constants { public static final String EXTRA_RESULT_RECEIVER = public static final String EXTRA_RESULT_RECEIVER = "android.credentials.selection.extra.RESULT_RECEIVER"; "android.credentials.selection.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.selection.extra.REQ_FOR_ALL_OPTIONS"; /** /** * The intent extra key for the final result receiver object * The intent extra key for the final result receiver object */ */ Loading core/java/android/credentials/selection/IntentFactory.java +9 −22 Original line number Original line Diff line number Diff line Loading @@ -48,41 +48,28 @@ import java.util.ArrayList; public class IntentFactory { public class IntentFactory { /** /** * Generate a new launch intent to the Credential Selector UI for auto-filling. * Generate a new launch intent to the Credential Selector UI for auto-filling. This intent is * invoked from the Autofill flow, when the user requests to bring up the 'All Options' page of * the credential bottom-sheet. When the user clicks on the pinned entry, the intent will bring * up the 'All Options' page of the bottom-sheet. The provider data list is processed by the * credential autofill service for each autofill id and passed in as an auth extra. * * * @hide * @hide */ */ @NonNull @NonNull // TODO(b/323552850) - clean up method overloads public static Intent createCredentialSelectorIntentForAutofill( public static Intent createCredentialSelectorIntent( @NonNull Context context, @NonNull Context context, @NonNull RequestInfo requestInfo, @NonNull RequestInfo requestInfo, @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @Nullable ArrayList<ProviderData> enabledProviderDataList, @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @NonNull @NonNull ArrayList<DisabledProviderData> disabledProviderDataList, ArrayList<DisabledProviderData> disabledProviderDataList, @NonNull ResultReceiver resultReceiver, @NonNull ResultReceiver resultReceiver) { boolean isRequestForAllOptions) { return createCredentialSelectorIntent(context, requestInfo, Intent intent; if (enabledProviderDataList != null) { intent = createCredentialSelectorIntent(context, requestInfo, enabledProviderDataList, disabledProviderDataList, resultReceiver); } else { intent = createCredentialSelectorIntent(context, requestInfo, disabledProviderDataList, resultReceiver); disabledProviderDataList, resultReceiver); } } intent.putExtra(Constants.EXTRA_REQ_FOR_ALL_OPTIONS, isRequestForAllOptions); return intent; } /** /** * Generate a new launch intent to the Credential Selector UI. * Generate a new launch intent to the Credential Selector UI. * * @hide */ */ @NonNull @NonNull private static Intent createCredentialSelectorIntent( private static Intent createCredentialSelectorIntent( Loading packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +1 −5 Original line number Original line Diff line number Diff line Loading @@ -110,11 +110,7 @@ class CredentialManagerRepo( ResultReceiver::class.java ResultReceiver::class.java ) ) isReqForAllOptions = intent.getBooleanExtra( isReqForAllOptions = requestInfo?.isShowAllOptionsRequested ?: false Constants.EXTRA_REQ_FOR_ALL_OPTIONS, /*defaultValue=*/ false ) || (requestInfo?.isShowAllOptionsRequested ?: false) // TODO(b/323552850) - Remove // usage on Constants.EXTRA_REQ_FOR_ALL_OPTIONS once it is deprecated. val cancellationRequest = getCancelUiRequest(intent) val cancellationRequest = getCancelUiRequest(intent) val cancelUiRequestState = cancellationRequest?.let { val cancelUiRequestState = cancellationRequest?.let { Loading services/credentials/java/com/android/server/credentials/CreateRequestSession.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -104,7 +104,6 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR flattenedPrimaryProviders.add(cn.flattenToString()); flattenedPrimaryProviders.add(cn.flattenToString()); } } final boolean isShowAllOptionsRequested = false; mPendingIntent = mCredentialManagerUi.createPendingIntent( mPendingIntent = mCredentialManagerUi.createPendingIntent( RequestInfo.newCreateRequestInfo( RequestInfo.newCreateRequestInfo( mRequestId, mClientRequest, mRequestId, mClientRequest, Loading @@ -112,8 +111,8 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR PermissionUtils.hasPermission(mContext, mClientAppInfo.getPackageName(), PermissionUtils.hasPermission(mContext, mClientAppInfo.getPackageName(), Manifest.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS), Manifest.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS), /*defaultProviderId=*/flattenedPrimaryProviders, /*defaultProviderId=*/flattenedPrimaryProviders, isShowAllOptionsRequested), /*isShowAllOptionsRequested=*/ false), providerDataList, /*isRequestForAllOptions=*/ isShowAllOptionsRequested); providerDataList); mClientCallback.onPendingIntent(mPendingIntent); mClientCallback.onPendingIntent(mPendingIntent); } catch (RemoteException e) { } catch (RemoteException e) { mRequestSessionMetric.collectUiReturnedFinalPhase(/*uiReturned=*/ false); mRequestSessionMetric.collectUiReturnedFinalPhase(/*uiReturned=*/ false); Loading services/credentials/java/com/android/server/credentials/CredentialManagerUi.java +35 −10 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.credentials; import static android.credentials.selection.Constants.EXTRA_FINAL_RESPONSE_RECEIVER; import static android.credentials.selection.Constants.EXTRA_FINAL_RESPONSE_RECEIVER; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.PendingIntent; import android.app.PendingIntent; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; Loading Loading @@ -152,16 +153,34 @@ public class CredentialManagerUi { /** /** * Creates a {@link PendingIntent} to be used to invoke the credential manager selector UI, * Creates a {@link PendingIntent} to be used to invoke the credential manager selector UI, * by the calling app process. * by the calling app process. The bottom-sheet navigates to the default page when the intent * is invoked. * * * @param requestInfo the information about the request * @param requestInfo the information about the request * @param providerDataList the list of provider data from remote providers * @param providerDataList the list of provider data from remote providers * @param isRequestForAllOptions whether the bottom sheet should directly navigate to the * all options page */ */ public PendingIntent createPendingIntent( public PendingIntent createPendingIntent( RequestInfo requestInfo, ArrayList<ProviderData> providerDataList, RequestInfo requestInfo, ArrayList<ProviderData> providerDataList) { boolean isRequestForAllOptions) { return createPendingIntent(requestInfo, providerDataList, /*forAutofill=*/ false); } /** * Creates a {@link PendingIntent} to be used to invoke the credential manager selector UI, * by the calling app process. This intent is invoked from the Autofill flow, when the user * requests to bring up the 'All Options' page of the credential bottom-sheet. When the user * clicks on the pinned entry, the intent will bring up the 'All Options' page of the * bottom-sheet. The provider data list is processed by the credential autofill service for * each autofill id and passed in as an auth extra. * * @param requestInfo the information about the request */ public PendingIntent createPendingIntentForAutofill(RequestInfo requestInfo) { return createPendingIntent(requestInfo, /*providerDataList=*/ null, /*forAutofill=*/ true); } private PendingIntent createPendingIntent( RequestInfo requestInfo, @Nullable ArrayList<ProviderData> providerDataList, boolean forAutofill) { List<CredentialProviderInfo> allProviders = List<CredentialProviderInfo> allProviders = CredentialProviderInfoFactory.getCredentialProviderServices( CredentialProviderInfoFactory.getCredentialProviderServices( mContext, mContext, Loading @@ -176,11 +195,17 @@ public class CredentialManagerUi { .map(disabledProvider -> new DisabledProviderData( .map(disabledProvider -> new DisabledProviderData( disabledProvider.getComponentName().flattenToString())).toList(); disabledProvider.getComponentName().flattenToString())).toList(); Intent intent = IntentFactory.createCredentialSelectorIntent(mContext, requestInfo, Intent intent; providerDataList, if (forAutofill) { new ArrayList<>(disabledProviderDataList), mResultReceiver, intent = IntentFactory.createCredentialSelectorIntentForAutofill( isRequestForAllOptions) mContext, requestInfo, new ArrayList<>(disabledProviderDataList), .setAction(UUID.randomUUID().toString()); mResultReceiver); } else { intent = IntentFactory.createCredentialSelectorIntent( mContext, requestInfo, providerDataList, new ArrayList<>(disabledProviderDataList), mResultReceiver); } intent.setAction(UUID.randomUUID().toString()); //TODO: Create unique pending intent using request code and cancel any pre-existing pending //TODO: Create unique pending intent using request code and cancel any pre-existing pending // intents // intents return PendingIntent.getActivityAsUser( return PendingIntent.getActivityAsUser( Loading Loading
core/java/android/credentials/selection/Constants.java +0 −7 Original line number Original line Diff line number Diff line Loading @@ -29,13 +29,6 @@ public class Constants { public static final String EXTRA_RESULT_RECEIVER = public static final String EXTRA_RESULT_RECEIVER = "android.credentials.selection.extra.RESULT_RECEIVER"; "android.credentials.selection.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.selection.extra.REQ_FOR_ALL_OPTIONS"; /** /** * The intent extra key for the final result receiver object * The intent extra key for the final result receiver object */ */ Loading
core/java/android/credentials/selection/IntentFactory.java +9 −22 Original line number Original line Diff line number Diff line Loading @@ -48,41 +48,28 @@ import java.util.ArrayList; public class IntentFactory { public class IntentFactory { /** /** * Generate a new launch intent to the Credential Selector UI for auto-filling. * Generate a new launch intent to the Credential Selector UI for auto-filling. This intent is * invoked from the Autofill flow, when the user requests to bring up the 'All Options' page of * the credential bottom-sheet. When the user clicks on the pinned entry, the intent will bring * up the 'All Options' page of the bottom-sheet. The provider data list is processed by the * credential autofill service for each autofill id and passed in as an auth extra. * * * @hide * @hide */ */ @NonNull @NonNull // TODO(b/323552850) - clean up method overloads public static Intent createCredentialSelectorIntentForAutofill( public static Intent createCredentialSelectorIntent( @NonNull Context context, @NonNull Context context, @NonNull RequestInfo requestInfo, @NonNull RequestInfo requestInfo, @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @Nullable ArrayList<ProviderData> enabledProviderDataList, @SuppressLint("ConcreteCollection") // Concrete collection needed for marshalling. @NonNull @NonNull ArrayList<DisabledProviderData> disabledProviderDataList, ArrayList<DisabledProviderData> disabledProviderDataList, @NonNull ResultReceiver resultReceiver, @NonNull ResultReceiver resultReceiver) { boolean isRequestForAllOptions) { return createCredentialSelectorIntent(context, requestInfo, Intent intent; if (enabledProviderDataList != null) { intent = createCredentialSelectorIntent(context, requestInfo, enabledProviderDataList, disabledProviderDataList, resultReceiver); } else { intent = createCredentialSelectorIntent(context, requestInfo, disabledProviderDataList, resultReceiver); disabledProviderDataList, resultReceiver); } } intent.putExtra(Constants.EXTRA_REQ_FOR_ALL_OPTIONS, isRequestForAllOptions); return intent; } /** /** * Generate a new launch intent to the Credential Selector UI. * Generate a new launch intent to the Credential Selector UI. * * @hide */ */ @NonNull @NonNull private static Intent createCredentialSelectorIntent( private static Intent createCredentialSelectorIntent( Loading
packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +1 −5 Original line number Original line Diff line number Diff line Loading @@ -110,11 +110,7 @@ class CredentialManagerRepo( ResultReceiver::class.java ResultReceiver::class.java ) ) isReqForAllOptions = intent.getBooleanExtra( isReqForAllOptions = requestInfo?.isShowAllOptionsRequested ?: false Constants.EXTRA_REQ_FOR_ALL_OPTIONS, /*defaultValue=*/ false ) || (requestInfo?.isShowAllOptionsRequested ?: false) // TODO(b/323552850) - Remove // usage on Constants.EXTRA_REQ_FOR_ALL_OPTIONS once it is deprecated. val cancellationRequest = getCancelUiRequest(intent) val cancellationRequest = getCancelUiRequest(intent) val cancelUiRequestState = cancellationRequest?.let { val cancelUiRequestState = cancellationRequest?.let { Loading
services/credentials/java/com/android/server/credentials/CreateRequestSession.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -104,7 +104,6 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR flattenedPrimaryProviders.add(cn.flattenToString()); flattenedPrimaryProviders.add(cn.flattenToString()); } } final boolean isShowAllOptionsRequested = false; mPendingIntent = mCredentialManagerUi.createPendingIntent( mPendingIntent = mCredentialManagerUi.createPendingIntent( RequestInfo.newCreateRequestInfo( RequestInfo.newCreateRequestInfo( mRequestId, mClientRequest, mRequestId, mClientRequest, Loading @@ -112,8 +111,8 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR PermissionUtils.hasPermission(mContext, mClientAppInfo.getPackageName(), PermissionUtils.hasPermission(mContext, mClientAppInfo.getPackageName(), Manifest.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS), Manifest.permission.CREDENTIAL_MANAGER_SET_ALLOWED_PROVIDERS), /*defaultProviderId=*/flattenedPrimaryProviders, /*defaultProviderId=*/flattenedPrimaryProviders, isShowAllOptionsRequested), /*isShowAllOptionsRequested=*/ false), providerDataList, /*isRequestForAllOptions=*/ isShowAllOptionsRequested); providerDataList); mClientCallback.onPendingIntent(mPendingIntent); mClientCallback.onPendingIntent(mPendingIntent); } catch (RemoteException e) { } catch (RemoteException e) { mRequestSessionMetric.collectUiReturnedFinalPhase(/*uiReturned=*/ false); mRequestSessionMetric.collectUiReturnedFinalPhase(/*uiReturned=*/ false); Loading
services/credentials/java/com/android/server/credentials/CredentialManagerUi.java +35 −10 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.credentials; import static android.credentials.selection.Constants.EXTRA_FINAL_RESPONSE_RECEIVER; import static android.credentials.selection.Constants.EXTRA_FINAL_RESPONSE_RECEIVER; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.PendingIntent; import android.app.PendingIntent; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; Loading Loading @@ -152,16 +153,34 @@ public class CredentialManagerUi { /** /** * Creates a {@link PendingIntent} to be used to invoke the credential manager selector UI, * Creates a {@link PendingIntent} to be used to invoke the credential manager selector UI, * by the calling app process. * by the calling app process. The bottom-sheet navigates to the default page when the intent * is invoked. * * * @param requestInfo the information about the request * @param requestInfo the information about the request * @param providerDataList the list of provider data from remote providers * @param providerDataList the list of provider data from remote providers * @param isRequestForAllOptions whether the bottom sheet should directly navigate to the * all options page */ */ public PendingIntent createPendingIntent( public PendingIntent createPendingIntent( RequestInfo requestInfo, ArrayList<ProviderData> providerDataList, RequestInfo requestInfo, ArrayList<ProviderData> providerDataList) { boolean isRequestForAllOptions) { return createPendingIntent(requestInfo, providerDataList, /*forAutofill=*/ false); } /** * Creates a {@link PendingIntent} to be used to invoke the credential manager selector UI, * by the calling app process. This intent is invoked from the Autofill flow, when the user * requests to bring up the 'All Options' page of the credential bottom-sheet. When the user * clicks on the pinned entry, the intent will bring up the 'All Options' page of the * bottom-sheet. The provider data list is processed by the credential autofill service for * each autofill id and passed in as an auth extra. * * @param requestInfo the information about the request */ public PendingIntent createPendingIntentForAutofill(RequestInfo requestInfo) { return createPendingIntent(requestInfo, /*providerDataList=*/ null, /*forAutofill=*/ true); } private PendingIntent createPendingIntent( RequestInfo requestInfo, @Nullable ArrayList<ProviderData> providerDataList, boolean forAutofill) { List<CredentialProviderInfo> allProviders = List<CredentialProviderInfo> allProviders = CredentialProviderInfoFactory.getCredentialProviderServices( CredentialProviderInfoFactory.getCredentialProviderServices( mContext, mContext, Loading @@ -176,11 +195,17 @@ public class CredentialManagerUi { .map(disabledProvider -> new DisabledProviderData( .map(disabledProvider -> new DisabledProviderData( disabledProvider.getComponentName().flattenToString())).toList(); disabledProvider.getComponentName().flattenToString())).toList(); Intent intent = IntentFactory.createCredentialSelectorIntent(mContext, requestInfo, Intent intent; providerDataList, if (forAutofill) { new ArrayList<>(disabledProviderDataList), mResultReceiver, intent = IntentFactory.createCredentialSelectorIntentForAutofill( isRequestForAllOptions) mContext, requestInfo, new ArrayList<>(disabledProviderDataList), .setAction(UUID.randomUUID().toString()); mResultReceiver); } else { intent = IntentFactory.createCredentialSelectorIntent( mContext, requestInfo, providerDataList, new ArrayList<>(disabledProviderDataList), mResultReceiver); } intent.setAction(UUID.randomUUID().toString()); //TODO: Create unique pending intent using request code and cancel any pre-existing pending //TODO: Create unique pending intent using request code and cancel any pre-existing pending // intents // intents return PendingIntent.getActivityAsUser( return PendingIntent.getActivityAsUser( Loading