diff --git a/api/current.txt b/api/current.txt index 78de86028377f..0b3c33bb53d27 100644 --- a/api/current.txt +++ b/api/current.txt @@ -6215,6 +6215,8 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); + method public int getMetering(); + method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); method public long getStartTimeStamp(); @@ -6222,6 +6224,12 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); + field public static final int METERING_ALL = -1; // 0xffffffff + field public static final int METERING_DEFAULT = 1; // 0x1 + field public static final int METERING_METERED = 2; // 0x2 + field public static final int ROAMING_ALL = -1; // 0xffffffff + field public static final int ROAMING_DEFAULT = 1; // 0x1 + field public static final int ROAMING_ROAMING = 2; // 0x2 field public static final int STATE_ALL = -1; // 0xffffffff field public static final int STATE_DEFAULT = 1; // 0x1 field public static final int STATE_FOREGROUND = 2; // 0x2 diff --git a/api/system-current.txt b/api/system-current.txt index 24d257d495140..2e6fc8207049a 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6429,6 +6429,8 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); + method public int getMetering(); + method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); method public long getStartTimeStamp(); @@ -6436,6 +6438,12 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); + field public static final int METERING_ALL = -1; // 0xffffffff + field public static final int METERING_DEFAULT = 1; // 0x1 + field public static final int METERING_METERED = 2; // 0x2 + field public static final int ROAMING_ALL = -1; // 0xffffffff + field public static final int ROAMING_DEFAULT = 1; // 0x1 + field public static final int ROAMING_ROAMING = 2; // 0x2 field public static final int STATE_ALL = -1; // 0xffffffff field public static final int STATE_DEFAULT = 1; // 0x1 field public static final int STATE_FOREGROUND = 2; // 0x2 diff --git a/api/test-current.txt b/api/test-current.txt index 6b6bafb9454e1..c093531f13544 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -6215,6 +6215,8 @@ package android.app.usage { public static class NetworkStats.Bucket { ctor public NetworkStats.Bucket(); method public long getEndTimeStamp(); + method public int getMetering(); + method public int getRoaming(); method public long getRxBytes(); method public long getRxPackets(); method public long getStartTimeStamp(); @@ -6222,6 +6224,12 @@ package android.app.usage { method public long getTxBytes(); method public long getTxPackets(); method public int getUid(); + field public static final int METERING_ALL = -1; // 0xffffffff + field public static final int METERING_DEFAULT = 1; // 0x1 + field public static final int METERING_METERED = 2; // 0x2 + field public static final int ROAMING_ALL = -1; // 0xffffffff + field public static final int ROAMING_DEFAULT = 1; // 0x1 + field public static final int ROAMING_ROAMING = 2; // 0x2 field public static final int STATE_ALL = -1; // 0xffffffff field public static final int STATE_DEFAULT = 1; // 0x1 field public static final int STATE_FOREGROUND = 2; // 0x2 diff --git a/core/java/android/app/usage/NetworkStats.java b/core/java/android/app/usage/NetworkStats.java index ef08eb9e89876..5f97c9e1d4fd2 100644 --- a/core/java/android/app/usage/NetworkStats.java +++ b/core/java/android/app/usage/NetworkStats.java @@ -121,12 +121,12 @@ public final class NetworkStats implements AutoCloseable { */ public static class Bucket { /** - * Combined usage across all other states. + * Combined usage across all states. */ public static final int STATE_ALL = -1; /** - * Usage not accounted in any other states. + * Usage not accounted for in any other state. */ public static final int STATE_DEFAULT = 0x1; @@ -150,8 +150,40 @@ public final class NetworkStats implements AutoCloseable { */ public static final int UID_TETHERING = TrafficStats.UID_TETHERING; + /** + * Combined usage across all metering states. + */ + public static final int METERING_ALL = -1; + + /** + * Usage not accounted for in any other metering state. + */ + public static final int METERING_DEFAULT = 0x1; + + /** + * Metered usage. + */ + public static final int METERING_METERED = 0x2; + + /** + * Combined usage across all roaming states. + */ + public static final int ROAMING_ALL = -1; + + /** + * Usage not accounted for in any other roaming state. + */ + public static final int ROAMING_DEFAULT = 0x1; + + /** + * Roaming usage. + */ + public static final int ROAMING_ROAMING = 0x2; + private int mUid; private int mState; + private int mMetering; + private int mRoaming; private long mBeginTimeStamp; private long mEndTimeStamp; private long mRxBytes; @@ -205,6 +237,30 @@ public final class NetworkStats implements AutoCloseable { return mState; } + /** + * Metering state. One of the following values:
+ *