Loading api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -6520,6 +6520,7 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); method public int getMetered(); method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); Loading @@ -6529,6 +6530,9 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); field public static final int METERED_ALL = -1; // 0xffffffff field public static final int METERED_NO = 1; // 0x1 field public static final int METERED_YES = 2; // 0x2 field public static final int ROAMING_ALL = -1; // 0xffffffff field public static final int ROAMING_NO = 1; // 0x1 field public static final int ROAMING_YES = 2; // 0x2 api/system-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -6809,6 +6809,7 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); method public int getMetered(); method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); Loading @@ -6818,6 +6819,9 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); field public static final int METERED_ALL = -1; // 0xffffffff field public static final int METERED_NO = 1; // 0x1 field public static final int METERED_YES = 2; // 0x2 field public static final int ROAMING_ALL = -1; // 0xffffffff field public static final int ROAMING_NO = 1; // 0x1 field public static final int ROAMING_YES = 2; // 0x2 api/test-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -6529,6 +6529,7 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); method public int getMetered(); method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); Loading @@ -6538,6 +6539,9 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); field public static final int METERED_ALL = -1; // 0xffffffff field public static final int METERED_NO = 1; // 0x1 field public static final int METERED_YES = 2; // 0x2 field public static final int ROAMING_ALL = -1; // 0xffffffff field public static final int ROAMING_NO = 1; // 0x1 field public static final int ROAMING_YES = 2; // 0x2 core/java/android/app/usage/NetworkStats.java +42 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,29 @@ public final class NetworkStats implements AutoCloseable { */ public static final int UID_TETHERING = TrafficStats.UID_TETHERING; /** @hide */ @IntDef({METERED_ALL, METERED_NO, METERED_YES}) @Retention(RetentionPolicy.SOURCE) public @interface Metered {} /** * Combined usage across all metered states. Covers metered and unmetered usage. */ public static final int METERED_ALL = -1; /** * Usage that occurs on an unmetered network. */ public static final int METERED_NO = 0x1; /** * Usage that occurs on a metered network. * * <p>A network is classified as metered when the user is sensitive to heavy data usage on * that connection. */ public static final int METERED_YES = 0x2; /** @hide */ @IntDef({ROAMING_ALL, ROAMING_NO, ROAMING_YES}) @Retention(RetentionPolicy.SOURCE) Loading Loading @@ -200,6 +223,7 @@ public final class NetworkStats implements AutoCloseable { private int mUid; private int mTag; private int mState; private int mMetered; private int mRoaming; private long mBeginTimeStamp; private long mEndTimeStamp; Loading Loading @@ -278,6 +302,21 @@ public final class NetworkStats implements AutoCloseable { return mState; } /** * Metered state. One of the following values:<p/> * <ul> * <li>{@link #METERED_ALL}</li> * <li>{@link #METERED_NO}</li> * <li>{@link #METERED_YES}</li> * </ul> * <p>A network is classified as metered when the user is sensitive to heavy data usage on * that connection. Apps may warn before using these networks for large downloads. The * metered state can be set by the user within data usage network restrictions. */ public @Metered int getMetered() { return mMetered; } /** * Roaming state. One of the following values:<p/> * <ul> Loading Loading @@ -491,6 +530,8 @@ public final class NetworkStats implements AutoCloseable { bucketOut.mUid = Bucket.convertUid(mRecycledSummaryEntry.uid); bucketOut.mTag = Bucket.convertTag(mRecycledSummaryEntry.tag); bucketOut.mState = Bucket.convertState(mRecycledSummaryEntry.set); // TODO: Implement metered tracking. bucketOut.mMetered = Bucket.METERED_ALL; bucketOut.mRoaming = Bucket.convertRoaming(mRecycledSummaryEntry.roaming); bucketOut.mBeginTimeStamp = mStartTimeStamp; bucketOut.mEndTimeStamp = mEndTimeStamp; Loading Loading @@ -539,6 +580,7 @@ public final class NetworkStats implements AutoCloseable { bucketOut.mUid = Bucket.convertUid(getUid()); bucketOut.mTag = Bucket.convertTag(mTag); bucketOut.mState = Bucket.STATE_ALL; bucketOut.mMetered = Bucket.METERED_ALL; bucketOut.mRoaming = Bucket.ROAMING_ALL; bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart; bucketOut.mEndTimeStamp = mRecycledHistoryEntry.bucketStart + Loading Loading
api/current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -6520,6 +6520,7 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); method public int getMetered(); method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); Loading @@ -6529,6 +6530,9 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); field public static final int METERED_ALL = -1; // 0xffffffff field public static final int METERED_NO = 1; // 0x1 field public static final int METERED_YES = 2; // 0x2 field public static final int ROAMING_ALL = -1; // 0xffffffff field public static final int ROAMING_NO = 1; // 0x1 field public static final int ROAMING_YES = 2; // 0x2
api/system-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -6809,6 +6809,7 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); method public int getMetered(); method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); Loading @@ -6818,6 +6819,9 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); field public static final int METERED_ALL = -1; // 0xffffffff field public static final int METERED_NO = 1; // 0x1 field public static final int METERED_YES = 2; // 0x2 field public static final int ROAMING_ALL = -1; // 0xffffffff field public static final int ROAMING_NO = 1; // 0x1 field public static final int ROAMING_YES = 2; // 0x2
api/test-current.txt +4 −0 Original line number Diff line number Diff line Loading @@ -6529,6 +6529,7 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); method public int getMetered(); method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); Loading @@ -6538,6 +6539,9 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); field public static final int METERED_ALL = -1; // 0xffffffff field public static final int METERED_NO = 1; // 0x1 field public static final int METERED_YES = 2; // 0x2 field public static final int ROAMING_ALL = -1; // 0xffffffff field public static final int ROAMING_NO = 1; // 0x1 field public static final int ROAMING_YES = 2; // 0x2
core/java/android/app/usage/NetworkStats.java +42 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,29 @@ public final class NetworkStats implements AutoCloseable { */ public static final int UID_TETHERING = TrafficStats.UID_TETHERING; /** @hide */ @IntDef({METERED_ALL, METERED_NO, METERED_YES}) @Retention(RetentionPolicy.SOURCE) public @interface Metered {} /** * Combined usage across all metered states. Covers metered and unmetered usage. */ public static final int METERED_ALL = -1; /** * Usage that occurs on an unmetered network. */ public static final int METERED_NO = 0x1; /** * Usage that occurs on a metered network. * * <p>A network is classified as metered when the user is sensitive to heavy data usage on * that connection. */ public static final int METERED_YES = 0x2; /** @hide */ @IntDef({ROAMING_ALL, ROAMING_NO, ROAMING_YES}) @Retention(RetentionPolicy.SOURCE) Loading Loading @@ -200,6 +223,7 @@ public final class NetworkStats implements AutoCloseable { private int mUid; private int mTag; private int mState; private int mMetered; private int mRoaming; private long mBeginTimeStamp; private long mEndTimeStamp; Loading Loading @@ -278,6 +302,21 @@ public final class NetworkStats implements AutoCloseable { return mState; } /** * Metered state. One of the following values:<p/> * <ul> * <li>{@link #METERED_ALL}</li> * <li>{@link #METERED_NO}</li> * <li>{@link #METERED_YES}</li> * </ul> * <p>A network is classified as metered when the user is sensitive to heavy data usage on * that connection. Apps may warn before using these networks for large downloads. The * metered state can be set by the user within data usage network restrictions. */ public @Metered int getMetered() { return mMetered; } /** * Roaming state. One of the following values:<p/> * <ul> Loading Loading @@ -491,6 +530,8 @@ public final class NetworkStats implements AutoCloseable { bucketOut.mUid = Bucket.convertUid(mRecycledSummaryEntry.uid); bucketOut.mTag = Bucket.convertTag(mRecycledSummaryEntry.tag); bucketOut.mState = Bucket.convertState(mRecycledSummaryEntry.set); // TODO: Implement metered tracking. bucketOut.mMetered = Bucket.METERED_ALL; bucketOut.mRoaming = Bucket.convertRoaming(mRecycledSummaryEntry.roaming); bucketOut.mBeginTimeStamp = mStartTimeStamp; bucketOut.mEndTimeStamp = mEndTimeStamp; Loading Loading @@ -539,6 +580,7 @@ public final class NetworkStats implements AutoCloseable { bucketOut.mUid = Bucket.convertUid(getUid()); bucketOut.mTag = Bucket.convertTag(mTag); bucketOut.mState = Bucket.STATE_ALL; bucketOut.mMetered = Bucket.METERED_ALL; bucketOut.mRoaming = Bucket.ROAMING_ALL; bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart; bucketOut.mEndTimeStamp = mRecycledHistoryEntry.bucketStart + Loading