diff options
| author | 2023-05-05 17:28:06 +0000 | |
|---|---|---|
| committer | 2023-05-06 00:10:41 +0000 | |
| commit | afd4518804bef62f0c3b0889a02450723b17fe79 (patch) | |
| tree | 2f2eb4297610fd57c8ce9ded27c1a32933a0b6ae | |
| parent | 793951c7c99ac8d370fef5a478350c82214144dc (diff) | |
Add a distinct name for cred reg flow.
Bug: 274494843
Bug: 273353677
Test: manual
Change-Id: I90b1fa367a7a77dfdb91be67f7de7ceb4606338a
3 files changed, 26 insertions, 2 deletions
diff --git a/core/java/android/credentials/ui/RequestInfo.java b/core/java/android/credentials/ui/RequestInfo.java index 9ebb0585afd0..3fc3be58f022 100644 --- a/core/java/android/credentials/ui/RequestInfo.java +++ b/core/java/android/credentials/ui/RequestInfo.java @@ -52,6 +52,12 @@ public final class RequestInfo implements Parcelable { @NonNull public static final String TYPE_UNDEFINED = "android.credentials.ui.TYPE_UNDEFINED"; /** Type value for a getCredential request. */ @NonNull public static final String TYPE_GET = "android.credentials.ui.TYPE_GET"; + /** Type value for a getCredential request that utilizes the credential registry. + * + * @hide + **/ + @NonNull public static final String TYPE_GET_VIA_REGISTRY = + "android.credentials.ui.TYPE_GET_VIA_REGISTRY"; /** Type value for a createCredential request. */ @NonNull public static final String TYPE_CREATE = "android.credentials.ui.TYPE_CREATE"; diff --git a/services/credentials/java/com/android/server/credentials/GetRequestSession.java b/services/credentials/java/com/android/server/credentials/GetRequestSession.java index 15034104b5e0..e9fa88328691 100644 --- a/services/credentials/java/com/android/server/credentials/GetRequestSession.java +++ b/services/credentials/java/com/android/server/credentials/GetRequestSession.java @@ -19,6 +19,7 @@ package com.android.server.credentials; import android.annotation.Nullable; import android.content.ComponentName; import android.content.Context; +import android.credentials.CredentialOption; import android.credentials.CredentialProviderInfo; import android.credentials.GetCredentialException; import android.credentials.GetCredentialRequest; @@ -52,11 +53,22 @@ public class GetRequestSession extends RequestSession<GetCredentialRequest, CancellationSignal cancellationSignal, long startedTimestamp) { super(context, sessionCallback, lock, userId, callingUid, request, callback, - RequestInfo.TYPE_GET, callingAppInfo, enabledProviders, cancellationSignal, - startedTimestamp); + getRequestInfoFromRequest(request), callingAppInfo, enabledProviders, + cancellationSignal, startedTimestamp); mRequestSessionMetric.collectGetFlowInitialMetricInfo(request); } + private static String getRequestInfoFromRequest(GetCredentialRequest request) { + for (CredentialOption option : request.getCredentialOptions()) { + if (option.getCredentialRetrievalData().getStringArrayList( + CredentialOption + .SUPPORTED_ELEMENT_KEYS) != null) { + return RequestInfo.TYPE_GET_VIA_REGISTRY; + } + } + return RequestInfo.TYPE_GET; + } + /** * Creates a new provider session, and adds it list of providers that are contributing to * this session. diff --git a/services/credentials/java/com/android/server/credentials/metrics/ApiName.java b/services/credentials/java/com/android/server/credentials/metrics/ApiName.java index 1930a4859e87..fd497965b5b1 100644 --- a/services/credentials/java/com/android/server/credentials/metrics/ApiName.java +++ b/services/credentials/java/com/android/server/credentials/metrics/ApiName.java @@ -18,11 +18,13 @@ package com.android.server.credentials.metrics; import static android.credentials.ui.RequestInfo.TYPE_CREATE; import static android.credentials.ui.RequestInfo.TYPE_GET; +import static android.credentials.ui.RequestInfo.TYPE_GET_VIA_REGISTRY; import static android.credentials.ui.RequestInfo.TYPE_UNDEFINED; import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_CLEAR_CREDENTIAL; import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_CREATE_CREDENTIAL; import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_GET_CREDENTIAL; +import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_GET_CREDENTIAL_VIA_REGISTRY; import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_IS_ENABLED_CREDENTIAL_PROVIDER_SERVICE; import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_UNKNOWN; @@ -35,6 +37,8 @@ import java.util.Map; public enum ApiName { UNKNOWN(CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_UNKNOWN), GET_CREDENTIAL(CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_GET_CREDENTIAL), + GET_CREDENTIAL_VIA_REGISTRY( +CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_GET_CREDENTIAL_VIA_REGISTRY), CREATE_CREDENTIAL( CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_CREATE_CREDENTIAL), CLEAR_CREDENTIAL( @@ -52,6 +56,8 @@ CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_IS_ENABLED_CREDENT CREATE_CREDENTIAL.mInnerMetricCode), new AbstractMap.SimpleEntry<>(TYPE_GET, GET_CREDENTIAL.mInnerMetricCode), + new AbstractMap.SimpleEntry<>(TYPE_GET_VIA_REGISTRY, + GET_CREDENTIAL_VIA_REGISTRY.mInnerMetricCode), new AbstractMap.SimpleEntry<>(TYPE_UNDEFINED, CLEAR_CREDENTIAL.mInnerMetricCode) ); |