diff options
author | Matthieu Baglin <matthieu.baglin@intel.com> | 2015-02-25 09:29:00 +0100 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2015-03-13 17:59:42 +0000 |
commit | 5894bc8a4043b6e5122581b77e91b42dbdefceca (patch) | |
tree | 5daa9697ebd3b050a8b192ab20662caab3e83b91 | |
parent | c4fac46c65d20da815b37f3d1dbe2ff748fa1f00 (diff) |
Video Call Upgrade/Downgrade fixes
This is fixing multiple deficiencies affecting video call upgrade or
downgrade in the L MR1 InCallUi.
Change-Id: I61bf7efa6ac23859c900dfd059faf72184987943
Signed-off-by: Matthieu Baglin <matthieu.baglin@intel.com>
4 files changed, 26 insertions, 5 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 9897d3744..9fedc95b1 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -258,7 +258,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto new VideoProfile(VideoProfile.VideoState.BIDIRECTIONAL); videoCall.sendSessionModifyRequest(videoProfile); - mCall.setSessionModificationState(Call.SessionModificationState.REQUEST_FAILED); + mCall.setSessionModificationState(Call.SessionModificationState.WAITING_FOR_RESPONSE); } /** diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java b/InCallUI/src/com/android/incallui/InCallVideoCallListener.java index 363bd4144..245fc7316 100644 --- a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java +++ b/InCallUI/src/com/android/incallui/InCallVideoCallListener.java @@ -86,9 +86,14 @@ public class InCallVideoCallListener extends VideoCall.Listener { VideoProfile.VideoState.isBidirectional(responseProfile.getVideoState()); if (modifySucceeded && isVideoCall) { + // Local Upgrade success InCallVideoCallListenerNotifier.getInstance().upgradeToVideoSuccess(mCall); } else if (!modifySucceeded || status != Connection.VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS) { + // Remote didn't accept invitation in bidirectional state or failure InCallVideoCallListenerNotifier.getInstance().upgradeToVideoFail(mCall); + } else if (modifySucceeded && !isVideoCall) { + // Local Downgrade success (should always be successful) + InCallVideoCallListenerNotifier.getInstance().downgradeToAudio(mCall); } } diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 4a0216061..006339ce1 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -207,6 +207,14 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { (!isOutgoingWithoutIncallUi || mNotificationTimer.getState() == NotificationTimer.State.FIRED); + // For call upgrade + if ((call != null) + && (call.getSessionModificationState() + == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST)) { + Log.d(this, "updateInCallNotification, notify of callupgrade to video!"); + showNotificationNow = true; + } + if (showNotificationNow) { showNotification(call); } else { @@ -556,16 +564,16 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { Log.i(this, "Will show \"accept\" action in the incoming call Notification"); PendingIntent acceptVideoPendingIntent = createNotificationPendingIntent( - mContext, InCallApp.ACTION_ANSWER_VOICE_INCOMING_CALL); + mContext, InCallApp.ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST); builder.addAction(0, mContext.getText(R.string.notification_action_accept), - acceptVideoPendingIntent); + acceptVideoPendingIntent); } private void addDismissUpgradeRequestAction(Notification.Builder builder) { Log.i(this, "Will show \"dismiss\" action in the incoming call Notification"); PendingIntent declineVideoPendingIntent = createNotificationPendingIntent( - mContext, InCallApp.ACTION_ANSWER_VOICE_INCOMING_CALL); + mContext, InCallApp.ACTION_DECLINE_VIDEO_UPGRADE_REQUEST); builder.addAction(0, mContext.getText(R.string.notification_action_dismiss), declineVideoPendingIntent); } diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index c566264c1..38d7c9556 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -173,6 +173,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi InCallPresenter.getInstance().addListener(this); InCallPresenter.getInstance().addIncomingCallListener(this); InCallPresenter.getInstance().addOrientationListener(this); + // To get updates of video call details changes + InCallPresenter.getInstance().addDetailsListener(this); // Register for surface and video events from {@link InCallVideoCallListener}s. InCallVideoCallListenerNotifier.getInstance().addSurfaceChangeListener(this); @@ -443,6 +445,11 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi InCallPresenter.getInstance().setInCallAllowsOrientationChange(false); ui.showVideoUi(false); + if (mVideoCall != null) { + // Also disable camera otherwise it will be already in use for next upgrade + mVideoCall.setCamera(null); + } + if (mPreVideoAudioMode != AudioModeProvider.AUDIO_MODE_INVALID) { TelecomAdapter.getInstance().setAudioRoute(mPreVideoAudioMode); mPreVideoAudioMode = AudioModeProvider.AUDIO_MODE_INVALID; @@ -561,7 +568,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi @Override public void onDowngradeToAudio(Call call) { - // Implementing to satsify interface. + // exit video mode + exitVideoMode(); } /** |