Wiring videoState through from telephony.
- Adding call video state history tracking, which is used to ensure
we log whether video was active at any point to the call log.
- Adding logging of video state to call log.
Bug: 16285417
Bug: 16013178
Change-Id: I3b47c88b13dc73941ca80463fc0c6ae7cdd86749
diff --git a/src/com/android/telecomm/CallLogManager.java b/src/com/android/telecomm/CallLogManager.java
index cf7e7ae..d1e2196 100644
--- a/src/com/android/telecomm/CallLogManager.java
+++ b/src/com/android/telecomm/CallLogManager.java
@@ -22,6 +22,7 @@
import android.provider.CallLog.Calls;
import android.telecomm.CallState;
import android.telecomm.PhoneAccount;
+import android.telecomm.VideoCallProfile;
import android.telephony.PhoneNumberUtils;
import com.android.internal.telephony.CallerInfo;
@@ -120,9 +121,10 @@
final int presentation = getPresentation(call);
final PhoneAccount account = call.getPhoneAccount();
- // TODO: Once features and data usage are available, wire them up here.
- logCall(call.getCallerInfo(), logNumber, presentation, callLogType, Calls.FEATURES_NONE,
- account, creationTime, age, null);
+ // TODO(vt): Once data usage is available, wire it up here.
+ int callFeatures = getCallFeatures(call.getVideoStateHistory());
+ logCall(call.getCallerInfo(), logNumber, presentation, callLogType, callFeatures, account,
+ creationTime, age, null);
}
/**
@@ -171,6 +173,20 @@
}
/**
+ * Based on the video state of the call, determines the call features applicable for the call.
+ *
+ * @param videoState The video state.
+ * @return The call features.
+ */
+ private static int getCallFeatures(int videoState) {
+ if ((videoState & VideoCallProfile.VIDEO_STATE_TX_ENABLED)
+ == VideoCallProfile.VIDEO_STATE_TX_ENABLED) {
+ return Calls.FEATURES_VIDEO;
+ }
+ return Calls.FEATURES_NONE;
+ }
+
+ /**
* Retrieve the phone number from the call, and then process it before returning the
* actual number that is to be logged.
*