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

Commit 3d0d2599 authored by Arpan Kaphle's avatar Arpan Kaphle
Browse files

Adding in New Status Emit for isEnabled

This utilizes our new atom to avoid the heavy defaulted version we used
prior. This means far less space is needed to emit simple status for
APIs such as isEnabled. Future status updates will be added.

Bug: 271135048
Test: Build and won't submit until E2E Tested
Change-Id: I32ddc8c35fb41a0cf258675507050e4de9bb88c9
parent d3446e4e
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -748,7 +748,7 @@ public final class CredentialManagerService
                    if (serviceComponentName.equals(componentName)) {
                        if (!s.getServicePackageName().equals(callingPackage)) {
                            // The component name and the package name do not match.
                            MetricUtilities.logApiCalledSimpleV1(
                            MetricUtilities.logApiCalledSimpleV2(
                                    ApiName.IS_ENABLED_CREDENTIAL_PROVIDER_SERVICE,
                                    ApiStatus.FAILURE, callingUid);
                            Slog.w(
@@ -757,10 +757,9 @@ public final class CredentialManagerService
                                            + "not match package name.");
                            return false;
                        }
                        MetricUtilities.logApiCalledSimpleV1(
                        MetricUtilities.logApiCalledSimpleV2(
                                ApiName.IS_ENABLED_CREDENTIAL_PROVIDER_SERVICE,
                                ApiStatus.SUCCESS, callingUid);
                        // TODO(b/271135048) - Update asap to use the new logging types
                        return true;
                    }
                }
+7 −19
Original line number Diff line number Diff line
@@ -266,7 +266,9 @@ public class MetricUtilities {
                    /* request_unique_classtypes */
                    initialPhaseMetric.getUniqueRequestStrings(),
                    /* per_classtype_counts */
                    initialPhaseMetric.getUniqueRequestCounts()
                    initialPhaseMetric.getUniqueRequestCounts(),
                    /* api_name */
                    initialPhaseMetric.getApiName()
            );
        } catch (Exception e) {
            Slog.w(TAG, "Unexpected error during candidate provider uid metric emit: " + e);
@@ -274,36 +276,22 @@ public class MetricUtilities {
    }

    /**
     * This is useful just to record an API calls' final event, and for no other purpose. It will
     * contain default values for all other optional parameters.
     *
     * TODO(b/271135048) - given space requirements, this may be a good candidate for another atom
     * TODO immediately remove and carry over TODO to new log for this setup
     * This is useful just to record an API calls' final event, and for no other purpose.
     *
     * @param apiName    the api name to log
     * @param apiStatus  the status to log
     * @param callingUid the calling uid
     */
    public static void logApiCalledSimpleV1(ApiName apiName, ApiStatus apiStatus,
    public static void logApiCalledSimpleV2(ApiName apiName, ApiStatus apiStatus,
            int callingUid) {
        try {
            if (!LOG_FLAG) {
                return;
            }
            FrameworkStatsLog.write(FrameworkStatsLog.CREDENTIAL_MANAGER_API_CALLED,
            FrameworkStatsLog.write(FrameworkStatsLog.CREDENTIAL_MANAGER_APIV2_CALLED,
                    /* api_name */apiName.getMetricCode(),
                    /* caller_uid */ callingUid,
                    /* api_status */ apiStatus.getMetricCode(),
                    /* repeated_candidate_provider_uid */  DEFAULT_REPEATED_INT_32,
                    /* repeated_candidate_provider_round_trip_time_query_microseconds */
                    DEFAULT_REPEATED_INT_32,
                    /* repeated_candidate_provider_status */ DEFAULT_REPEATED_INT_32,
                    /* chosen_provider_uid */ DEFAULT_INT_32,
                    /* chosen_provider_round_trip_time_overall_microseconds */
                    DEFAULT_INT_32,
                    /* chosen_provider_final_phase_microseconds */
                    DEFAULT_INT_32,
                    /* chosen_provider_status */ DEFAULT_INT_32);
                    /* api_status */ apiStatus.getMetricCode());
        } catch (Exception e) {
            Slog.w(TAG, "Unexpected error during metric logging: " + e);
        }