Merge f3c187b20d4f910e20a3cfea70f57178fcb54008 on remote branch
Change-Id: I737094f31b465c4ee23c1b3e6f7d9e35094d2295
diff --git a/InCallUI/res/values/qtiarray.xml b/InCallUI/res/values/qtiarray.xml
index 3e7e1e8..1edadb6 100644
--- a/InCallUI/res/values/qtiarray.xml
+++ b/InCallUI/res/values/qtiarray.xml
@@ -51,12 +51,16 @@
<item>@null</item>
<item>@string/description_target_decline</item>
<item>@string/description_target_answer_audio_call</item>
+ <item>@string/description_target_accept_upgrade_to_video_transmit_request</item>
+ <item>@string/description_target_accept_upgrade_to_video_receive_request</item>
</array>
<array name="qti_incoming_call_widget_video_without_sms_direction_descriptions">
<item>@string/description_direction_right</item>
<item>@null</item>
<item>@string/description_direction_left</item>
<item>@string/description_direction_down</item>
+ <item>@null</item>
+ <item>@null</item>
</array>
<!-- For video transmit(Tx), if respond via SMS is disabled:
@@ -123,12 +127,16 @@
<item>@string/description_target_send_sms</item>
<item>@string/description_target_decline</item>
<item>@string/description_target_answer_audio_call</item>
+ <item>@string/description_target_accept_upgrade_to_video_transmit_request</item>
+ <item>@string/description_target_accept_upgrade_to_video_receive_request</item>
</array>
<array name="qti_incoming_call_widget_video_with_sms_direction_descriptions">
<item>@string/description_direction_right</item>
<item>@string/description_direction_up</item>
<item>@string/description_direction_left</item>
<item>@string/description_direction_down</item>
+ <item>@null</item>
+ <item>@null</item>
</array>
<!-- For video transmit(Tx) calls, if respond via SMS is enabled:
@@ -192,14 +200,16 @@
<array name="qti_incoming_call_widget_video_request_target_descriptions">
<item>@string/description_target_accept_upgrade_to_video_request</item>
- <item>@null</item>
<item>@string/description_target_decline_upgrade_to_video_request</item>
- <item>@null</item>"
+ <item>@string/description_target_answer_audio_call</item>
+ <item>@string/description_target_accept_upgrade_to_video_transmit_request</item>
+ <item>@string/description_target_accept_upgrade_to_video_receive_request</item>
</array>
<array name="qti_incoming_call_widget_video_request_target_direction_descriptions">
<item>@string/description_direction_right</item>
- <item>@null</item>
+ <item>@string/description_direction_up</item>
<item>@string/description_direction_left</item>
+ <item>@string/description_direction_down</item>
<item>@null</item>
</array>
diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java
index 4e55fd7..9292110 100644
--- a/InCallUI/src/com/android/incallui/VideoCallFragment.java
+++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java
@@ -398,7 +398,11 @@
+ " mSurfaceId =" + mSurfaceId + " mWidth " + width + " mHeight=" + height);
if (width != DIMENSIONS_NOT_SET && height != DIMENSIONS_NOT_SET
&& mSavedSurfaceTexture != null) {
- mSavedSurfaceTexture.setDefaultBufferSize(width, height);
+ if (mSurfaceId == SURFACE_PREVIEW) {
+ mPresenter.setPreviewSurfaceSize(width, height);
+ } else {
+ mSavedSurfaceTexture.setDefaultBufferSize(width, height);
+ }
mSavedSurface = new Surface(mSavedSurfaceTexture);
return true;
}
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index c1e4f2e..324c786 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -1098,7 +1098,9 @@
}
if (showOutgoingVideo) {
- setPreviewSize(mDeviceOrientation, mPreviewAspectRatio);
+ if ((SystemProperties.getInt(PROP_DISABLE_VIDEOCALL_PIP_MODE, 0) == 1)) {
+ setPreviewSize(mDeviceOrientation, mPreviewAspectRatio);
+ }
if (QtiCallUtils.shallShowStaticImageUi(mContext)) {
maybeLoadPreConfiguredImageAsync();
}
@@ -1300,6 +1302,37 @@
}
}
+ private boolean isLandscapeOrientation(final int orientation) {
+ return (orientation == InCallOrientationEventListener.SCREEN_ORIENTATION_90 ||
+ orientation == InCallOrientationEventListener.SCREEN_ORIENTATION_270);
+ }
+
+ public void setPreviewSurfaceSize(int width, int height) {
+ VideoCallUi ui = getUi();
+ if (ui == null) {
+ return;
+ }
+
+ final int orientation = mDeviceOrientation;
+ Log.d(this, "setPreviewSurfaceSize orientation: " + orientation +
+ " width = " + width + " height = " + height);
+
+ final boolean isPortrait = width < height;
+ int w = width;
+ int h = height;
+
+ if ((isLandscapeOrientation(orientation) && !isPortrait) ||
+ !isLandscapeOrientation(orientation) && isPortrait) {
+ /* preview video needs to be displayed in landscape window so set
+ portrait preview surface size and vice-versa */
+ width = h;
+ height = w;
+ }
+
+ Log.d(this, "setPreviewSurfaceSize final width: " + width + " final height: " + height);
+ ui.setPreviewSurfaceSize(width, height);
+ }
+
/**
* Changes the dimensions of the preview surface.
*
@@ -1312,9 +1345,6 @@
return;
}
- // Resize the surface used to display the preview video
- ui.setPreviewSurfaceSize(width, height);
-
// Configure the preview surface to the correct aspect ratio.
float aspectRatio = 1.0f;
if (width > 0 && height > 0) {
@@ -1326,6 +1356,9 @@
// Resize the textureview housing the preview video and rotate it appropriately based on
// the device orientation
setPreviewSize(mDeviceOrientation, mPreviewAspectRatio);
+
+ // Resize the surface used to display the preview video
+ setPreviewSurfaceSize(width, height);
}
/**