Added video calling data usage per-uid support
Now the VT call data usage will be counted under
current dialer's data usage as well as the total
device data usage.
Test: Manual
bug: 37671326
Merged-In: I79ea64d02ccb420e8f2d0d30d4bb7e848e52e705
Change-Id: I79ea64d02ccb420e8f2d0d30d4bb7e848e52e705
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index a7d0205..f51422c 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -19,7 +19,6 @@
import static com.android.internal.telephony.PhoneConstants.SUBSCRIPTION_KEY;
import android.Manifest.permission;
-import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.app.PendingIntent;
@@ -29,6 +28,7 @@
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import android.net.NetworkStats;
import android.net.Uri;
import android.os.AsyncResult;
import android.os.Binder;
@@ -59,8 +59,8 @@
import android.telephony.NetworkScanRequest;
import android.telephony.RadioAccessFamily;
import android.telephony.ServiceState;
-import android.telephony.SmsManager;
import android.telephony.SignalStrength;
+import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyHistogram;
@@ -3649,27 +3649,25 @@
}
/**
- * Get aggregated video call data usage from all subscriptions since boot.
- * @return total data usage in bytes
+ * Get aggregated video call data usage since boot.
+ *
+ * @param perUidStats True if requesting data usage per uid, otherwise overall usage.
+ * @return Snapshot of video call data usage
* {@hide}
*/
@Override
- public long getVtDataUsage() {
+ public NetworkStats getVtDataUsage(int subId, boolean perUidStats) {
mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_NETWORK_USAGE_HISTORY,
null);
- // NetworkStatsService keeps tracking the active network interface and identity. It will
- // record the delta with the corresponding network identity. What we need to do here is
- // returning total video call data usage from all subscriptions since boot.
-
- // TODO: Add sub id support in the future. We'll need it when we support DSDA and
- // simultaneous VT calls.
- final Phone[] phones = PhoneFactory.getPhones();
- long total = 0;
- for (Phone phone : phones) {
- total += phone.getVtDataUsage();
+ // NetworkStatsService keeps tracking the active network interface and identity. It
+ // records the delta with the corresponding network identity. We just return the total video
+ // call data usage snapshot since boot.
+ Phone phone = getPhone(subId);
+ if (phone != null) {
+ return phone.getVtDataUsage(perUidStats);
}
- return total;
+ return null;
}
/**