Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27378c64 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add a flag to virtual display to indicates that content on this display...

Merge "Add a flag to virtual display to indicates that content on this display need to be destroyed once the display is removed. Then apply this flag to VR virtual display." into oc-mr1-dev
parents 9dfbb0ea 1e90fc38
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -278,6 +278,15 @@ public final class DisplayManager {
     */
    public static final int VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT = 1 << 7;

    /**
     * Virtual display flag: Indicates that the contents will be destroyed once
     * the display is removed.
     *
     * @see #createVirtualDisplay
     * @hide
     */
    public static final int VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL = 1 << 8;

    /** @hide */
    public DisplayManager(Context context) {
        mContext = context;
+6 −0
Original line number Diff line number Diff line
@@ -97,6 +97,12 @@ final class DisplayDeviceInfo {
     */
    public static final int FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD = 1 << 9;

    /**
     * Flag: This display will destroy its content on removal.
     * @hide
     */
    public static final int FLAG_DESTROY_CONTENT_ON_REMOVAL = 1 << 10;

    /**
     * Touch attachment: Display does not receive touch.
     */
+3 −0
Original line number Diff line number Diff line
@@ -238,6 +238,9 @@ final class LogicalDisplay {
                // For private displays by default content is destroyed on removal.
                mBaseDisplayInfo.removeMode = Display.REMOVE_MODE_DESTROY_CONTENT;
            }
            if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_DESTROY_CONTENT_ON_REMOVAL) != 0) {
                mBaseDisplayInfo.removeMode = Display.REMOVE_MODE_DESTROY_CONTENT;
            }
            if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_PRESENTATION) != 0) {
                mBaseDisplayInfo.flags |= Display.FLAG_PRESENTATION;
            }
+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLI
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_SECURE;
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH;
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT;
import static android.hardware.display.DisplayManager
        .VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL;

import android.content.Context;
import android.hardware.display.IVirtualDisplayCallback;
@@ -363,6 +365,9 @@ public class VirtualDisplayAdapter extends DisplayAdapter {
                if ((mFlags & VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT) != 0) {
                    mInfo.flags |= DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
                }
                if ((mFlags & VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL) != 0) {
                  mInfo.flags |= DisplayDeviceInfo.FLAG_DESTROY_CONTENT_ON_REMOVAL;
                }

                mInfo.type = Display.TYPE_VIRTUAL;
                mInfo.touch = ((mFlags & VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH) == 0) ?
+1 −0
Original line number Diff line number Diff line
@@ -296,6 +296,7 @@ class Vr2dDisplay {
            flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT;
            flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC;
            flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
            flags |= DisplayManager.VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL;
            mVirtualDisplay = mDisplayManager.createVirtualDisplay(null /* projection */,
                    DISPLAY_NAME, mVirtualDisplayWidth, mVirtualDisplayHeight, mVirtualDisplayDpi,
                    null /* surface */, flags, null /* callback */, null /* handler */,