summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2016-05-26 16:21:44 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-26 16:21:44 +0000
commit01e31150e1819cf37df5b143b3a845db2397d240 (patch)
tree69f599ff45fe30a0ff1b3e785779936142309736 /InCallUI
parent01d47272b6d4303b584eb2128e26390b05225a42 (diff)
parent50b2f304bde9bdb8c8c5ca57efafb53a417afa78 (diff)
IMS-VT: Optimize handling of orientation requests
am: 50b2f304bd * commit '50b2f304bde9bdb8c8c5ca57efafb53a417afa78': IMS-VT: Optimize handling of orientation requests Change-Id: I24efa19c686276c0fddc4a40638f9d5c464ba8aa
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/InCallOrientationEventListener.java27
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java1
2 files changed, 28 insertions, 0 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallOrientationEventListener.java b/InCallUI/src/com/android/incallui/InCallOrientationEventListener.java
index d3334a3ef..3cab6dc3b 100644
--- a/InCallUI/src/com/android/incallui/InCallOrientationEventListener.java
+++ b/InCallUI/src/com/android/incallui/InCallOrientationEventListener.java
@@ -62,6 +62,7 @@ public class InCallOrientationEventListener extends OrientationEventListener {
* Cache the current rotation of the device.
*/
private static int sCurrentOrientation = SCREEN_ORIENTATION_0;
+ private boolean mEnabled = false;
public InCallOrientationEventListener(Context context) {
super(context);
@@ -97,7 +98,13 @@ public class InCallOrientationEventListener extends OrientationEventListener {
* @param notify true or false. Notify device orientation changed if true.
*/
public void enable(boolean notify) {
+ if (mEnabled) {
+ Log.v(this, "enable: Orientation listener is already enabled. Ignoring...");
+ return;
+ }
+
super.enable();
+ mEnabled = true;
if (notify) {
InCallPresenter.getInstance().onDeviceOrientationChange(sCurrentOrientation);
}
@@ -111,6 +118,26 @@ public class InCallOrientationEventListener extends OrientationEventListener {
}
/**
+ * Disables the OrientationEventListener.
+ */
+ public void disable() {
+ if (!mEnabled) {
+ Log.v(this, "enable: Orientation listener is already disabled. Ignoring...");
+ return;
+ }
+
+ mEnabled = false;
+ super.disable();
+ }
+
+ /**
+ * Returns true the OrientationEventListener is enabled, false otherwise.
+ */
+ public boolean isEnabled() {
+ return mEnabled;
+ }
+
+ /**
* Converts sensor rotation in degrees to screen orientation constants.
* @param rotation sensor rotation angle in degrees
* @return Screen orientation angle in degrees (0, 90, 180, 270). Returns -1 for degrees not
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index 3494afa6d..06e3e4440 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -565,6 +565,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
updateCameraSelection(newPrimaryCall);
adjustVideoMode(newPrimaryCall);
}
+ checkForOrientationAllowedChange(newPrimaryCall);
}
private boolean isVideoMode() {