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

Commit 74870c44 authored by Pavel Zhamaitsiak's avatar Pavel Zhamaitsiak Committed by Android (Google) Code Review
Browse files

Merge "Make ConnectivityMetricsLogger and related classes @SystemApi" into nyc-dev

parents db0f3a70 f6f24c03
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -25315,6 +25315,41 @@ package android.net {
    method public void onTetheringStarted();
  }
  public final class ConnectivityMetricsEvent implements android.os.Parcelable {
    ctor public ConnectivityMetricsEvent(long, int, int, android.os.Parcelable);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.ConnectivityMetricsEvent> CREATOR;
    field public final int componentTag;
    field public final android.os.Parcelable data;
    field public final int eventTag;
    field public final long timestamp;
  }
  public static final class ConnectivityMetricsEvent.Reference implements android.os.Parcelable {
    ctor public ConnectivityMetricsEvent.Reference(long);
    method public int describeContents();
    method public long getValue();
    method public void readFromParcel(android.os.Parcel);
    method public void setValue(long);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.net.ConnectivityMetricsEvent.Reference> CREATOR;
  }
  public class ConnectivityMetricsLogger {
    ctor public ConnectivityMetricsLogger();
    method public void logEvent(long, int, int, android.os.Parcelable);
    field public static final int COMPONENT_TAG_BLUETOOTH = 1; // 0x1
    field public static final int COMPONENT_TAG_CONNECTIVITY = 0; // 0x0
    field public static final int COMPONENT_TAG_TELECOM = 3; // 0x3
    field public static final int COMPONENT_TAG_TELEPHONY = 4; // 0x4
    field public static final int COMPONENT_TAG_WIFI = 2; // 0x2
    field public static final java.lang.String CONNECTIVITY_METRICS_LOGGER_SERVICE = "connectivity_metrics_logger";
    field public static final java.lang.String DATA_KEY_EVENTS_COUNT = "count";
    field public static final int NUMBER_OF_COMPONENTS = 5; // 0x5
    field public static final int TAG_SKIPPED_EVENTS = -1; // 0xffffffff
  }
  public class Credentials {
    ctor public Credentials(int, int, int);
    method public int getGid();
+16 −5
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@

package android.net;

import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;

/** {@hide} */
@SystemApi
public final class ConnectivityMetricsEvent implements Parcelable {

    /**  The time when this event was collected, as returned by System.currentTimeMillis(). */
@@ -80,12 +82,13 @@ public final class ConnectivityMetricsEvent implements Parcelable {
    }

    /** {@hide} */
    public static class Reference implements Parcelable {
    @SystemApi
    public final static class Reference implements Parcelable {

        public long value;
        private long mValue;

        public Reference(long ref) {
            this.value = ref;
            this.mValue = ref;
        }

        /** Implement the Parcelable interface */
@@ -109,11 +112,19 @@ public final class ConnectivityMetricsEvent implements Parcelable {
        /** Implement the Parcelable interface */
        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeLong(value);
            dest.writeLong(mValue);
        }

        public void readFromParcel(Parcel in) {
            value = in.readLong();
            mValue = in.readLong();
        }

        public long getValue() {
            return mValue;
        }

        public void setValue(long val) {
            mValue = val;
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package android.net;

import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.Parcelable;
import android.os.RemoteException;
@@ -22,6 +23,7 @@ import android.os.ServiceManager;
import android.util.Log;

/** {@hide} */
@SystemApi
public class ConnectivityMetricsLogger {
    private static String TAG = "ConnectivityMetricsLogger";
    private static final boolean DBG = true;
+3 −3
Original line number Diff line number Diff line
@@ -300,14 +300,14 @@ public class MetricsLoggerService extends SystemService {
         */
        public ConnectivityMetricsEvent[] getEvents(ConnectivityMetricsEvent.Reference reference) {
            enforceDumpPermission();
            long ref = reference.value;
            long ref = reference.getValue();
            if (VDBG) Log.v(TAG, "getEvents(" + ref + ")");

            ConnectivityMetricsEvent[] result;
            synchronized (mEvents) {
                if (ref > mLastEventReference) {
                    Log.e(TAG, "Invalid reference");
                    reference.value = mLastEventReference;
                    reference.setValue(mLastEventReference);
                    return null;
                }
                if (ref < mLastEventReference - mEvents.size()) {
@@ -329,7 +329,7 @@ public class MetricsLoggerService extends SystemService {
                }
            }

            reference.value = mLastEventReference;
            reference.setValue(mLastEventReference);

            return result;
        }