summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/net/TrafficStats.java7
-rw-r--r--core/tests/coretests/src/android/net/NetworkStatsHistoryTest.java6
2 files changed, 9 insertions, 4 deletions
diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java
index dfdea38..973fac1 100644
--- a/core/java/android/net/TrafficStats.java
+++ b/core/java/android/net/TrafficStats.java
@@ -44,6 +44,13 @@ public class TrafficStats {
*/
public final static int UNSUPPORTED = -1;
+ /** @hide */
+ public static final long KB_IN_BYTES = 1024;
+ /** @hide */
+ public static final long MB_IN_BYTES = KB_IN_BYTES * 1024;
+ /** @hide */
+ public static final long GB_IN_BYTES = MB_IN_BYTES * 1024;
+
/**
* Special UID value used when collecting {@link NetworkStatsHistory} for
* removed applications.
diff --git a/core/tests/coretests/src/android/net/NetworkStatsHistoryTest.java b/core/tests/coretests/src/android/net/NetworkStatsHistoryTest.java
index 1df763a..b181122 100644
--- a/core/tests/coretests/src/android/net/NetworkStatsHistoryTest.java
+++ b/core/tests/coretests/src/android/net/NetworkStatsHistoryTest.java
@@ -24,6 +24,8 @@ import static android.net.NetworkStatsHistory.FIELD_TX_BYTES;
import static android.net.NetworkStatsHistory.DataStreamUtils.readVarLong;
import static android.net.NetworkStatsHistory.DataStreamUtils.writeVarLong;
import static android.net.NetworkStatsHistory.Entry.UNKNOWN;
+import static android.net.TrafficStats.GB_IN_BYTES;
+import static android.net.TrafficStats.MB_IN_BYTES;
import static android.text.format.DateUtils.DAY_IN_MILLIS;
import static android.text.format.DateUtils.HOUR_IN_MILLIS;
import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
@@ -50,10 +52,6 @@ public class NetworkStatsHistoryTest extends AndroidTestCase {
private static final long TEST_START = 1194220800000L;
- private static final long KB_IN_BYTES = 1024;
- private static final long MB_IN_BYTES = KB_IN_BYTES * 1024;
- private static final long GB_IN_BYTES = MB_IN_BYTES * 1024;
-
private NetworkStatsHistory stats;
@Override