From 7e1a342c0711016fd83801116fa4f60d6c2ddb0a Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Wed, 20 May 2015 17:12:39 -0700 Subject: Cannot accept video call request from another InCallService. If another InCallService accepts an incoming video request, the incall UI will not dismiss the glowpad, even those the call upgrades to video. To correct this, added code in InCall.Call to detect changes to the video state and set the SessionModificationState to "NO_REQUEST" should a change occur while the call is in a RECEIVED_UPGRADE_TO_VIDEO_REQUEST state. This causes the glowpad and notification to dismiss. Bug: 20958105 Change-Id: Id87c323b8b9defd674b49ce1ee9c2ad1a9a28341 --- InCallUI/src/com/android/incallui/Call.java | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'InCallUI') diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 7b2724a37..e866b4b63 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 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) { @@ -523,6 +526,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: @@ -753,12 +773,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=" -- cgit v1.2.3