Search in sources :

Example 11 with VirtualDisplay

use of android.hardware.display.VirtualDisplay in project android_frameworks_base by AOSPA.

the class VirtualDisplayTest method testPrivatePresentationVirtualDisplay.

/**
     * Ensures that an application can create a private presentation virtual display and show
     * its own windows on it.
     */
public void testPrivatePresentationVirtualDisplay() throws Exception {
    VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION);
    assertNotNull("virtual display must not be null", virtualDisplay);
    Display display = virtualDisplay.getDisplay();
    try {
        assertDisplayRegistered(display, Display.FLAG_PRIVATE | Display.FLAG_PRESENTATION);
        // Show a private presentation on the display.
        assertDisplayCanShowPresentation("private presentation window", display, BLUEISH, WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION, 0);
    } finally {
        virtualDisplay.release();
    }
    assertDisplayUnregistered(display);
}
Also used : VirtualDisplay(android.hardware.display.VirtualDisplay) Display(android.view.Display) VirtualDisplay(android.hardware.display.VirtualDisplay)

Example 12 with VirtualDisplay

use of android.hardware.display.VirtualDisplay in project android_frameworks_base by AOSPA.

the class VirtualDisplayTest method testPublicPresentationVirtualDisplay.

/**
     * Ensures that an application can create a public virtual display and show
     * its own windows on it.  This test requires the CAPTURE_VIDEO_OUTPUT permission.
     *
     * Because this test does not have an activity token, we use the TOAST window
     * type to create the window.  Another choice might be SYSTEM_ALERT_WINDOW but
     * that requires a permission.
     */
public void testPublicPresentationVirtualDisplay() throws Exception {
    VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION);
    assertNotNull("virtual display must not be null", virtualDisplay);
    Display display = virtualDisplay.getDisplay();
    try {
        assertDisplayRegistered(display, Display.FLAG_PRESENTATION);
        // Mirroring case.
        // Show a window on the default display.  It should be mirrored to the
        // virtual display automatically.
        Display defaultDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY);
        assertDisplayCanShowPresentation("mirrored window", defaultDisplay, GREENISH, WindowManager.LayoutParams.TYPE_TOAST, 0);
        // Mirroring case with secure window (but display is not secure).
        // Show a window on the default display.  It should be replaced with black on
        // the virtual display.
        assertDisplayCanShowPresentation("mirrored secure window on non-secure display", defaultDisplay, Color.BLACK, WindowManager.LayoutParams.TYPE_TOAST, WindowManager.LayoutParams.FLAG_SECURE);
        // Presentation case.
        // Show a normal presentation on the display.
        assertDisplayCanShowPresentation("presentation window", display, BLUEISH, WindowManager.LayoutParams.TYPE_TOAST, 0);
        // Presentation case with secure window (but display is not secure).
        // Show a normal presentation on the display.  It should be replaced with black.
        assertDisplayCanShowPresentation("secure presentation window on non-secure display", display, Color.BLACK, WindowManager.LayoutParams.TYPE_TOAST, WindowManager.LayoutParams.FLAG_SECURE);
    } finally {
        virtualDisplay.release();
    }
    assertDisplayUnregistered(display);
}
Also used : VirtualDisplay(android.hardware.display.VirtualDisplay) Display(android.view.Display) VirtualDisplay(android.hardware.display.VirtualDisplay)

Example 13 with VirtualDisplay

use of android.hardware.display.VirtualDisplay in project android_frameworks_base by DirtyUnicorns.

the class VirtualDisplayTest method testPrivateVirtualDisplay.

/**
     * Ensures that an application can create a private virtual display and show
     * its own windows on it.
     */
