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

Commit 69e566b3 authored by Arpan Kaphle's avatar Arpan Kaphle Committed by Android (Google) Code Review
Browse files

Merge "Adding in Logic to hold Split 1/3 - InitPhase" into udc-dev

parents e13229fa cf04631a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ package com.android.server.credentials.metrics;

/**
 * The central candidate provider metric object that mimics our defined metric setup.
 * Some types are redundant across these metric collectors, but that has debug use-cases as
 * these data-types are available at different moments of the flow (and typically, one can feed
 * into the next).
 * TODO(b/270403549) - iterate on this in V3+
 */
public class CandidateProviderMetric {
+8 −7
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@ import com.android.server.credentials.MetricUtilities;

/**
 * The central chosen provider metric object that mimics our defined metric setup.
 * Some types are redundant across these metric collectors, but that has debug use-cases as
 * these data-types are available at different moments of the flow (and typically, one can feed
 * into the next).
 * TODO(b/270403549) - iterate on this in V3+
 */
public class ChosenProviderMetric {
@@ -65,12 +68,12 @@ public class ChosenProviderMetric {

    /**
     * In order for a chosen provider to be selected, the call must have successfully begun.
     * Thus, the {@link PreCandidateMetric} can directly pass this initial latency figure into
     * Thus, the {@link InitialPhaseMetric} can directly pass this initial latency figure into
     * this chosen provider metric.
     *
     * @param preQueryPhaseLatencyMicroseconds the millisecond latency for the service start,
     *                                         typically passed in through the
     *                                         {@link PreCandidateMetric}
     *                                         {@link InitialPhaseMetric}
     */
    public void setPreQueryPhaseLatencyMicroseconds(int preQueryPhaseLatencyMicroseconds) {
        mPreQueryPhaseLatencyMicroseconds = preQueryPhaseLatencyMicroseconds;
@@ -112,7 +115,7 @@ public class ChosenProviderMetric {

    /**
     * Returns the full (platform invoked to response) latency in microseconds. Expects the
     * start time to be provided, such as from {@link PreCandidateMetric}.
     * start time to be provided, such as from {@link InitialPhaseMetric}.
     */
    public int getEntireLatencyMicroseconds() {
        return (int) ((this.mFinalFinishTimeNanoseconds
@@ -123,11 +126,11 @@ public class ChosenProviderMetric {

    /**
     * In order for a chosen provider to be selected, the call must have successfully begun.
     * Thus, the {@link PreCandidateMetric} can directly pass this initial timestamp into this
     * Thus, the {@link InitialPhaseMetric} can directly pass this initial timestamp into this
     * chosen provider metric.
     *
     * @param serviceBeganTimeNanoseconds the timestamp moment when the platform was called,
     *                                    typically passed in through the {@link PreCandidateMetric}
     *                                    typically passed in through the {@link InitialPhaseMetric}
     */
    public void setServiceBeganTimeNanoseconds(long serviceBeganTimeNanoseconds) {
        mServiceBeganTimeNanoseconds = serviceBeganTimeNanoseconds;
@@ -188,8 +191,6 @@ public class ChosenProviderMetric {
                - this.mServiceBeganTimeNanoseconds) / 1000);
    }



    /* ----------- Provider Status -------------- */

    public int getChosenProviderStatus() {
+69 −4
Original line number Diff line number Diff line
@@ -18,19 +18,34 @@ package com.android.server.credentials.metrics;

/**
 * This handles metrics collected prior to any remote calls to providers.
 * Some types are redundant across these metric collectors, but that has debug use-cases as
 * these data-types are available at different moments of the flow (and typically, one can feed
 * into the next).
 * TODO(b/270403549) - iterate on this in V3+
 */
public class PreCandidateMetric {

public class InitialPhaseMetric {
    private static final String TAG = "PreCandidateMetric";

    // The api being called, default set to unknown
    private int mApiName = ApiName.UNKNOWN.getMetricCode();
    // The caller uid of the calling application, default to -1
    private int mCallerUid = -1;
    // The session id to unite multiple atom emits, default to -1
    private long mSessionId = -1;
    // A sequence id to order united emits, default to -1
    private int mSequenceId = -1;
    private int mCountRequestClassType = -1;

    // Raw timestamps in nanoseconds, *the only* one logged as such (i.e. 64 bits) since it is a
    // reference point.

    private long mCredentialServiceStartedTimeNanoseconds = -1;

    // A reference point to give this object utility to capture latency. Can be directly handed
    // over to the next latency object.
    private long mCredentialServiceBeginQueryTimeNanoseconds = -1;

    public PreCandidateMetric() {

    public InitialPhaseMetric() {
    }

    /* ---------- Latencies ---------- */
@@ -62,4 +77,54 @@ public class PreCandidateMetric {
    public long getCredentialServiceBeginQueryTimeNanoseconds() {
        return mCredentialServiceBeginQueryTimeNanoseconds;
    }

    /* ------ ApiName ------ */

    public void setApiName(int apiName) {
        mApiName = apiName;
    }

    public int getApiName() {
        return mApiName;
    }

    /* ------ CallerUid ------ */

    public void setCallerUid(int callerUid) {
        mCallerUid = callerUid;
    }

    public int getCallerUid() {
        return mCallerUid;
    }

    /* ------ SessionId ------ */

    public void setSessionId(long sessionId) {
        mSessionId = sessionId;
    }

    public long getSessionId() {
        return mSessionId;
    }

    /* ------ SequenceId ------ */

    public void setSequenceId(int sequenceId) {
        mSequenceId = sequenceId;
    }

    public int getSequenceId() {
        return mSequenceId;
    }

    /* ------ Count Request Class Types ------ */

    public void setCountRequestClassType(int countRequestClassType) {
        mCountRequestClassType = countRequestClassType;
    }

    public int getCountRequestClassType() {
        return mCountRequestClassType;
    }
}