Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 749856ef authored by Tyler Gunn's avatar Tyler Gunn
Browse files

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
parent 5abd4681
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ import java.util.concurrent.ConcurrentHashMap;
 */
@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.
     */
@@ -331,6 +334,11 @@ public class Call implements CreateConnectionResponse {

    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.
     *
@@ -1681,4 +1689,22 @@ public class Call implements CreateConnectionResponse {
    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;
    }
}
+4 −2
Original line number Diff line number Diff line
@@ -145,10 +145,12 @@ final class CallLogManager extends CallsManagerListenerBase {
            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());
    }

+4 −0
Original line number Diff line number Diff line
@@ -206,6 +206,9 @@ public class VideoProviderProxy extends Connection.VideoProvider {
         * 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 @@ public class VideoProviderProxy extends Connection.VideoProvider {
            synchronized (mLock) {
                logFromVideoProvider("changeCallDataUsage: " + dataUsage);
                VideoProviderProxy.this.setCallDataUsage(dataUsage);
                mCall.setCallDataUsage(dataUsage);
            }
        }