summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-12-07 23:05:26 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-12-07 23:05:26 +0000
commit32d5bdfd13632b30feb44d23ea007975f2726876 (patch)
treef1ed3df21860ad107b868833d215f6ef91cfad2a /InCallUI
parent8aefd1fd740115054c294f1ce1b86b76f44d7d71 (diff)
parent7e1a342c0711016fd83801116fa4f60d6c2ddb0a (diff)
Cannot accept video call request from another InCallService.
am: 6c734ad3f1 * commit '6c734ad3f142cd07406585d6f5f917ca29814ca0': Cannot accept video call request from another InCallService.
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/Call.java26
1 files changed, 20 insertions, 6 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index 3db974449..ced225b17 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -364,6 +364,8 @@ public class Call {
private int mSessionModificationState;
private final List<String> mChildCallIds = new ArrayList<>();
private final VideoSettings mVideoSettings = new VideoSettings();
+ private int mVideoState;
+
/**
* mModifyToVideoState is used to store requested upgrade / downgrade video state
*/
@@ -435,6 +437,7 @@ public class Call {
if (mState != State.BLOCKED) {
setState(translatedState);
setDisconnectCause(mTelecomCall.getDetails().getDisconnectCause());
+ maybeCancelVideoUpgrade(mTelecomCall.getDetails().getVideoState());
}
if (mTelecomCall.getVideoCall() != null) {
@@ -524,6 +527,23 @@ public class Call {
}
}
+ /**
+ * Determines if a received upgrade to video request should be cancelled. This can happen if
+ * another InCall UI responds to the upgrade to video request.
+ *
+ * @param newVideoState The new video state.
+ */
+ private void maybeCancelVideoUpgrade(int newVideoState) {
+ boolean isVideoStateChanged = mVideoState != newVideoState;
+
+ if (mSessionModificationState == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST
+ && isVideoStateChanged) {
+
+ Log.v(this, "maybeCancelVideoUpgrade : cancelling upgrade notification");
+ setSessionModificationState(SessionModificationState.NO_REQUEST);
+ }
+ mVideoState = newVideoState;
+ }
private static int translateState(int state) {
switch (state) {
case android.telecom.Call.STATE_NEW:
@@ -754,12 +774,6 @@ public class Call {
* when an upgrade request has been completed or failed.
*/
public void setSessionModificationState(int state) {
- if (state == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
- Log.e(this,
- "setSessionModificationState not valid for RECEIVED_UPGRADE_TO_VIDEO_REQUEST");
- return;
- }
-
boolean hasChanged = mSessionModificationState != state;
mSessionModificationState = state;
Log.d(this, "setSessionModificationState " + state + " mSessionModificationState="