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

Commit 9ecb7215 authored by Hugo Benichi's avatar Hugo Benichi Committed by android-build-merger
Browse files

Fix missing IpConnectivity metrics am: 90cbc5b4

am: 384818b9

Change-Id: I62f174cc615f40e450ba72f8c6f86d46ed5fc096
parents 36a38bc0 384818b9
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -46,11 +46,12 @@ public class ConnectivityMetricsLogger {


    public static final String DATA_KEY_EVENTS_COUNT = "count";
    public static final String DATA_KEY_EVENTS_COUNT = "count";


    /** {@hide} */ protected final IConnectivityMetricsLogger mService;
    /** {@hide} */ protected IConnectivityMetricsLogger mService;
    /** {@hide} */ protected volatile long mServiceUnblockedTimestampMillis;
    /** {@hide} */ protected volatile long mServiceUnblockedTimestampMillis;
    private int mNumSkippedEvents;
    private int mNumSkippedEvents;


    public ConnectivityMetricsLogger() {
    public ConnectivityMetricsLogger() {
        // TODO: consider not initializing mService in constructor
        this(IConnectivityMetricsLogger.Stub.asInterface(
        this(IConnectivityMetricsLogger.Stub.asInterface(
                ServiceManager.getService(CONNECTIVITY_METRICS_LOGGER_SERVICE)));
                ServiceManager.getService(CONNECTIVITY_METRICS_LOGGER_SERVICE)));
    }
    }
@@ -61,6 +62,18 @@ public class ConnectivityMetricsLogger {
        mService = service;
        mService = service;
    }
    }


    /** {@hide} */
    protected boolean checkLoggerService() {
        if (mService != null) {
            return true;
        }
        // Two threads racing here will write the same pointer because getService
        // is idempotent once MetricsLoggerService is initialized.
        mService = IConnectivityMetricsLogger.Stub.asInterface(
                ServiceManager.getService(CONNECTIVITY_METRICS_LOGGER_SERVICE));
        return mService != null;
    }

    /**
    /**
     * Log a ConnectivityMetricsEvent.
     * Log a ConnectivityMetricsEvent.
     *
     *
+3 −3
Original line number Original line Diff line number Diff line
@@ -31,7 +31,7 @@ import com.android.internal.annotations.VisibleForTesting;
 */
 */
public class IpConnectivityLog extends ConnectivityMetricsLogger {
public class IpConnectivityLog extends ConnectivityMetricsLogger {
    private static String TAG = "IpConnectivityMetricsLogger";
    private static String TAG = "IpConnectivityMetricsLogger";
    private static final boolean DBG = false;
    private static final boolean DBG = true;


    public IpConnectivityLog() {
    public IpConnectivityLog() {
        // mService initialized in super constructor.
        // mService initialized in super constructor.
@@ -52,9 +52,9 @@ public class IpConnectivityLog extends ConnectivityMetricsLogger {
     * @return true if the event was successfully logged.
     * @return true if the event was successfully logged.
     */
     */
    public boolean log(long timestamp, Parcelable data) {
    public boolean log(long timestamp, Parcelable data) {
        if (mService == null) {
        if (!checkLoggerService()) {
            if (DBG) {
            if (DBG) {
                Log.d(TAG, CONNECTIVITY_METRICS_LOGGER_SERVICE + " service not ready");
                Log.d(TAG, CONNECTIVITY_METRICS_LOGGER_SERVICE + " service was not ready");
            }
            }
            return false;
            return false;
        }
        }