Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d785453f authored by Omer Ozer's avatar Omer Ozer Committed by Automerger Merge Worker
Browse files

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

parents b505273e e99b007c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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";

+14 −2
Original line number Diff line number Diff line
@@ -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.
+6 −0
Original line number Diff line number Diff line
@@ -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)
    );