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
Change-Id: I79ea64d02ccb420e8f2d0d30d4bb7e848e52e705
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2816e72..0af0aa2 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -28,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;
@@ -58,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;
@@ -101,7 +102,6 @@
import com.android.phone.settings.VoicemailNotificationSettingsUtil;
import com.android.phone.vvm.PhoneAccountHandleConverter;
import com.android.phone.vvm.RemoteVvmTaskManager;
-import com.android.phone.vvm.VisualVoicemailPreferences;
import com.android.phone.vvm.VisualVoicemailSettingsUtil;
import com.android.phone.vvm.VisualVoicemailSmsFilterConfig;
@@ -3747,27 +3747,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;
}
/**