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

am: 74870c4

* commit '74870c441fde0aa141edca84f066d1ace4cf5db5':
  Make ConnectivityMetricsLogger and related classes @SystemApi

Change-Id: Id302c045286578163c40eb02108d675c6031afc5
This commit is contained in:
Pavel Zhamaitsiak
2016-04-15 18:53:52 +00:00
committed by android-build-merger
4 changed files with 56 additions and 8 deletions

View File

@@ -25315,6 +25315,41 @@ package android.net {
method public void onTetheringStarted(); 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 { public class Credentials {
ctor public Credentials(int, int, int); ctor public Credentials(int, int, int);
method public int getGid(); method public int getGid();

View File

@@ -16,10 +16,12 @@
package android.net; package android.net;
import android.annotation.SystemApi;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
/** {@hide} */ /** {@hide} */
@SystemApi
public final class ConnectivityMetricsEvent implements Parcelable { public final class ConnectivityMetricsEvent implements Parcelable {
/** The time when this event was collected, as returned by System.currentTimeMillis(). */ /** The time when this event was collected, as returned by System.currentTimeMillis(). */
@@ -80,12 +82,13 @@ public final class ConnectivityMetricsEvent implements Parcelable {
} }
/** {@hide} */ /** {@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) { public Reference(long ref) {
this.value = ref; this.mValue = ref;
} }
/** Implement the Parcelable interface */ /** Implement the Parcelable interface */
@@ -109,11 +112,19 @@ public final class ConnectivityMetricsEvent implements Parcelable {
/** Implement the Parcelable interface */ /** Implement the Parcelable interface */
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(value); dest.writeLong(mValue);
} }
public void readFromParcel(Parcel in) { public void readFromParcel(Parcel in) {
value = in.readLong(); mValue = in.readLong();
}
public long getValue() {
return mValue;
}
public void setValue(long val) {
mValue = val;
} }
} }
} }

View File

@@ -15,6 +15,7 @@
*/ */
package android.net; package android.net;
import android.annotation.SystemApi;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcelable; import android.os.Parcelable;
import android.os.RemoteException; import android.os.RemoteException;
@@ -22,6 +23,7 @@ import android.os.ServiceManager;
import android.util.Log; import android.util.Log;
/** {@hide} */ /** {@hide} */
@SystemApi
public class ConnectivityMetricsLogger { public class ConnectivityMetricsLogger {
private static String TAG = "ConnectivityMetricsLogger"; private static String TAG = "ConnectivityMetricsLogger";
private static final boolean DBG = true; private static final boolean DBG = true;

View File

@@ -300,14 +300,14 @@ public class MetricsLoggerService extends SystemService {
*/ */
public ConnectivityMetricsEvent[] getEvents(ConnectivityMetricsEvent.Reference reference) { public ConnectivityMetricsEvent[] getEvents(ConnectivityMetricsEvent.Reference reference) {
enforceDumpPermission(); enforceDumpPermission();
long ref = reference.value; long ref = reference.getValue();
if (VDBG) Log.v(TAG, "getEvents(" + ref + ")"); if (VDBG) Log.v(TAG, "getEvents(" + ref + ")");
ConnectivityMetricsEvent[] result; ConnectivityMetricsEvent[] result;
synchronized (mEvents) { synchronized (mEvents) {
if (ref > mLastEventReference) { if (ref > mLastEventReference) {
Log.e(TAG, "Invalid reference"); Log.e(TAG, "Invalid reference");
reference.value = mLastEventReference; reference.setValue(mLastEventReference);
return null; return null;
} }
if (ref < mLastEventReference - mEvents.size()) { if (ref < mLastEventReference - mEvents.size()) {
@@ -329,7 +329,7 @@ public class MetricsLoggerService extends SystemService {
} }
} }
reference.value = mLastEventReference; reference.setValue(mLastEventReference);
return result; return result;
} }