DO NOT MERGE Track and store call data usage in call log.
Respond to VideoProvider changeCallDataUsage callbacks and track the
most current call data usage in the Call. Use this when saving a new call
log entry.
Bug: 25668261
Change-Id: I1477b10dd9553ff3194e50f27d223d5eb24725bf
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 8fe6fc1..fbfd2a4 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -65,6 +65,9 @@
*/
@VisibleForTesting
public class Call implements CreateConnectionResponse {
+ public final static String CALL_ID_UNKNOWN = "-1";
+ public final static long DATA_USAGE_NOT_SET = -1;
+
/**
* Listener for events on the call.
*/
@@ -332,6 +335,11 @@
private boolean mIsLocallyDisconnecting = false;
/**
+ * Tracks the current call data usage as reported by the video provider.
+ */
+ private long mCallDataUsage = DATA_USAGE_NOT_SET;
+
+ /**
* Persists the specified parameters and initializes the new instance.
*
* @param context The context.
@@ -1681,4 +1689,22 @@
public boolean isDisconnected() {
return (getState() == CallState.DISCONNECTED || getState() == CallState.ABORTED);
}
+
+ /**
+ * Sets the call data usage for the call.
+ *
+ * @param callDataUsage The new call data usage (in bytes).
+ */
+ public void setCallDataUsage(long callDataUsage) {
+ mCallDataUsage = callDataUsage;
+ }
+
+ /**
+ * Returns the call data usage for the call.
+ *
+ * @return The call data usage (in bytes).
+ */
+ public long getCallDataUsage() {
+ return mCallDataUsage;
+ }
}
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index 1fe491e..718f2ea 100755
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -145,10 +145,12 @@
accountHandle = null;
}
- // TODO(vt): Once data usage is available, wire it up here.
+ Long callDataUsage = call.getCallDataUsage() == Call.DATA_USAGE_NOT_SET ? null :
+ call.getCallDataUsage();
+
int callFeatures = getCallFeatures(call.getVideoStateHistory());
logCall(call.getCallerInfo(), logNumber, call.getHandlePresentation(),
- callLogType, callFeatures, accountHandle, creationTime, age, null,
+ callLogType, callFeatures, accountHandle, creationTime, age, callDataUsage,
call.isEmergencyCall());
}
diff --git a/src/com/android/server/telecom/VideoProviderProxy.java b/src/com/android/server/telecom/VideoProviderProxy.java
index 7dcfdfb..b531242 100644
--- a/src/com/android/server/telecom/VideoProviderProxy.java
+++ b/src/com/android/server/telecom/VideoProviderProxy.java
@@ -206,6 +206,9 @@
* Proxies a request from the {@link #mConectionServiceVideoProvider} to the
* {@link InCallService} when the call data usage changes.
*
+ * Also tracks the current call data usage on the {@link Call} for use when writing to the
+ * call log.
+ *
* @param dataUsage The data usage.
*/
@Override
@@ -213,6 +216,7 @@
synchronized (mLock) {
logFromVideoProvider("changeCallDataUsage: " + dataUsage);
VideoProviderProxy.this.setCallDataUsage(dataUsage);
+ mCall.setCallDataUsage(dataUsage);
}
}