Merge "Generating Provider Status Enum Consistently" into udc-dev
This commit is contained in:
@@ -31,6 +31,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.android.server.credentials.metrics.ApiName;
|
import com.android.server.credentials.metrics.ApiName;
|
||||||
import com.android.server.credentials.metrics.ApiStatus;
|
import com.android.server.credentials.metrics.ApiStatus;
|
||||||
|
import com.android.server.credentials.metrics.ProviderStatusForMetrics;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -120,22 +121,22 @@ public final class ClearRequestSession extends RequestSession<ClearCredentialSta
|
|||||||
Log.i(TAG, "respondToClientWithResponseAndFinish");
|
Log.i(TAG, "respondToClientWithResponseAndFinish");
|
||||||
if (isSessionCancelled()) {
|
if (isSessionCancelled()) {
|
||||||
mChosenProviderMetric.setChosenProviderStatus(
|
mChosenProviderMetric.setChosenProviderStatus(
|
||||||
MetricUtilities.METRICS_PROVIDER_STATUS_FINAL_SUCCESS);
|
ProviderStatusForMetrics.FINAL_SUCCESS.getMetricCode());
|
||||||
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_CLIENT_CANCELED);
|
ApiStatus.CLIENT_CANCELED);
|
||||||
finishSession(/*propagateCancellation=*/true);
|
finishSession(/*propagateCancellation=*/true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mClientCallback.onSuccess();
|
mClientCallback.onSuccess();
|
||||||
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_SUCCESS);
|
ApiStatus.SUCCESS);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
mChosenProviderMetric.setChosenProviderStatus(
|
mChosenProviderMetric.setChosenProviderStatus(
|
||||||
MetricUtilities.METRICS_PROVIDER_STATUS_FINAL_FAILURE);
|
ProviderStatusForMetrics.FINAL_FAILURE.getMetricCode());
|
||||||
Log.i(TAG, "Issue while propagating the response to the client");
|
Log.i(TAG, "Issue while propagating the response to the client");
|
||||||
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_FAILURE);
|
ApiStatus.FAILURE);
|
||||||
}
|
}
|
||||||
finishSession(/*propagateCancellation=*/false);
|
finishSession(/*propagateCancellation=*/false);
|
||||||
}
|
}
|
||||||
@@ -144,7 +145,7 @@ public final class ClearRequestSession extends RequestSession<ClearCredentialSta
|
|||||||
Log.i(TAG, "respondToClientWithErrorAndFinish");
|
Log.i(TAG, "respondToClientWithErrorAndFinish");
|
||||||
if (isSessionCancelled()) {
|
if (isSessionCancelled()) {
|
||||||
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_CLIENT_CANCELED);
|
ApiStatus.CLIENT_CANCELED);
|
||||||
finishSession(/*propagateCancellation=*/true);
|
finishSession(/*propagateCancellation=*/true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -154,7 +155,7 @@ public final class ClearRequestSession extends RequestSession<ClearCredentialSta
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CLEAR_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_FAILURE);
|
ApiStatus.FAILURE);
|
||||||
finishSession(/*propagateCancellation=*/false);
|
finishSession(/*propagateCancellation=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.credentials;
|
package com.android.server.credentials;
|
||||||
|
|
||||||
import static com.android.server.credentials.MetricUtilities.METRICS_PROVIDER_STATUS_FINAL_FAILURE;
|
|
||||||
import static com.android.server.credentials.MetricUtilities.METRICS_PROVIDER_STATUS_FINAL_SUCCESS;
|
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
@@ -38,6 +35,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.android.server.credentials.metrics.ApiName;
|
import com.android.server.credentials.metrics.ApiName;
|
||||||
import com.android.server.credentials.metrics.ApiStatus;
|
import com.android.server.credentials.metrics.ApiStatus;
|
||||||
|
import com.android.server.credentials.metrics.ProviderStatusForMetrics;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -103,11 +101,11 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
|
|||||||
setChosenMetric(componentName);
|
setChosenMetric(componentName);
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
mChosenProviderMetric.setChosenProviderStatus(
|
mChosenProviderMetric.setChosenProviderStatus(
|
||||||
METRICS_PROVIDER_STATUS_FINAL_SUCCESS);
|
ProviderStatusForMetrics.FINAL_SUCCESS.getMetricCode());
|
||||||
respondToClientWithResponseAndFinish(response);
|
respondToClientWithResponseAndFinish(response);
|
||||||
} else {
|
} else {
|
||||||
mChosenProviderMetric.setChosenProviderStatus(
|
mChosenProviderMetric.setChosenProviderStatus(
|
||||||
METRICS_PROVIDER_STATUS_FINAL_FAILURE);
|
ProviderStatusForMetrics.FINAL_FAILURE.getMetricCode());
|
||||||
respondToClientWithErrorAndFinish(CreateCredentialException.TYPE_NO_CREATE_OPTIONS,
|
respondToClientWithErrorAndFinish(CreateCredentialException.TYPE_NO_CREATE_OPTIONS,
|
||||||
"Invalid response");
|
"Invalid response");
|
||||||
}
|
}
|
||||||
@@ -144,18 +142,18 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
|
|||||||
}
|
}
|
||||||
if (isSessionCancelled()) {
|
if (isSessionCancelled()) {
|
||||||
logApiCall(ApiName.CREATE_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CREATE_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_CLIENT_CANCELED);
|
ApiStatus.CLIENT_CANCELED);
|
||||||
finishSession(/*propagateCancellation=*/true);
|
finishSession(/*propagateCancellation=*/true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mClientCallback.onResponse(response);
|
mClientCallback.onResponse(response);
|
||||||
logApiCall(ApiName.CREATE_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CREATE_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_SUCCESS);
|
ApiStatus.SUCCESS);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.i(TAG, "Issue while responding to client: " + e.getMessage());
|
Log.i(TAG, "Issue while responding to client: " + e.getMessage());
|
||||||
logApiCall(ApiName.CREATE_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CREATE_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_FAILURE);
|
ApiStatus.FAILURE);
|
||||||
}
|
}
|
||||||
finishSession(/*propagateCancellation=*/false);
|
finishSession(/*propagateCancellation=*/false);
|
||||||
}
|
}
|
||||||
@@ -168,7 +166,7 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
|
|||||||
}
|
}
|
||||||
if (isSessionCancelled()) {
|
if (isSessionCancelled()) {
|
||||||
logApiCall(ApiName.CREATE_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.CREATE_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_CLIENT_CANCELED);
|
ApiStatus.CLIENT_CANCELED);
|
||||||
finishSession(/*propagateCancellation=*/true);
|
finishSession(/*propagateCancellation=*/true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -184,10 +182,10 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
|
|||||||
private void logFailureOrUserCancel(String errorType) {
|
private void logFailureOrUserCancel(String errorType) {
|
||||||
if (CreateCredentialException.TYPE_USER_CANCELED.equals(errorType)) {
|
if (CreateCredentialException.TYPE_USER_CANCELED.equals(errorType)) {
|
||||||
logApiCall(ApiName.CREATE_CREDENTIAL,
|
logApiCall(ApiName.CREATE_CREDENTIAL,
|
||||||
/* apiStatus */ ApiStatus.METRICS_API_STATUS_USER_CANCELED);
|
/* apiStatus */ ApiStatus.USER_CANCELED);
|
||||||
} else {
|
} else {
|
||||||
logApiCall(ApiName.CREATE_CREDENTIAL,
|
logApiCall(ApiName.CREATE_CREDENTIAL,
|
||||||
/* apiStatus */ ApiStatus.METRICS_API_STATUS_FAILURE);
|
/* apiStatus */ ApiStatus.FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ public final class CredentialManagerService
|
|||||||
// The component name and the package name do not match.
|
// The component name and the package name do not match.
|
||||||
MetricUtilities.logApiCalled(
|
MetricUtilities.logApiCalled(
|
||||||
ApiName.IS_ENABLED_CREDENTIAL_PROVIDER_SERVICE,
|
ApiName.IS_ENABLED_CREDENTIAL_PROVIDER_SERVICE,
|
||||||
ApiStatus.METRICS_API_STATUS_FAILURE, callingUid);
|
ApiStatus.FAILURE, callingUid);
|
||||||
Log.w(
|
Log.w(
|
||||||
TAG,
|
TAG,
|
||||||
"isEnabledCredentialProviderService: Component name does not"
|
"isEnabledCredentialProviderService: Component name does not"
|
||||||
@@ -667,7 +667,7 @@ public final class CredentialManagerService
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MetricUtilities.logApiCalled(ApiName.IS_ENABLED_CREDENTIAL_PROVIDER_SERVICE,
|
MetricUtilities.logApiCalled(ApiName.IS_ENABLED_CREDENTIAL_PROVIDER_SERVICE,
|
||||||
ApiStatus.METRICS_API_STATUS_SUCCESS, callingUid);
|
ApiStatus.SUCCESS, callingUid);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.credentials;
|
package com.android.server.credentials;
|
||||||
|
|
||||||
import static com.android.server.credentials.MetricUtilities.METRICS_PROVIDER_STATUS_FINAL_FAILURE;
|
|
||||||
import static com.android.server.credentials.MetricUtilities.METRICS_PROVIDER_STATUS_FINAL_SUCCESS;
|
|
||||||
|
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -36,6 +33,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.android.server.credentials.metrics.ApiName;
|
import com.android.server.credentials.metrics.ApiName;
|
||||||
import com.android.server.credentials.metrics.ApiStatus;
|
import com.android.server.credentials.metrics.ApiStatus;
|
||||||
|
import com.android.server.credentials.metrics.ProviderStatusForMetrics;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@@ -95,11 +93,11 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest
|
|||||||
setChosenMetric(componentName);
|
setChosenMetric(componentName);
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
mChosenProviderMetric.setChosenProviderStatus(
|
mChosenProviderMetric.setChosenProviderStatus(
|
||||||
METRICS_PROVIDER_STATUS_FINAL_SUCCESS);
|
ProviderStatusForMetrics.FINAL_SUCCESS.getMetricCode());
|
||||||
respondToClientWithResponseAndFinish(response);
|
respondToClientWithResponseAndFinish(response);
|
||||||
} else {
|
} else {
|
||||||
mChosenProviderMetric.setChosenProviderStatus(
|
mChosenProviderMetric.setChosenProviderStatus(
|
||||||
METRICS_PROVIDER_STATUS_FINAL_FAILURE);
|
ProviderStatusForMetrics.FINAL_FAILURE.getMetricCode());
|
||||||
respondToClientWithErrorAndFinish(GetCredentialException.TYPE_NO_CREDENTIAL,
|
respondToClientWithErrorAndFinish(GetCredentialException.TYPE_NO_CREDENTIAL,
|
||||||
"Invalid response from provider");
|
"Invalid response from provider");
|
||||||
}
|
}
|
||||||
@@ -120,18 +118,18 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest
|
|||||||
}
|
}
|
||||||
if (isSessionCancelled()) {
|
if (isSessionCancelled()) {
|
||||||
logApiCall(ApiName.GET_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.GET_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_CLIENT_CANCELED);
|
ApiStatus.CLIENT_CANCELED);
|
||||||
finishSession(/*propagateCancellation=*/true);
|
finishSession(/*propagateCancellation=*/true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mClientCallback.onResponse(response);
|
mClientCallback.onResponse(response);
|
||||||
logApiCall(ApiName.GET_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.GET_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_SUCCESS);
|
ApiStatus.SUCCESS);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.i(TAG, "Issue while responding to client with a response : " + e.getMessage());
|
Log.i(TAG, "Issue while responding to client with a response : " + e.getMessage());
|
||||||
logApiCall(ApiName.GET_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.GET_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_FAILURE);
|
ApiStatus.FAILURE);
|
||||||
}
|
}
|
||||||
finishSession(/*propagateCancellation=*/false);
|
finishSession(/*propagateCancellation=*/false);
|
||||||
}
|
}
|
||||||
@@ -143,7 +141,7 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest
|
|||||||
}
|
}
|
||||||
if (isSessionCancelled()) {
|
if (isSessionCancelled()) {
|
||||||
logApiCall(ApiName.GET_CREDENTIAL, /* apiStatus */
|
logApiCall(ApiName.GET_CREDENTIAL, /* apiStatus */
|
||||||
ApiStatus.METRICS_API_STATUS_CLIENT_CANCELED);
|
ApiStatus.CLIENT_CANCELED);
|
||||||
finishSession(/*propagateCancellation=*/true);
|
finishSession(/*propagateCancellation=*/true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -160,10 +158,10 @@ public final class GetRequestSession extends RequestSession<GetCredentialRequest
|
|||||||
private void logFailureOrUserCancel(String errorType) {
|
private void logFailureOrUserCancel(String errorType) {
|
||||||
if (GetCredentialException.TYPE_USER_CANCELED.equals(errorType)) {
|
if (GetCredentialException.TYPE_USER_CANCELED.equals(errorType)) {
|
||||||
logApiCall(ApiName.GET_CREDENTIAL,
|
logApiCall(ApiName.GET_CREDENTIAL,
|
||||||
/* apiStatus */ ApiStatus.METRICS_API_STATUS_USER_CANCELED);
|
/* apiStatus */ ApiStatus.USER_CANCELED);
|
||||||
} else {
|
} else {
|
||||||
logApiCall(ApiName.GET_CREDENTIAL,
|
logApiCall(ApiName.GET_CREDENTIAL,
|
||||||
/* apiStatus */ ApiStatus.METRICS_API_STATUS_FAILURE);
|
/* apiStatus */ ApiStatus.FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.credentials;
|
package com.android.server.credentials;
|
||||||
|
|
||||||
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_FINAL_FAILURE;
|
|
||||||
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_FINAL_SUCCESS;
|
|
||||||
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_QUERY_FAILURE;
|
|
||||||
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_QUERY_SUCCESS;
|
|
||||||
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_UNKNOWN;
|
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -46,18 +40,6 @@ public class MetricUtilities {
|
|||||||
public static final int DEFAULT_INT_32 = -1;
|
public static final int DEFAULT_INT_32 = -1;
|
||||||
public static final int[] DEFAULT_REPEATED_INT_32 = new int[0];
|
public static final int[] DEFAULT_REPEATED_INT_32 = new int[0];
|
||||||
|
|
||||||
// Metrics constants TODO(b/269290341) migrate to enums eventually to improve
|
|
||||||
protected static final int METRICS_PROVIDER_STATUS_FINAL_FAILURE =
|
|
||||||
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_FINAL_FAILURE;
|
|
||||||
protected static final int METRICS_PROVIDER_STATUS_QUERY_FAILURE =
|
|
||||||
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_QUERY_FAILURE;
|
|
||||||
protected static final int METRICS_PROVIDER_STATUS_FINAL_SUCCESS =
|
|
||||||
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_FINAL_SUCCESS;
|
|
||||||
protected static final int METRICS_PROVIDER_STATUS_QUERY_SUCCESS =
|
|
||||||
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_QUERY_SUCCESS;
|
|
||||||
protected static final int METRICS_PROVIDER_STATUS_UNKNOWN =
|
|
||||||
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_UNKNOWN;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This retrieves the uid of any package name, given a context and a component name for the
|
* This retrieves the uid of any package name, given a context and a component name for the
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server.credentials;
|
package com.android.server.credentials;
|
||||||
|
|
||||||
import static com.android.server.credentials.MetricUtilities.METRICS_PROVIDER_STATUS_QUERY_FAILURE;
|
|
||||||
import static com.android.server.credentials.MetricUtilities.METRICS_PROVIDER_STATUS_QUERY_SUCCESS;
|
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
@@ -35,6 +32,7 @@ import android.service.credentials.CredentialProviderInfo;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.server.credentials.metrics.CandidateProviderMetric;
|
import com.android.server.credentials.metrics.CandidateProviderMetric;
|
||||||
|
import com.android.server.credentials.metrics.ProviderStatusForMetrics;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -205,9 +203,11 @@ public abstract class ProviderSession<T, R>
|
|||||||
mCandidateProviderMetric
|
mCandidateProviderMetric
|
||||||
.setQueryFinishTimeNanoseconds(System.nanoTime());
|
.setQueryFinishTimeNanoseconds(System.nanoTime());
|
||||||
if (isTerminatingStatus(status)) {
|
if (isTerminatingStatus(status)) {
|
||||||
mCandidateProviderMetric.setProviderQueryStatus(METRICS_PROVIDER_STATUS_QUERY_FAILURE);
|
mCandidateProviderMetric.setProviderQueryStatus(ProviderStatusForMetrics.QUERY_FAILURE
|
||||||
|
.getMetricCode());
|
||||||
} else if (isCompletionStatus(status)) {
|
} else if (isCompletionStatus(status)) {
|
||||||
mCandidateProviderMetric.setProviderQueryStatus(METRICS_PROVIDER_STATUS_QUERY_SUCCESS);
|
mCandidateProviderMetric.setProviderQueryStatus(ProviderStatusForMetrics.QUERY_SUCCESS
|
||||||
|
.getMetricCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API
|
|||||||
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_USER_CANCELED;
|
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_USER_CANCELED;
|
||||||
|
|
||||||
public enum ApiStatus {
|
public enum ApiStatus {
|
||||||
METRICS_API_STATUS_SUCCESS(CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_SUCCESS),
|
SUCCESS(CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_SUCCESS),
|
||||||
METRICS_API_STATUS_FAILURE(CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_FAILURE),
|
FAILURE(CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_FAILURE),
|
||||||
METRICS_API_STATUS_CLIENT_CANCELED(
|
CLIENT_CANCELED(
|
||||||
CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_CLIENT_CANCELED),
|
CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_CLIENT_CANCELED),
|
||||||
METRICS_API_STATUS_USER_CANCELED(
|
USER_CANCELED(
|
||||||
CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_USER_CANCELED);
|
CREDENTIAL_MANAGER_API_CALLED__API_STATUS__API_STATUS_USER_CANCELED);
|
||||||
|
|
||||||
private final int mInnerMetricCode;
|
private final int mInnerMetricCode;
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.server.credentials.metrics;
|
||||||
|
|
||||||
|
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_FINAL_FAILURE;
|
||||||
|
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_FINAL_SUCCESS;
|
||||||
|
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_QUERY_FAILURE;
|
||||||
|
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_QUERY_SUCCESS;
|
||||||
|
import static com.android.internal.util.FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_UNKNOWN;
|
||||||
|
|
||||||
|
public enum ProviderStatusForMetrics {
|
||||||
|
|
||||||
|
UNKNOWN(
|
||||||
|
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_UNKNOWN),
|
||||||
|
FINAL_FAILURE(
|
||||||
|
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_FINAL_FAILURE),
|
||||||
|
QUERY_FAILURE(
|
||||||
|
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_QUERY_FAILURE),
|
||||||
|
FINAL_SUCCESS(
|
||||||
|
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_FINAL_SUCCESS),
|
||||||
|
QUERY_SUCCESS(
|
||||||
|
CREDENTIAL_MANAGER_API_CALLED__CANDIDATE_PROVIDER_STATUS__PROVIDER_QUERY_SUCCESS);
|
||||||
|
|
||||||
|
private final int mInnerMetricCode;
|
||||||
|
|
||||||
|
ProviderStatusForMetrics(int innerMetricCode) {
|
||||||
|
this.mInnerMetricCode = innerMetricCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gives the West-world version of the metric name.
|
||||||
|
*
|
||||||
|
* @return a code corresponding to the west world metric name
|
||||||
|
*/
|
||||||
|
public int getMetricCode() {
|
||||||
|
return this.mInnerMetricCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user