Added a new API to query VT data usage

Added a new API for NetworkStatsService to query aggregated VT
data usage from all subscription since boot up.

bug: 20888836
Change-Id: I6cc9344d6f1c25c90ea41be44c1afe529adc5a73
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 546f0f2..d050576 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -3308,4 +3308,28 @@
         }
         DumpsysHandler.dump(mPhone.getContext(), fd, writer, args);
     }
+
+    /**
+     * Get aggregated video call data usage from all subscriptions since boot.
+     * @return total data usage in bytes
+     * {@hide}
+     */
+    @Override
+    public long getVtDataUsage() {
+        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();
+        }
+        return total;
+    }
 }