From d14c8c9039c0056e1f30ad5d410c8fde20d63df5 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Tue, 7 Jan 2014 18:13:09 -0800 Subject: Add flag to force public virtual display to show own content. Change-Id: I1039f2ef3154169ec90411a4c7ba2c94629f72c4 --- .../java/com/android/server/display/DisplayDeviceInfo.java | 10 ++++++++++ .../java/com/android/server/display/DisplayManagerService.java | 8 ++++---- .../java/com/android/server/display/VirtualDisplayAdapter.java | 7 +++++-- 3 files changed, 19 insertions(+), 6 deletions(-) (limited to 'services/core/java') diff --git a/services/core/java/com/android/server/display/DisplayDeviceInfo.java b/services/core/java/com/android/server/display/DisplayDeviceInfo.java index 11c5d87..11aecdd 100644 --- a/services/core/java/com/android/server/display/DisplayDeviceInfo.java +++ b/services/core/java/com/android/server/display/DisplayDeviceInfo.java @@ -63,6 +63,7 @@ final class DisplayDeviceInfo { /** * Flag: Indicates that the display device is owned by a particular application * and that no other application should be able to interact with it. + * Should typically be used together with {@link #FLAG_OWN_CONTENT_ONLY}. */ public static final int FLAG_PRIVATE = 1 << 4; @@ -78,6 +79,12 @@ final class DisplayDeviceInfo { public static final int FLAG_PRESENTATION = 1 << 6; /** + * Flag: Only show this display's own content; do not mirror + * the content of another display. + */ + public static final int FLAG_OWN_CONTENT_ONLY = 1 << 7; + + /** * Touch attachment: Display does not receive touch. */ public static final int TOUCH_NONE = 0; @@ -297,6 +304,9 @@ final class DisplayDeviceInfo { if ((flags & FLAG_PRESENTATION) != 0) { msg.append(", FLAG_PRESENTATION"); } + if ((flags & FLAG_OWN_CONTENT_ONLY) != 0) { + msg.append(", FLAG_OWN_CONTENT_ONLY"); + } return msg.toString(); } } diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java index 73040d5..073e24a 100644 --- a/services/core/java/com/android/server/display/DisplayManagerService.java +++ b/services/core/java/com/android/server/display/DisplayManagerService.java @@ -1024,13 +1024,13 @@ public final class DisplayManagerService extends IDisplayManager.Stub { } private void configureDisplayInTransactionLocked(DisplayDevice device) { - DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked(); - boolean isPrivate = (info.flags & DisplayDeviceInfo.FLAG_PRIVATE) != 0; + final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked(); + final boolean ownContent = (info.flags & DisplayDeviceInfo.FLAG_OWN_CONTENT_ONLY) != 0; // Find the logical display that the display device is showing. - // Private displays never mirror other displays. + // Certain displays only ever show their own content. LogicalDisplay display = findLogicalDisplayForDeviceLocked(device); - if (!isPrivate) { + if (!ownContent) { if (display != null && !display.hasContentLocked()) { // If the display does not have any content of its own, then // automatically mirror the default logical display contents. diff --git a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java index 46d473c..95ca0d2 100644 --- a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java +++ b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java @@ -157,8 +157,11 @@ final class VirtualDisplayAdapter extends DisplayAdapter { mInfo.yDpi = mDensityDpi; mInfo.flags = 0; if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC) == 0) { - mInfo.flags |= DisplayDeviceInfo.FLAG_PRIVATE | - DisplayDeviceInfo.FLAG_NEVER_BLANK; + mInfo.flags |= DisplayDeviceInfo.FLAG_PRIVATE + | DisplayDeviceInfo.FLAG_NEVER_BLANK + | DisplayDeviceInfo.FLAG_OWN_CONTENT_ONLY; + } else if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY) != 0) { + mInfo.flags |= DisplayDeviceInfo.FLAG_OWN_CONTENT_ONLY; } if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE) != 0) { mInfo.flags |= DisplayDeviceInfo.FLAG_SECURE; -- cgit v1.1