summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui/VideoCallPresenter.java
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-05-18 09:40:31 -0700
committerTyler Gunn <tgunn@google.com>2015-05-18 10:02:14 -0700
commit48b1ef1a1c5842d0f3b4656560c538015007e9bd (patch)
tree4e07c0343adf596834057aafa2c27686807b511e /InCallUI/src/com/android/incallui/VideoCallPresenter.java
parent61b21efb1c4e3b2c1a4d33b6bf5eda3e528139c1 (diff)
Remove reliance on getDefaultDisplay() to determine screen rotation.
Replaced the calls to getWindowManager().getDefaultDisplay() with code to determine the screen rotation angle based on the angle ranges. Bug: 21208380 Change-Id: Ie91d38f9c0b4227bb2148a193c00339b5d8f4ce6
Diffstat (limited to 'InCallUI/src/com/android/incallui/VideoCallPresenter.java')
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index ed7edf93c..20f3912b4 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -91,13 +91,6 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
};
/**
- * Determines the device orientation (portrait/lanscape).
- */
- public int getDeviceOrientation() {
- return mDeviceOrientation;
- }
-
- /**
* Defines the state of the preview surface negotiation with the telephony layer.
*/
private class PreviewSurfaceState {
@@ -947,8 +940,10 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
/**
* Handles changes to the device orientation.
- * See: {@link Configuration.ORIENTATION_LANDSCAPE}, {@link Configuration.ORIENTATION_PORTRAIT}
- * @param orientation The device orientation.
+ *
+ * @param orientation The device orientation (one of: {@link Surface#ROTATION_0},
+ * {@link Surface#ROTATION_90}, {@link Surface#ROTATION_180},
+ * {@link Surface#ROTATION_270}).
*/
@Override
public void onDeviceOrientationChanged(int orientation) {
@@ -1009,9 +1004,10 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
/**
* Sets the preview surface size based on the current device orientation.
- * See: {@link Configuration.ORIENTATION_LANDSCAPE}, {@link Configuration.ORIENTATION_PORTRAIT}
*
- * @param orientation The device orientation.
+ * @param orientation The device orientation (one of: {@link Surface#ROTATION_0},
+ * {@link Surface#ROTATION_90}, {@link Surface#ROTATION_180},
+ * {@link Surface#ROTATION_270}).
* @param aspectRatio The aspect ratio of the camera (width / height).
*/
private void setPreviewSize(int orientation, float aspectRatio) {
@@ -1023,10 +1019,12 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
int height;
int width;
- if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ if (orientation == Surface.ROTATION_90 || orientation == Surface.ROTATION_270) {
+ // Landscape or reverse landscape orientation.
width = (int) (mMinimumVideoDimension * aspectRatio);
height = (int) mMinimumVideoDimension;
} else {
+ // Portrait or reverse portrait orientation.
width = (int) mMinimumVideoDimension;
height = (int) (mMinimumVideoDimension * aspectRatio);
}