Add support to get data usage in SL4A. am: 982c7a7458 am: 572ffb78d0 am: e655445baf
am: 78af1658b6
Change-Id: I6164ec25a1c99939a27b6ab3f94d0a0c070c537d
diff --git a/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java b/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
index c1ac242..4f3de5e 100644
--- a/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/telephony/TelephonyManagerFacade.java
@@ -23,6 +23,7 @@
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
+import android.net.TrafficStats;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.provider.Telephony;
@@ -1095,6 +1096,56 @@
mTelephonyManager.getDataState());
}
+ @Rpc(description = "Returns Total Rx Bytes.")
+ public long getTotalRxBytes() {
+ return TrafficStats.getTotalRxBytes();
+ }
+
+ @Rpc(description = "Returns Total Tx Bytes.")
+ public long getTotalTxBytes() {
+ return TrafficStats.getTotalTxBytes();
+ }
+
+ @Rpc(description = "Returns Total Rx Packets.")
+ public long getTotalRxPackets() {
+ return TrafficStats.getTotalRxPackets();
+ }
+
+ @Rpc(description = "Returns Total Tx Packets.")
+ public long getTotalTxPackets() {
+ return TrafficStats.getTotalTxPackets();
+ }
+
+ @Rpc(description = "Returns Mobile Network Rx Bytes.")
+ public long getMobileRxBytes() {
+ return TrafficStats.getMobileRxBytes();
+ }
+
+ @Rpc(description = "Returns Mobile Network Tx Bytes.")
+ public long getMobileTxBytes() {
+ return TrafficStats.getMobileTxBytes();
+ }
+
+ @Rpc(description = "Returns Mobile Network Packets.")
+ public long getMobileRxPackets() {
+ return TrafficStats.getMobileRxPackets();
+ }
+
+ @Rpc(description = "Returns Mobile Network Packets.")
+ public long getMobileTxPackets() {
+ return TrafficStats.getMobileTxPackets();
+ }
+
+ @Rpc(description = "Returns a given UID Rx Bytes.")
+ public long getUidRxBytes(int uid) {
+ return TrafficStats.getUidRxBytes(uid);
+ }
+
+ @Rpc(description = "Returns a given UID Rx Packets.")
+ public long getUidRxPackets(int uid) {
+ return TrafficStats.getUidRxPackets(uid);
+ }
+
@Rpc(description = "Enables or Disables Video Calling()")
public void telephonyEnableVideoCalling(
@RpcParameter(name = "enable") boolean enable) {