summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2016-05-06 15:38:38 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-06 15:38:38 +0000
commite59028b6a932b28bbcb3662d40b1b3211072cf3a (patch)
tree3a660fbec8231bc618f4b7bfd2260cab49d7d497 /InCallUI
parent969d183e62c271316a318b7f9f61e8671b1fce97 (diff)
parent9b8e50f60f8e4f5f73be111f32394b3621ca34f9 (diff)
Merge "Fix issues with video auto-fullscreen mode." into nyc-mr1-dev am: 43fd36a1b2
am: 9b8e50f60f * commit '9b8e50f60f8e4f5f73be111f32394b3621ca34f9': Fix issues with video auto-fullscreen mode. Change-Id: I2e033651915875edbf33d6f0f85a293bae16a479
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallFragment.java3
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java48
2 files changed, 29 insertions, 22 deletions
diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java
index cb8c6449b..2e65f81b4 100644
--- a/InCallUI/src/com/android/incallui/VideoCallFragment.java
+++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java
@@ -499,6 +499,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
public void onPause() {
super.onPause();
Log.d(this, "onPause:");
+ getPresenter().cancelAutoFullScreen();
}
@Override
@@ -549,6 +550,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
* Hides and shows the incoming video view and changes the outgoing video view's state based on
* whether outgoing view is enabled or not.
*/
+ @Override
public void showVideoViews(boolean previewPaused, boolean showIncoming) {
inflateVideoUi(true);
@@ -567,6 +569,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
/**
* Hide all video views.
*/
+ @Override
public void hideVideoUi() {
inflateVideoUi(false);
}
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index 9a33d80eb..7617608d1 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -81,7 +81,9 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
private Runnable mAutoFullscreenRunnable = new Runnable() {
@Override
public void run() {
- if (mAutoFullScreenPending && !InCallPresenter.getInstance().isDialpadVisible()) {
+ if (mAutoFullScreenPending && !InCallPresenter.getInstance().isDialpadVisible()
+ && mIsVideoMode) {
+
Log.v(this, "Automatically entering fullscreen mode.");
InCallPresenter.getInstance().setFullScreen(true);
mAutoFullScreenPending = false;
@@ -258,6 +260,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return;
}
+ cancelAutoFullScreen();
+
InCallPresenter.getInstance().removeListener(this);
InCallPresenter.getInstance().removeDetailsListener(this);
InCallPresenter.getInstance().removeIncomingCallListener(this);
@@ -495,7 +499,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
updateCameraSelection(call);
if (isVideoCall) {
- enterVideoMode(call);
+ adjustVideoMode(call);
} else if (isVideoMode()) {
exitVideoMode();
}
@@ -555,7 +559,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
Log.d(this, "onPrimaryCallChanged: Entering video mode...");
updateCameraSelection(newPrimaryCall);
- enterVideoMode(newPrimaryCall);
+ adjustVideoMode(newPrimaryCall);
}
}
@@ -630,7 +634,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* Handles a change to the video call. Sets the surfaces on the previous call to null and sets
* the surfaces on the new video call accordingly.
*
- * @param videoCall The new video call.
+ * @param call The new video call.
*/
private void changeVideoCall(Call call) {
final VideoCall videoCall = call.getTelecomCall().getVideoCall();
@@ -651,13 +655,13 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
if (VideoUtils.isVideoCall(call) && hasChanged) {
- enterVideoMode(call);
+ adjustVideoMode(call);
}
}
private static boolean isCameraRequired(int videoState) {
- return VideoProfile.isBidirectional(videoState) ||
- VideoProfile.isTransmissionEnabled(videoState);
+ return VideoProfile.isBidirectional(videoState)
+ || VideoProfile.isTransmissionEnabled(videoState);
}
private boolean isCameraRequired() {
@@ -665,14 +669,16 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
/**
- * Enters video mode by showing the video surfaces and making other adjustments (eg. audio).
+ * Adjusts the current video mode by setting up the preview and display surfaces as necessary.
+ * Expected to be called whenever the video state associated with a call changes (e.g. a user
+ * turns their camera on or off) to ensure the correct surfaces are shown/hidden.
* TODO(vt): Need to adjust size and orientation of preview surface here.
*/
- private void enterVideoMode(Call call) {
+ private void adjustVideoMode(Call call) {
VideoCall videoCall = call.getVideoCall();
int newVideoState = call.getVideoState();
- Log.d(this, "enterVideoMode videoCall= " + videoCall + " videoState: " + newVideoState);
+ Log.d(this, "adjustVideoMode videoCall= " + videoCall + " videoState: " + newVideoState);
VideoCallUi ui = getUi();
if (ui == null) {
Log.e(this, "Error VideoCallUi is null so returning");
@@ -692,16 +698,15 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
videoCall.setDeviceOrientation(mDeviceOrientation);
enableCamera(videoCall, isCameraRequired(newVideoState));
}
+ int previousVideoState = mCurrentVideoState;
mCurrentVideoState = newVideoState;
-
mIsVideoMode = true;
- maybeAutoEnterFullscreen(call);
- }
-
- private static boolean isSpeakerEnabledForVideoCalls() {
- // TODO: Make this a carrier configurable setting. For now this is always true. b/20090407
- return true;
+ // adjustVideoMode may be called if we are already in a 1-way video state. In this case
+ // we do not want to trigger auto-fullscreen mode.
+ if (!VideoUtils.isVideoCall(previousVideoState) && VideoUtils.isVideoCall(newVideoState)) {
+ maybeAutoEnterFullscreen(call);
+ }
}
private void enableCamera(VideoCall videoCall, boolean isCameraRequired) {
@@ -1068,6 +1073,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* 2. Call is not active
* 3. Call is not video call
* 4. Already in fullscreen mode
+ * 5. The current video state is not bi-directional (if the remote party stops transmitting,
+ * the user's contact photo would dominate in fullscreen mode).
*
* @param call The current call.
*/
@@ -1079,7 +1086,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
if (call == null || (
call != null && (call.getState() != Call.State.ACTIVE ||
!VideoUtils.isVideoCall(call)) ||
- InCallPresenter.getInstance().isFullscreen())) {
+ InCallPresenter.getInstance().isFullscreen()) ||
+ !VideoUtils.isBidirectionalVideoCall(call)) {
// Ensure any previously scheduled attempt to enter fullscreen is cancelled.
cancelAutoFullScreen();
return;
@@ -1106,10 +1114,6 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
mAutoFullScreenPending = false;
}
- private static boolean isAudioRouteEnabled(int audioRoute, int audioRouteMask) {
- return ((audioRoute & audioRouteMask) != 0);
- }
-
private static void updateCameraSelection(Call call) {
Log.d(TAG, "updateCameraSelection: call=" + call);
Log.d(TAG, "updateCameraSelection: call=" + toSimpleString(call));