Merge "Add flag to force public virtual display to show own content." into klp-modular-dev
This commit is contained in:
@ -10870,6 +10870,7 @@ package android.hardware.display {
|
|||||||
method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler);
|
method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler);
|
||||||
method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener);
|
method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener);
|
||||||
field public static final java.lang.String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION";
|
field public static final java.lang.String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION";
|
||||||
|
field public static final int VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 8; // 0x8
|
||||||
field public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2; // 0x2
|
field public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2; // 0x2
|
||||||
field public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1; // 0x1
|
field public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1; // 0x1
|
||||||
field public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 4; // 0x4
|
field public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 4; // 0x4
|
||||||
|
@ -115,6 +115,7 @@ public final class DisplayManager {
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @see #createVirtualDisplay
|
* @see #createVirtualDisplay
|
||||||
|
* @see #VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY
|
||||||
*/
|
*/
|
||||||
public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1 << 0;
|
public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1 << 0;
|
||||||
|
|
||||||
@ -171,6 +172,22 @@ public final class DisplayManager {
|
|||||||
*/
|
*/
|
||||||
public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 1 << 2;
|
public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 1 << 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual display flag: Only show this display's own content; do not mirror
|
||||||
|
* the content of another display.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This flag is used in conjunction with {@link #VIRTUAL_DISPLAY_FLAG_PUBLIC}.
|
||||||
|
* Ordinarily public virtual displays will automatically mirror the content of the
|
||||||
|
* default display if they have no windows of their own. When this flag is
|
||||||
|
* specified, the virtual display will only ever show its own content and
|
||||||
|
* will be blanked instead if it has no windows.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @see #createVirtualDisplay
|
||||||
|
*/
|
||||||
|
public static final int VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 1 << 3;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public DisplayManager(Context context) {
|
public DisplayManager(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@ -429,8 +446,8 @@ public final class DisplayManager {
|
|||||||
* @param surface The surface to which the content of the virtual display should
|
* @param surface The surface to which the content of the virtual display should
|
||||||
* be rendered, must be non-null.
|
* be rendered, must be non-null.
|
||||||
* @param flags A combination of virtual display flags:
|
* @param flags A combination of virtual display flags:
|
||||||
* {@link #VIRTUAL_DISPLAY_FLAG_PUBLIC}, {@link #VIRTUAL_DISPLAY_FLAG_PRESENTATION}
|
* {@link #VIRTUAL_DISPLAY_FLAG_PUBLIC}, {@link #VIRTUAL_DISPLAY_FLAG_PRESENTATION},
|
||||||
* or {@link #VIRTUAL_DISPLAY_FLAG_SECURE}.
|
* {@link #VIRTUAL_DISPLAY_FLAG_SECURE}, or {@link #VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY}.
|
||||||
* @return The newly created virtual display, or null if the application could
|
* @return The newly created virtual display, or null if the application could
|
||||||
* not create the virtual display.
|
* not create the virtual display.
|
||||||
*
|
*
|
||||||
|
@ -63,6 +63,7 @@ final class DisplayDeviceInfo {
|
|||||||
/**
|
/**
|
||||||
* Flag: Indicates that the display device is owned by a particular application
|
* Flag: Indicates that the display device is owned by a particular application
|
||||||
* and that no other application should be able to interact with it.
|
* 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;
|
public static final int FLAG_PRIVATE = 1 << 4;
|
||||||
|
|
||||||
@ -77,6 +78,12 @@ final class DisplayDeviceInfo {
|
|||||||
*/
|
*/
|
||||||
public static final int FLAG_PRESENTATION = 1 << 6;
|
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.
|
* Touch attachment: Display does not receive touch.
|
||||||
*/
|
*/
|
||||||
@ -297,6 +304,9 @@ final class DisplayDeviceInfo {
|
|||||||
if ((flags & FLAG_PRESENTATION) != 0) {
|
if ((flags & FLAG_PRESENTATION) != 0) {
|
||||||
msg.append(", FLAG_PRESENTATION");
|
msg.append(", FLAG_PRESENTATION");
|
||||||
}
|
}
|
||||||
|
if ((flags & FLAG_OWN_CONTENT_ONLY) != 0) {
|
||||||
|
msg.append(", FLAG_OWN_CONTENT_ONLY");
|
||||||
|
}
|
||||||
return msg.toString();
|
return msg.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1024,13 +1024,13 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void configureDisplayInTransactionLocked(DisplayDevice device) {
|
private void configureDisplayInTransactionLocked(DisplayDevice device) {
|
||||||
DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
|
final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
|
||||||
boolean isPrivate = (info.flags & DisplayDeviceInfo.FLAG_PRIVATE) != 0;
|
final boolean ownContent = (info.flags & DisplayDeviceInfo.FLAG_OWN_CONTENT_ONLY) != 0;
|
||||||
|
|
||||||
// Find the logical display that the display device is showing.
|
// 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);
|
LogicalDisplay display = findLogicalDisplayForDeviceLocked(device);
|
||||||
if (!isPrivate) {
|
if (!ownContent) {
|
||||||
if (display != null && !display.hasContentLocked()) {
|
if (display != null && !display.hasContentLocked()) {
|
||||||
// If the display does not have any content of its own, then
|
// If the display does not have any content of its own, then
|
||||||
// automatically mirror the default logical display contents.
|
// automatically mirror the default logical display contents.
|
||||||
|
@ -157,8 +157,11 @@ final class VirtualDisplayAdapter extends DisplayAdapter {
|
|||||||
mInfo.yDpi = mDensityDpi;
|
mInfo.yDpi = mDensityDpi;
|
||||||
mInfo.flags = 0;
|
mInfo.flags = 0;
|
||||||
if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC) == 0) {
|
if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC) == 0) {
|
||||||
mInfo.flags |= DisplayDeviceInfo.FLAG_PRIVATE |
|
mInfo.flags |= DisplayDeviceInfo.FLAG_PRIVATE
|
||||||
DisplayDeviceInfo.FLAG_NEVER_BLANK;
|
| 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) {
|
if ((mFlags & DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE) != 0) {
|
||||||
mInfo.flags |= DisplayDeviceInfo.FLAG_SECURE;
|
mInfo.flags |= DisplayDeviceInfo.FLAG_SECURE;
|
||||||
|
Reference in New Issue
Block a user