public void testPrivateVirtualDisplay() throws Exception {
    VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, 0);
    assertNotNull("virtual display must not be null", virtualDisplay);
    Display display = virtualDisplay.getDisplay();
    try {
        assertDisplayRegistered(display, Display.FLAG_PRIVATE);
        // Show a private presentation on the display.
        assertDisplayCanShowPresentation("private presentation window", display, BLUEISH, WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION, 0);
    } finally {
        virtualDisplay.release();
    }
    assertDisplayUnregistered(display);
}
Also used : VirtualDisplay(android.hardware.display.VirtualDisplay) Display(android.view.Display) VirtualDisplay(android.hardware.display.VirtualDisplay)

Example 14 with VirtualDisplay

use of android.hardware.display.VirtualDisplay in project android_frameworks_base by ResurrectionRemix.

the class VirtualDisplayTest method testPublicPresentationVirtualDisplay.

/**
     * Ensures that an application can create a public virtual display and show
     * its own windows on it.  This test requires the CAPTURE_VIDEO_OUTPUT permission.
     *
     * Because this test does not have an activity token, we use the TOAST window
     * type to create the window.  Another choice might be SYSTEM_ALERT_WINDOW but
     * that requires a permission.
     */
public void testPublicPresentationVirtualDisplay() throws Exception {
    VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC | DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION);
    assertNotNull("virtual display must not be null", virtualDisplay);
    Display display = virtualDisplay.getDisplay();
    try {
        assertDisplayRegistered(display, Display.FLAG_PRESENTATION);
        // Mirroring case.
        // Show a window on the default display.  It should be mirrored to the
        // virtual display automatically.
        Display defaultDisplay = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY);
        assertDisplayCanShowPresentation("mirrored window", defaultDisplay, GREENISH, WindowManager.LayoutParams.TYPE_TOAST, 0);
        // Mirroring case with secure window (but display is not secure).
        // Show a window on the default display.  It should be replaced with black on
        // the virtual display.
        assertDisplayCanShowPresentation("mirrored secure window on non-secure display", defaultDisplay, Color.BLACK, WindowManager.LayoutParams.TYPE_TOAST, WindowManager.LayoutParams.FLAG_SECURE);
        // Presentation case.
        // Show a normal presentation on the display.
        assertDisplayCanShowPresentation("presentation window", display, BLUEISH, WindowManager.LayoutParams.TYPE_TOAST, 0);
        // Presentation case with secure window (but display is not secure).
        // Show a normal presentation on the display.  It should be replaced with black.
        assertDisplayCanShowPresentation("secure presentation window on non-secure display", display, Color.BLACK, WindowManager.LayoutParams.TYPE_TOAST, WindowManager.LayoutParams.FLAG_SECURE);
    } finally {
        virtualDisplay.release();
    }
    assertDisplayUnregistered(display);
}
Also used : VirtualDisplay(android.hardware.display.VirtualDisplay) Display(android.view.Display) VirtualDisplay(android.hardware.display.VirtualDisplay)

Example 15 with VirtualDisplay

use of android.hardware.display.VirtualDisplay in project android_frameworks_base by ResurrectionRemix.

the class VirtualDisplayTest method testPrivatePresentationVirtualDisplay.

/**
     * Ensures that an application can create a private presentation virtual display and show
     * its own windows on it.
     */
public void testPrivatePresentationVirtualDisplay() throws Exception {
    VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, WIDTH, HEIGHT, DENSITY, mSurface, DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION);
    assertNotNull("virtual display must not be null", virtualDisplay);
    Display display = virtualDisplay.getDisplay();
    try {
        assertDisplayRegistered(display, Display.FLAG_PRIVATE | Display.FLAG_PRESENTATION);
        // Show a private presentation on the display.
        assertDisplayCanShowPresentation("private presentation window", display, BLUEISH, WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION, 0);
    } finally {
        virtualDisplay.release();
    }
    assertDisplayUnregistered(display);
}
Also used : VirtualDisplay(android.hardware.display.VirtualDisplay) Display(android.view.Display) VirtualDisplay(android.hardware.display.VirtualDisplay)

Aggregations

VirtualDisplay (android.hardware.display.VirtualDisplay)20 Display (android.view.Display)20