diff options
author | Garik Badalyan <garikb@codeaurora.org> | 2015-11-16 14:49:54 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-05-20 23:09:14 -0700 |
commit | d7057aba433e38685948bccde28527c993507b09 (patch) | |
tree | 74b4e549af469acdb5483d0eae21c6690318612d | |
parent | 8d3421dd744b0fff95a53c08cac4c33718bb98fc (diff) | |
download | packages_apps_InCallUI-d7057aba433e38685948bccde28527c993507b09.tar.gz packages_apps_InCallUI-d7057aba433e38685948bccde28527c993507b09.tar.bz2 packages_apps_InCallUI-d7057aba433e38685948bccde28527c993507b09.zip |
IMS-VT: Fix camera preview size.
When CVO is enabled camera preview shall be
in portrait orientation when the device's current
orientation is portrait, and it shall be in
landscape orientation if the devices's current
orientation is landscape.
Change-Id: I9bd85bcddea9a1d45f51c56bc8e59c5461d0b2c9
CRs-Fixed: 934532
-rw-r--r-- | src/com/android/incallui/VideoCallFragment.java | 10 | ||||
-rw-r--r-- | src/com/android/incallui/VideoCallPresenter.java | 19 |
2 files changed, 10 insertions, 19 deletions
diff --git a/src/com/android/incallui/VideoCallFragment.java b/src/com/android/incallui/VideoCallFragment.java index 2a556a20..6c7f1b01 100644 --- a/src/com/android/incallui/VideoCallFragment.java +++ b/src/com/android/incallui/VideoCallFragment.java @@ -713,14 +713,8 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, @Override public void setPreviewRotation(int orientation) { Log.d(this, "setPreviewRotation: orientation=" + orientation); - if (sPreviewSurface != null) { - TextureView preview = sPreviewSurface.getTextureView(); - - if (preview == null ) { - return; - } - - preview.setRotation(orientation); + if (mPreviewVideoContainer != null) { + mPreviewVideoContainer.setRotation(orientation); } } diff --git a/src/com/android/incallui/VideoCallPresenter.java b/src/com/android/incallui/VideoCallPresenter.java index 5723e175..a56f6041 100644 --- a/src/com/android/incallui/VideoCallPresenter.java +++ b/src/com/android/incallui/VideoCallPresenter.java @@ -1147,18 +1147,15 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi return; } - int height; - int width; + final int adjustedDimension = (int) (mMinimumVideoDimension * aspectRatio); + final int min = (int) Math.min(mMinimumVideoDimension, adjustedDimension); + final int max = (int) Math.max(mMinimumVideoDimension, adjustedDimension); + + // When orientation is dynamic (CVO), we dynamically rotate the camera preview, hence + // here we make sure that the height of the preview is always greater than the width. + int height = max; + int width = min; - if (orientation == InCallOrientationEventListener.SCREEN_ORIENTATION_90 || - orientation == InCallOrientationEventListener.SCREEN_ORIENTATION_270) { - width = (int) (mMinimumVideoDimension * aspectRatio); - height = (int) mMinimumVideoDimension; - } else { - // Portrait or reverse portrait orientation. - width = (int) mMinimumVideoDimension; - height = (int) (mMinimumVideoDimension * aspectRatio); - } ui.setPreviewSize(width, height); } |