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

Commit e640cc68 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Metric System Cleanup" into udc-dev am: 325a4e20

parents 441c2422 325a4e20
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ public final class ClearRequestSession extends RequestSession<ClearCredentialSta
    public void onFinalResponseReceived(
            ComponentName componentName,
            Void response) {
        mRequestSessionMetric.collectUiResponseData(/*uiReturned=*/ true, System.nanoTime());
        mRequestSessionMetric.updateMetricsOnResponseReceived(mProviders, componentName,
                isPrimaryProviderViaProviderInfo(componentName));
        respondToClientWithResponseAndFinish(null);
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
                RequestInfo.TYPE_CREATE,
                callingAppInfo, enabledProviders, cancellationSignal, startedTimestamp);
        mRequestSessionMetric.collectCreateFlowInitialMetricInfo(
                /*origin=*/request.getOrigin() != null);
                /*origin=*/request.getOrigin() != null, request);
        mPrimaryProviders = primaryProviders;
    }

+0 −5
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.ResultReceiver;
import android.service.credentials.CredentialProviderInfoFactory;
import android.util.Log;
import android.util.Slog;

import java.util.ArrayList;
@@ -72,7 +71,6 @@ public class CredentialManagerUi {
    };

    private void handleUiResult(int resultCode, Bundle resultData) {
        Log.i("reemademo", "handleUiResult with resultCOde: " + resultCode);

        switch (resultCode) {
            case UserSelectionDialogResult.RESULT_CODE_DIALOG_COMPLETE_WITH_SELECTION:
@@ -86,13 +84,11 @@ public class CredentialManagerUi {
                }
                break;
            case UserSelectionDialogResult.RESULT_CODE_DIALOG_USER_CANCELED:
                Log.i("reemademo", "RESULT_CODE_DIALOG_USER_CANCELED");

                mStatus = UiStatus.TERMINATED;
                mCallbacks.onUiCancellation(/* isUserCancellation= */ true);
                break;
            case UserSelectionDialogResult.RESULT_CODE_CANCELED_AND_LAUNCHED_SETTINGS:
                Log.i("reemademo", "RESULT_CODE_CANCELED_AND_LAUNCHED_SETTINGS");

                mStatus = UiStatus.TERMINATED;
                mCallbacks.onUiCancellation(/* isUserCancellation= */ false);
@@ -102,7 +98,6 @@ public class CredentialManagerUi {
                mCallbacks.onUiSelectorInvocationFailure();
                break;
            default:
                Log.i("reemademo", "Unknown error code returned from the UI");
                mStatus = UiStatus.IN_PROGRESS;
                mCallbacks.onUiSelectorInvocationFailure();
                break;
+1 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ public class GetRequestSession extends RequestSession<GetCredentialRequest,
    public void onFinalResponseReceived(ComponentName componentName,
            @Nullable GetCredentialResponse response) {
        Slog.i(TAG, "onFinalResponseReceived from: " + componentName.flattenToString());
        mRequestSessionMetric.collectUiResponseData(/*uiReturned=*/ true, System.nanoTime());
        mRequestSessionMetric.updateMetricsOnResponseReceived(mProviders, componentName,
                isPrimaryProviderViaProviderInfo(componentName));
        if (response != null) {
+19 −22
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import java.util.Map;
/**
 * For all future metric additions, this will contain their names for local usage after importing
 * from {@link com.android.internal.util.FrameworkStatsLog}.
 * TODO(b/271135048) - Emit all atoms, including all V4 atoms (specifically the rest of track 1).
 */
public class MetricUtilities {
    private static final boolean LOG_FLAG = true;
@@ -101,7 +100,9 @@ public class MetricUtilities {
     */
    protected static int getMetricTimestampDifferenceMicroseconds(long t2, long t1) {
        if (t2 - t1 > Integer.MAX_VALUE) {
            throw new ArithmeticException("Input timestamps are too far apart and unsupported");
            Slog.i(TAG, "Input timestamps are too far apart and unsupported, "
                    + "falling back to default int");
            return DEFAULT_INT_32;
        }
        if (t2 < t1) {
            Slog.i(TAG, "The timestamps aren't in expected order, falling back to default int");
@@ -229,7 +230,7 @@ public class MetricUtilities {
                    authenticationMetric.isAuthReturned()
            );
        } catch (Exception e) {
            Slog.w(TAG, "Unexpected error during candidate get metric logging: " + e);
            Slog.w(TAG, "Unexpected error during candidate auth metric logging: " + e);
        }
    }

@@ -252,7 +253,6 @@ public class MetricUtilities {
            }
            var sessions = providers.values();
            for (var session : sessions) {
                try {
                var metric = session.getProviderSessionMetric()
                        .getCandidatePhasePerProviderMetric();
                FrameworkStatsLog.write(
@@ -265,9 +265,6 @@ public class MetricUtilities {
                        /* per_classtype_counts */
                        metric.getResponseCollective().getUniqueResponseCounts()
                );
                } catch (Exception e) {
                    Slog.w(TAG, "Unexpected exception during get metric logging" + e);
                }
            }
        } catch (Exception e) {
            Slog.w(TAG, "Unexpected error during candidate get metric logging: " + e);
@@ -399,7 +396,7 @@ public class MetricUtilities {
                    /* caller_uid */ callingUid,
                    /* api_status */ apiStatus.getMetricCode());
        } catch (Exception e) {
            Slog.w(TAG, "Unexpected error during metric logging: " + e);
            Slog.w(TAG, "Unexpected error during simple v2 metric logging: " + e);
        }
    }

@@ -505,7 +502,7 @@ public class MetricUtilities {
                    candidateAggregateMetric.isAuthReturned()
            );
        } catch (Exception e) {
            Slog.w(TAG, "Unexpected error during metric logging: " + e);
            Slog.w(TAG, "Unexpected error during total candidate metric logging: " + e);
        }
    }

@@ -570,7 +567,7 @@ public class MetricUtilities {
                    /* primary_indicated */ finalPhaseMetric.isPrimary()
            );
        } catch (Exception e) {
            Slog.w(TAG, "Unexpected error during metric logging: " + e);
            Slog.w(TAG, "Unexpected error during final no uid metric logging: " + e);
        }
    }

Loading