diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java index c58725d39b..844d05564b 100644 --- a/core/java/android/net/NetworkStats.java +++ b/core/java/android/net/NetworkStats.java @@ -155,7 +155,7 @@ public class NetworkStats implements Parcelable { operations = parcel.createLongArray(); } - /** {@inheritDoc} */ + @Override public void writeToParcel(Parcel dest, int flags) { dest.writeLong(elapsedRealtime); dest.writeInt(size); @@ -662,16 +662,18 @@ public class NetworkStats implements Parcelable { return writer.toString(); } - /** {@inheritDoc} */ + @Override public int describeContents() { return 0; } public static final Creator CREATOR = new Creator() { + @Override public NetworkStats createFromParcel(Parcel in) { return new NetworkStats(in); } + @Override public NetworkStats[] newArray(int size) { return new NetworkStats[size]; } diff --git a/core/java/android/net/NetworkStatsHistory.java b/core/java/android/net/NetworkStatsHistory.java index faf8a3f9fe..0003c6e3d6 100644 --- a/core/java/android/net/NetworkStatsHistory.java +++ b/core/java/android/net/NetworkStatsHistory.java @@ -130,7 +130,7 @@ public class NetworkStatsHistory implements Parcelable { totalBytes = in.readLong(); } - /** {@inheritDoc} */ + @Override public void writeToParcel(Parcel out, int flags) { out.writeLong(bucketDuration); writeLongArray(out, bucketStart, bucketCount); @@ -191,7 +191,7 @@ public class NetworkStatsHistory implements Parcelable { writeVarLongArray(out, operations, bucketCount); } - /** {@inheritDoc} */ + @Override public int describeContents() { return 0; } @@ -586,10 +586,12 @@ public class NetworkStatsHistory implements Parcelable { } public static final Creator CREATOR = new Creator() { + @Override public NetworkStatsHistory createFromParcel(Parcel in) { return new NetworkStatsHistory(in); } + @Override public NetworkStatsHistory[] newArray(int size) { return new NetworkStatsHistory[size]; } diff --git a/services/java/com/android/server/net/NetworkStatsCollection.java b/services/java/com/android/server/net/NetworkStatsCollection.java index 70038d93ee..2892a74845 100644 --- a/services/java/com/android/server/net/NetworkStatsCollection.java +++ b/services/java/com/android/server/net/NetworkStatsCollection.java @@ -57,8 +57,6 @@ import libcore.io.IoUtils; * {@link NetworkIdentitySet}, UID, set, and tag. Knows how to persist itself. */ public class NetworkStatsCollection implements FileRotator.Reader { - private static final String TAG = "NetworkStatsCollection"; - /** File header magic number: "ANET" */ private static final int FILE_MAGIC = 0x414E4554; @@ -173,7 +171,7 @@ public class NetworkStatsCollection implements FileRotator.Reader { } /** - * Record given {@link NetworkStats.Entry} into this collection. + * Record given {@link android.net.NetworkStats.Entry} into this collection. */ public void recordData(NetworkIdentitySet ident, int uid, int set, int tag, long start, long end, NetworkStats.Entry entry) { @@ -227,7 +225,7 @@ public class NetworkStatsCollection implements FileRotator.Reader { } } - /** {@inheritDoc} */ + @Override public void read(InputStream in) throws IOException { read(new DataInputStream(in)); } @@ -502,7 +500,7 @@ public class NetworkStatsCollection implements FileRotator.Reader { return false; } - /** {@inheritDoc} */ + @Override public int compareTo(Key another) { return Integer.compare(uid, another.uid); } diff --git a/services/java/com/android/server/net/NetworkStatsRecorder.java b/services/java/com/android/server/net/NetworkStatsRecorder.java index 540f6066f4..57ad158bf2 100644 --- a/services/java/com/android/server/net/NetworkStatsRecorder.java +++ b/services/java/com/android/server/net/NetworkStatsRecorder.java @@ -240,22 +240,22 @@ public class NetworkStatsRecorder { mCollection = checkNotNull(collection, "missing NetworkStatsCollection"); } - /** {@inheritDoc} */ + @Override public void reset() { // ignored } - /** {@inheritDoc} */ + @Override public void read(InputStream in) throws IOException { mCollection.read(in); } - /** {@inheritDoc} */ + @Override public boolean shouldWrite() { return true; } - /** {@inheritDoc} */ + @Override public void write(OutputStream out) throws IOException { mCollection.write(new DataOutputStream(out)); mCollection.reset(); @@ -275,24 +275,24 @@ public class NetworkStatsRecorder { mUid = uid; } - /** {@inheritDoc} */ + @Override public void reset() { mTemp.reset(); } - /** {@inheritDoc} */ + @Override public void read(InputStream in) throws IOException { mTemp.read(in); mTemp.clearDirty(); mTemp.removeUid(mUid); } - /** {@inheritDoc} */ + @Override public boolean shouldWrite() { return mTemp.isDirty(); } - /** {@inheritDoc} */ + @Override public void write(OutputStream out) throws IOException { mTemp.write(new DataOutputStream(out)); } diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java index 519d58ecdd..4382a03fa2 100644 --- a/services/java/com/android/server/net/NetworkStatsService.java +++ b/services/java/com/android/server/net/NetworkStatsService.java @@ -999,7 +999,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } private Handler.Callback mHandlerCallback = new Handler.Callback() { - /** {@inheritDoc} */ + @Override public boolean handleMessage(Message msg) { switch (msg.what) { case MSG_PERFORM_POLL: { @@ -1038,7 +1038,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } private class DropBoxNonMonotonicObserver implements NonMonotonicObserver { - /** {@inheritDoc} */ + @Override public void foundNonMonotonic(NetworkStats left, int leftIndex, NetworkStats right, int rightIndex, String cookie) { Log.w(TAG, "found non-monotonic values; saving to dropbox"); @@ -1057,7 +1057,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } /** - * Default external settings that read from {@link Settings.Secure}. + * Default external settings that read from + * {@link android.provider.Settings.Secure}. */ private static class DefaultNetworkStatsSettings implements NetworkStatsSettings { private final ContentResolver mResolver; @@ -1075,19 +1076,24 @@ public class NetworkStatsService extends INetworkStatsService.Stub { return Settings.Secure.getInt(mResolver, name, defInt) != 0; } + @Override public long getPollInterval() { return getSecureLong(NETSTATS_POLL_INTERVAL, 30 * MINUTE_IN_MILLIS); } + @Override public long getTimeCacheMaxAge() { return getSecureLong(NETSTATS_TIME_CACHE_MAX_AGE, DAY_IN_MILLIS); } + @Override public long getGlobalAlertBytes() { return getSecureLong(NETSTATS_GLOBAL_ALERT_BYTES, 2 * MB_IN_BYTES); } + @Override public boolean getSampleEnabled() { return getSecureBoolean(NETSTATS_SAMPLE_ENABLED, true); } + @Override public Config getDevConfig() { return new Config(getSecureLong(NETSTATS_DEV_BUCKET_DURATION, HOUR_IN_MILLIS), getSecureLong(NETSTATS_DEV_PERSIST_BYTES, 2 * MB_IN_BYTES), @@ -1095,6 +1101,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { getSecureLong(NETSTATS_DEV_DELETE_AGE, 90 * DAY_IN_MILLIS)); } + @Override public Config getUidConfig() { return new Config(getSecureLong(NETSTATS_UID_BUCKET_DURATION, 2 * HOUR_IN_MILLIS), getSecureLong(NETSTATS_UID_PERSIST_BYTES, 2 * MB_IN_BYTES), @@ -1102,6 +1109,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { getSecureLong(NETSTATS_UID_DELETE_AGE, 90 * DAY_IN_MILLIS)); } + @Override public Config getUidTagConfig() { return new Config(getSecureLong(NETSTATS_UID_BUCKET_DURATION, 2 * HOUR_IN_MILLIS), getSecureLong(NETSTATS_UID_PERSIST_BYTES, 2 * MB_IN_BYTES),