From 35509db0089a8dd468ddd23b3f74e631e32dcba0 Mon Sep 17 00:00:00 2001 From: Arpan Kaphle Date: Mon, 1 May 2023 23:46:19 +0000 Subject: [PATCH] Auth Entry Metric Exceptions and Status This collects status and exception information for the auth entry metric and continues the combination of this metric with the total candidate metric. Bug: 271135048 Test: Build and Won't Submit without E2E Test Change-Id: Ib3db0b2723189d02f4af84b3101d0d45e24cd936 --- .../server/credentials/MetricUtilities.java | 9 ++-- .../credentials/ProviderGetSession.java | 2 + .../metrics/BrowsedAuthenticationMetric.java | 43 +++++++++++++++ .../metrics/CandidateAggregateMetric.java | 12 ++++- .../metrics/ProviderSessionMetric.java | 52 +++++++++++++++---- .../metrics/RequestSessionMetric.java | 4 +- 6 files changed, 105 insertions(+), 17 deletions(-) diff --git a/services/credentials/java/com/android/server/credentials/MetricUtilities.java b/services/credentials/java/com/android/server/credentials/MetricUtilities.java index ed0c88709aff2..749d6b6246d0b 100644 --- a/services/credentials/java/com/android/server/credentials/MetricUtilities.java +++ b/services/credentials/java/com/android/server/credentials/MetricUtilities.java @@ -217,11 +217,12 @@ public class MetricUtilities { /* auth_per_entry_counts */ authenticationMetric.getAuthEntryCollective().getUniqueEntryCounts(), /* framework_exception_unique_classtype */ - DEFAULT_STRING, - /* exception_specified */ false, - /* auth_provider_status TODO(immediately) change */ DEFAULT_INT_32, + authenticationMetric.getFrameworkException(), + /* exception_specified */ authenticationMetric.isHasException(), + /* auth_provider_status */ + authenticationMetric.getProviderStatus(), /* query_returned */ - false + authenticationMetric.isQueryReturned() ); } catch (Exception e) { Slog.w(TAG, "Unexpected error during candidate get metric logging: " + e); diff --git a/services/credentials/java/com/android/server/credentials/ProviderGetSession.java b/services/credentials/java/com/android/server/credentials/ProviderGetSession.java index 51af25b589924..14260f0e1ad43 100644 --- a/services/credentials/java/com/android/server/credentials/ProviderGetSession.java +++ b/services/credentials/java/com/android/server/credentials/ProviderGetSession.java @@ -269,6 +269,7 @@ public final class ProviderGetSession extends ProviderSession entryCounts = new LinkedHashMap<>(); @@ -266,12 +300,10 @@ public class ProviderSessionMetric { if (!isAuthEntry) { mCandidatePhasePerProviderMetric.setResponseCollective(responseCollective); } else { - BrowsedAuthenticationMetric browsedAuthenticationMetric = - new BrowsedAuthenticationMetric(mCandidatePhasePerProviderMetric - .getSessionIdProvider()); - // to receive an auth entry, the candidate phase must have succeeded + // The most recent auth entry must be created already + var browsedAuthenticationMetric = + mBrowsedAuthenticationMetric.get(mBrowsedAuthenticationMetric.size() - 1); browsedAuthenticationMetric.setAuthEntryCollective(responseCollective); - mBrowsedAuthenticationMetric.add(browsedAuthenticationMetric); } } } diff --git a/services/credentials/java/com/android/server/credentials/metrics/RequestSessionMetric.java b/services/credentials/java/com/android/server/credentials/metrics/RequestSessionMetric.java index 4fb2d207b112b..009cfa852bf40 100644 --- a/services/credentials/java/com/android/server/credentials/metrics/RequestSessionMetric.java +++ b/services/credentials/java/com/android/server/credentials/metrics/RequestSessionMetric.java @@ -365,7 +365,9 @@ public class RequestSessionMetric { /** * This logs the authentication entry when browsed. Combined with the known browsed clicks * in the {@link ChosenProviderFinalPhaseMetric}, this fully captures the authentication entry - * logic for multiple loops. + * logic for multiple loops. An auth entry may have default or missing data, but if a provider + * was never assigned to an auth entry, this indicates an auth entry was never clicked. + * This case is handled in this emit. * * @param browsedAuthenticationMetric the authentication metric information to emit */