summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuhammed Siju <msiju@codeaurora.org>2015-08-07 18:00:40 +0530
committerSteve Kondik <steve@cyngn.com>2016-05-20 23:09:14 -0700
commit15d366cbe1442b2b4b708a8ad82d30c3fc97eafd (patch)
treedf9a3cece409f7679fafb2daaf8b3129c79fa375
parent8c4ffdccfed6120dbde1ecf1851472c4beb5a8aa (diff)
downloadpackages_apps_InCallUI-15d366cbe1442b2b4b708a8ad82d30c3fc97eafd.tar.gz
packages_apps_InCallUI-15d366cbe1442b2b4b708a8ad82d30c3fc97eafd.tar.bz2
packages_apps_InCallUI-15d366cbe1442b2b4b708a8ad82d30c3fc97eafd.zip
IMS-VT: Use correct view size when device is rotated.
When peer_resolution received is portrait mode and the device is in landscape, the far-end video view will be re sized to fit the peer aspect ratio. If we rotate the device back to portrait, the view size needs to be re calculated based on the previously received peer_resolution. Change-Id: I47b84fd823c6110dca87bcc372be1aaeb9888efa CRs-Fixed: 887207
-rw-r--r--src/com/android/incallui/VideoCallFragment.java6
-rw-r--r--src/com/android/incallui/VideoCallPresenter.java8
2 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/incallui/VideoCallFragment.java b/src/com/android/incallui/VideoCallFragment.java
index 7c83f6e7..cf887b49 100644
--- a/src/com/android/incallui/VideoCallFragment.java
+++ b/src/com/android/incallui/VideoCallFragment.java
@@ -817,7 +817,11 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
Log.d(this, "inflateVideoCallViews: sVideoSurfacesInUse=" + sVideoSurfacesInUse);
//If peer adjusted screen size is not available, set screen size to default display size
- Point screenSize = sDisplaySize == null ? getScreenSize() : sDisplaySize;
+ Point screenSize = getScreenSize();
+ if (sDisplaySize != null) {
+ screenSize = VideoCallPresenter.resizeForAspectRatio(screenSize,
+ sDisplaySize.x, sDisplaySize.y);
+ }
setSurfaceSizeAndTranslation(displaySurface, screenSize);
if (!sVideoSurfacesInUse) {
diff --git a/src/com/android/incallui/VideoCallPresenter.java b/src/com/android/incallui/VideoCallPresenter.java
index 2c889fb7..5ec593f4 100644
--- a/src/com/android/incallui/VideoCallPresenter.java
+++ b/src/com/android/incallui/VideoCallPresenter.java
@@ -1175,6 +1175,12 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
Point size = ui.getScreenSize();
Log.d("VideoCallPresenter", "setDisplayVideoSize: windowmgr width=" + size.x
+ " windowmgr height=" + size.y);
+ size = resizeForAspectRatio(size, width, height);
+ ui.setDisplayVideoSize(size.x, size.y);
+ }
+
+ public static Point resizeForAspectRatio(Point inSize, int width, int height) {
+ Point size = new Point(inSize);
if (size.y * width > size.x * height) {
// current display height is too much. Correct it
size.y = (int) (size.x * height / width);
@@ -1182,7 +1188,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
// current display width is too much. Correct it
size.x = (int) (size.y * width / height);
}
- ui.setDisplayVideoSize(size.x, size.y);
+ return size;
}
/**