diff options
author | Tyler Gunn <tgunn@google.com> | 2015-05-07 22:59:46 +0000 |
---|---|---|
committer | Android Partner Code Review <android-gerrit-partner@google.com> | 2015-05-07 22:59:46 +0000 |
commit | c1ccffba5d0e533d1e837851393e10356ed4bc91 (patch) | |
tree | 5eaad2b9ede75f01e8a66a941493a89e311dcd5e /InCallUI | |
parent | ba924736333be480e7956aaf555f75b562ad0175 (diff) | |
parent | 37aaca775a1275fcc0364452ef106156f711e2ab (diff) |
Merge "Fix issues with fullscreen video call mode and incoming calls." into m-wireless-dev
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/VideoCallPresenter.java | 68 |
1 files changed, 55 insertions, 13 deletions
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index e4ba68b03..dc5e81fb1 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -369,7 +369,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi private void toggleFullScreen() { mIsFullScreen = !mIsFullScreen; - + Log.v(this, "toggleFullScreen = " + mIsFullScreen); // Ensure we cancel any scheduled auto activation of fullscreen mode as the user's setting // should override any automatic operation. cancelAutoFullScreen(); @@ -383,6 +383,11 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi * otherwise. */ public void setFullScreen(boolean isFullScreen) { + Log.v(this, "setFullScreen = " + isFullScreen); + if (mIsFullScreen == isFullScreen) { + Log.v(this, "setFullScreen ignored as already in that state."); + return; + } mIsFullScreen = isFullScreen; InCallPresenter.getInstance().setFullScreenVideoState(mIsFullScreen); } @@ -436,21 +441,29 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi // Determine the primary active call). Call primary = null; + + // Determine the call which is the focus of the user's attention. In the case of an + // incoming call waiting call, the primary call is still the active video call, however + // the determination of whether we should be in fullscreen mode is based on the type of the + // incoming call, not the active video call. + Call currentCall = null; + if (newState == InCallPresenter.InCallState.INCOMING) { // We don't want to replace active video call (primary call) // with a waiting call, since user may choose to ignore/decline the waiting call and // this should have no impact on current active video call, that is, we should not // change the camera or UI unless the waiting VT call becomes active. primary = callList.getActiveCall(); + currentCall = callList.getIncomingCall(); if (!CallUtils.isActiveVideoCall(primary)) { primary = callList.getIncomingCall(); } } else if (newState == InCallPresenter.InCallState.OUTGOING) { - primary = callList.getOutgoingCall(); + currentCall = primary = callList.getOutgoingCall(); } else if (newState == InCallPresenter.InCallState.PENDING_OUTGOING) { - primary = callList.getPendingOutgoingCall(); + currentCall = primary = callList.getPendingOutgoingCall(); } else if (newState == InCallPresenter.InCallState.INCALL) { - primary = callList.getActiveCall(); + currentCall = primary = callList.getActiveCall(); } final boolean primaryChanged = !Objects.equals(mPrimaryCall, primary); @@ -459,11 +472,17 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi Log.d(this, "onStateChange mPrimaryCall = " + mPrimaryCall); if (primaryChanged) { onPrimaryCallChanged(primary); - } else if(mPrimaryCall!=null) { + } else if (mPrimaryCall != null) { updateVideoCall(primary); } updateCallCache(primary); - maybeAutoEnterFullscreen(); + + // If the call context changed, potentially exit fullscreen or schedule auto enter of + // fullscreen mode. + // If the current call context is no longer a video call, exit fullscreen mode. + maybeExitFullscreen(currentCall); + // Schedule auto-enter of fullscreen mode if the current call context is a video call + maybeAutoEnterFullscreen(currentCall); } private void checkForVideoStateChange(Call call) { @@ -683,7 +702,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi mIsVideoMode = true; - maybeAutoEnterFullscreen(); + maybeAutoEnterFullscreen(call); } //TODO: Move this into Telecom. InCallUI should not be this close to audio functionality. @@ -756,9 +775,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi enableCamera(mVideoCall, false); Log.d(this, "exitVideoMode mIsFullScreen: " + mIsFullScreen); - if (mIsFullScreen) { - toggleFullScreen(); - } + setFullScreen(false); mIsVideoMode = false; } @@ -1065,15 +1082,40 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi } /** + * Exits fullscreen mode if the current call context has changed to a non-video call. + * + * @param call The call. + */ + protected void maybeExitFullscreen(Call call) { + if (call == null) { + return; + } + + if (!CallUtils.isVideoCall(call) || call.getState() == Call.State.INCOMING) { + setFullScreen(false); + } + } + + /** * Schedules auto-entering of fullscreen mode. + * Will not enter full screen mode if any of the following conditions are met: + * 1. No call + * 2. Call is not active + * 3. Call is not video call + * 4. Already in fullscreen mode + * + * @param call The current call. */ - public void maybeAutoEnterFullscreen() { + protected void maybeAutoEnterFullscreen(Call call) { if (!mIsAutoFullscreenEnabled) { return; } - if (mPrimaryCall == null || (mPrimaryCall != null - && mPrimaryCall.getState() != Call.State.ACTIVE) || mIsFullScreen) { + if (call == null || ( + call != null && (call.getState() != Call.State.ACTIVE || + !CallUtils.isVideoCall(call)) || mIsFullScreen)) { + // Ensure any previously scheduled attempt to enter fullscreen is cancelled. + cancelAutoFullScreen(); return; } |