am 1c814b5c: Merge "implement HDMI-like demo mode for remote display" into lmp-mr1-dev

* commit '1c814b5c61c538c7ef5176b1121e1ea0c65046e6':
  implement HDMI-like demo mode for remote display
This commit is contained in:
Chong Zhang
2014-11-15 02:32:34 +00:00
committed by Android Git Automerger
2 changed files with 26 additions and 0 deletions

View File

@@ -342,6 +342,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
int mUndockedHdmiRotation; int mUndockedHdmiRotation;
int mDemoHdmiRotation; int mDemoHdmiRotation;
boolean mDemoHdmiRotationLock; boolean mDemoHdmiRotationLock;
int mDemoRotation;
boolean mDemoRotationLock;
boolean mWakeGestureEnabledSetting; boolean mWakeGestureEnabledSetting;
MyWakeGestureListener mWakeGestureListener; MyWakeGestureListener mWakeGestureListener;
@@ -1451,6 +1453,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} }
mDemoHdmiRotationLock = SystemProperties.getBoolean("persist.demo.hdmirotationlock", false); mDemoHdmiRotationLock = SystemProperties.getBoolean("persist.demo.hdmirotationlock", false);
// For demo purposes, allow the rotation of the remote display to be controlled.
// By default, remote display locks rotation to landscape.
if ("portrait".equals(SystemProperties.get("persist.demo.remoterotation"))) {
mDemoRotation = mPortraitRotation;
} else {
mDemoRotation = mLandscapeRotation;
}
mDemoRotationLock = SystemProperties.getBoolean(
"persist.demo.rotationlock", false);
// Only force the default orientation if the screen is xlarge, at least 960dp x 720dp, per // Only force the default orientation if the screen is xlarge, at least 960dp x 720dp, per
// http://developer.android.com/guide/practices/screens_support.html#range // http://developer.android.com/guide/practices/screens_support.html#range
mForceDefaultOrientation = longSizeDp >= 960 && shortSizeDp >= 720 && mForceDefaultOrientation = longSizeDp >= 960 && shortSizeDp >= 720 &&
@@ -5313,6 +5325,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// full multi-display support). // full multi-display support).
// Note that the dock orientation overrides the HDMI orientation. // Note that the dock orientation overrides the HDMI orientation.
preferredRotation = mUndockedHdmiRotation; preferredRotation = mUndockedHdmiRotation;
} else if (mDemoRotationLock) {
// Ignore sensor when demo rotation lock is enabled.
// Note that the dock orientation and HDMI rotation lock override this.
preferredRotation = mDemoRotation;
} else if (orientation == ActivityInfo.SCREEN_ORIENTATION_LOCKED) { } else if (orientation == ActivityInfo.SCREEN_ORIENTATION_LOCKED) {
// Application just wants to remain locked in the last rotation. // Application just wants to remain locked in the last rotation.
preferredRotation = lastRotation; preferredRotation = lastRotation;

View File

@@ -23,6 +23,7 @@ import android.media.projection.IMediaProjection;
import android.media.projection.IMediaProjectionCallback; import android.media.projection.IMediaProjectionCallback;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.SystemProperties;
import android.os.IBinder.DeathRecipient; import android.os.IBinder.DeathRecipient;
import android.os.Message; import android.os.Message;
import android.os.RemoteException; import android.os.RemoteException;
@@ -278,6 +279,15 @@ final class VirtualDisplayAdapter extends DisplayAdapter {
} }
if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION) != 0) { if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION) != 0) {
mInfo.flags |= DisplayDeviceInfo.FLAG_PRESENTATION; mInfo.flags |= DisplayDeviceInfo.FLAG_PRESENTATION;
if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC) != 0) {
// For demonstration purposes, allow rotation of the external display.
// In the future we might allow the user to configure this directly.
if ("portrait".equals(SystemProperties.get(
"persist.demo.remoterotation"))) {
mInfo.rotation = Surface.ROTATION_270;
}
}
} }
mInfo.type = Display.TYPE_VIRTUAL; mInfo.type = Display.TYPE_VIRTUAL;
mInfo.touch = DisplayDeviceInfo.TOUCH_NONE; mInfo.touch = DisplayDeviceInfo.TOUCH_NONE;