summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Omer Ozer <omerozer@google.com> 2023-05-06 03:38:04 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-05-06 03:38:04 +0000
commite99b007c262c985990eb7de0473123d05eee9394 (patch)
tree18b6c161625211da2b08b5ca395d835a38da7433
parentfc021e276ccee59dc4a695869ab72317529b4c7a (diff)
parentafd4518804bef62f0c3b0889a02450723b17fe79 (diff)
Merge "Add a distinct name for cred reg flow." into udc-dev
-rw-r--r--core/java/android/credentials/ui/RequestInfo.java6
-rw-r--r--services/credentials/java/com/android/server/credentials/GetRequestSession.java16
-rw-r--r--services/credentials/java/com/android/server/credentials/metrics/ApiName.java6
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)
);