Adding "start call with video" extra for ACTION_CALL intent.
- Added extra.
- Updated Call, CallInfo, ConnectionRequest to pass extra.
Bug: 16014224
Change-Id: If213bfe8d6b8705a16bf7c3247ad3f7c5530dfe2
diff --git a/src/com/android/telecomm/Call.java b/src/com/android/telecomm/Call.java
index 3d4771b..2810dc8 100644
--- a/src/com/android/telecomm/Call.java
+++ b/src/com/android/telecomm/Call.java
@@ -55,7 +55,6 @@
* connected etc).
*/
final class Call implements OutgoingCallResponse {
-
/**
* Listener for events on the call.
*/
@@ -174,6 +173,8 @@
private boolean mSpeakerphoneOn;
+ private int mVideoState;
+
/**
* Disconnect cause for the call. Only valid if the state of the call is DISCONNECTED.
* See {@link android.telephony.DisconnectCause}.
@@ -1031,4 +1032,30 @@
l.onFeaturesChanged(Call.this);
}
}
+
+ /**
+ * The current video state for the call.
+ * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
+ * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
+ * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
+ * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
+ *
+ * @return True if video is enabled.
+ */
+ public int getVideoState() {
+ return mVideoState;
+ }
+
+ /**
+ * At the start of the call, determines the desired video state for the call.
+ * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
+ * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
+ * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
+ * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
+ *
+ * @param videoState The desired video state for the call.
+ */
+ public void setVideoState(int videoState) {
+ mVideoState = videoState;
+ }
}
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index f78fb7c..3884adb 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -29,9 +29,6 @@
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -286,9 +283,11 @@
* @param gatewayInfo Optional gateway information that can be used to route the call to the
* actual dialed handle via a gateway provider. May be null.
* @param speakerphoneOn Whether or not to turn the speakerphone on once the call connects.
+ * @param videoState The desired video state for the outgoing call.
*/
void placeOutgoingCall(Uri handle, ContactInfo contactInfo, GatewayInfo gatewayInfo,
- PhoneAccount account, boolean speakerphoneOn) {
+ PhoneAccount account, boolean speakerphoneOn, int videoState) {
+
final Uri uriHandle = (gatewayInfo == null) ? handle : gatewayInfo.getGatewayHandle();
if (gatewayInfo == null) {
@@ -302,6 +301,7 @@
uriHandle, gatewayInfo, account,
false /* isIncoming */, false /* isConference */);
call.setStartWithSpeakerphoneOn(speakerphoneOn);
+ call.setVideoState(videoState);
// TODO(santoscordon): Move this to be a part of addCall()
call.addListener(this);
diff --git a/src/com/android/telecomm/ConnectionServiceWrapper.java b/src/com/android/telecomm/ConnectionServiceWrapper.java
index 00eb6d5..f53eeb3 100644
--- a/src/com/android/telecomm/ConnectionServiceWrapper.java
+++ b/src/com/android/telecomm/ConnectionServiceWrapper.java
@@ -538,7 +538,8 @@
NewOutgoingCallIntentBroadcaster.EXTRA_GATEWAY_ORIGINAL_URI,
gatewayInfo.getOriginalHandle());
}
- ConnectionRequest request = new ConnectionRequest(callId, call.getHandle(), extras);
+ ConnectionRequest request = new ConnectionRequest(callId, call.getHandle(), extras,
+ call.getVideoState());
try {
mServiceInterface.call(request);
@@ -631,7 +632,7 @@
String callId = mCallIdMapper.getCallId(call);
logOutgoing("createIncomingCall %s %s", callId, extras);
ConnectionRequest request = new ConnectionRequest(
- callId, call.getHandle(), extras);
+ callId, call.getHandle(), extras, call.getVideoState());
try {
mServiceInterface.createIncomingCall(request);
} catch (RemoteException e) {
diff --git a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
index 770b75d..c75e184 100644
--- a/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
+++ b/src/com/android/telecomm/NewOutgoingCallIntentBroadcaster.java
@@ -26,6 +26,7 @@
import android.telecomm.GatewayInfo;
import android.telecomm.PhoneAccount;
import android.telecomm.TelecommConstants;
+import android.telecomm.VideoCallProfile;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -123,7 +124,9 @@
mCallsManager.placeOutgoingCall(resultHandleUri, mContactInfo, gatewayInfo,
account,
mIntent.getBooleanExtra(TelecommConstants.EXTRA_START_CALL_WITH_SPEAKERPHONE,
- false));
+ false),
+ mIntent.getIntExtra(TelecommConstants.EXTRA_START_CALL_WITH_VIDEO_STATE,
+ VideoCallProfile.VIDEO_STATE_AUDIO_ONLY));
}
}
@@ -192,7 +195,9 @@
mCallsManager.placeOutgoingCall(
Uri.fromParts(scheme, handle, null), mContactInfo, null, null,
mIntent.getBooleanExtra(TelecommConstants.EXTRA_START_CALL_WITH_SPEAKERPHONE,
- false));
+ false),
+ mIntent.getIntExtra(TelecommConstants.EXTRA_START_CALL_WITH_VIDEO_STATE,
+ VideoCallProfile.VIDEO_STATE_AUDIO_ONLY));
// Don't return but instead continue and send the ACTION_NEW_OUTGOING_CALL broadcast
// so that third parties can still inspect (but not intercept) the outgoing call. When