Merge "Add a distinct name for cred reg flow." into udc-dev

This commit is contained in:
Omer Ozer
2023-05-06 03:38:04 +00:00
committed by Android (Google) Code Review
3 changed files with 26 additions and 2 deletions

View File

@@ -52,6 +52,12 @@ public final class RequestInfo implements Parcelable {
@NonNull public static final String TYPE_UNDEFINED = "android.credentials.ui.TYPE_UNDEFINED"; @NonNull public static final String TYPE_UNDEFINED = "android.credentials.ui.TYPE_UNDEFINED";
/** Type value for a getCredential request. */ /** Type value for a getCredential request. */
@NonNull public static final String TYPE_GET = "android.credentials.ui.TYPE_GET"; @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. */ /** Type value for a createCredential request. */
@NonNull public static final String TYPE_CREATE = "android.credentials.ui.TYPE_CREATE"; @NonNull public static final String TYPE_CREATE = "android.credentials.ui.TYPE_CREATE";

View File

@@ -19,6 +19,7 @@ package com.android.server.credentials;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.credentials.CredentialOption;
import android.credentials.CredentialProviderInfo; import android.credentials.CredentialProviderInfo;
import android.credentials.GetCredentialException; import android.credentials.GetCredentialException;
import android.credentials.GetCredentialRequest; import android.credentials.GetCredentialRequest;
@@ -52,11 +53,22 @@ public class GetRequestSession extends RequestSession<GetCredentialRequest,
CancellationSignal cancellationSignal, CancellationSignal cancellationSignal,
long startedTimestamp) { long startedTimestamp) {
super(context, sessionCallback, lock, userId, callingUid, request, callback, super(context, sessionCallback, lock, userId, callingUid, request, callback,
RequestInfo.TYPE_GET, callingAppInfo, enabledProviders, cancellationSignal, getRequestInfoFromRequest(request), callingAppInfo, enabledProviders,
startedTimestamp); cancellationSignal, startedTimestamp);
mRequestSessionMetric.collectGetFlowInitialMetricInfo(request); 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 * Creates a new provider session, and adds it list of providers that are contributing to
* this session. * this session.

View File

@@ -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_CREATE;
import static android.credentials.ui.RequestInfo.TYPE_GET; 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 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_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_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;
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_IS_ENABLED_CREDENTIAL_PROVIDER_SERVICE;
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_UNKNOWN; 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 { public enum ApiName {
UNKNOWN(CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_UNKNOWN), 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(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( CREATE_CREDENTIAL(
CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_CREATE_CREDENTIAL), CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_CREATE_CREDENTIAL),
CLEAR_CREDENTIAL( CLEAR_CREDENTIAL(
@@ -52,6 +56,8 @@ CREDENTIAL_MANAGER_INITIAL_PHASE_REPORTED__API_NAME__API_NAME_IS_ENABLED_CREDENT
CREATE_CREDENTIAL.mInnerMetricCode), CREATE_CREDENTIAL.mInnerMetricCode),
new AbstractMap.SimpleEntry<>(TYPE_GET, new AbstractMap.SimpleEntry<>(TYPE_GET,
GET_CREDENTIAL.mInnerMetricCode), GET_CREDENTIAL.mInnerMetricCode),
new AbstractMap.SimpleEntry<>(TYPE_GET_VIA_REGISTRY,
GET_CREDENTIAL_VIA_REGISTRY.mInnerMetricCode),
new AbstractMap.SimpleEntry<>(TYPE_UNDEFINED, new AbstractMap.SimpleEntry<>(TYPE_UNDEFINED,
CLEAR_CREDENTIAL.mInnerMetricCode) CLEAR_CREDENTIAL.mInnerMetricCode)
); );