FileDocCategorySizeDatePackage
VirtualDisplay.javaAPI DocAndroid 5.1 API4605Thu Mar 12 22:22:10 GMT 2015android.hardware.display

VirtualDisplay

public final class VirtualDisplay extends Object
Represents a virtual display. The content of a virtual display is rendered to a {@link android.view.Surface} that you must provide to {@link DisplayManager#createVirtualDisplay createVirtualDisplay()}.

Because a virtual display renders to a surface provided by the application, it will be released automatically when the process terminates and all remaining windows on it will be forcibly removed. However, you should also explicitly call {@link #release} when you're done with it.

see
DisplayManager#createVirtualDisplay

Fields Summary
private final DisplayManagerGlobal
mGlobal
private final android.view.Display
mDisplay
private IVirtualDisplayCallback
mToken
private android.view.Surface
mSurface
Constructors Summary
VirtualDisplay(DisplayManagerGlobal global, android.view.Display display, IVirtualDisplayCallback token, android.view.Surface surface)

        mGlobal = global;
        mDisplay = display;
        mToken = token;
        mSurface = surface;
    
Methods Summary
public android.view.DisplaygetDisplay()
Gets the virtual display.

        return mDisplay;
    
public android.view.SurfacegetSurface()
Gets the surface that backs the virtual display.

        return mSurface;
    
public voidrelease()
Releases the virtual display and destroys its underlying surface.

All remaining windows on the virtual display will be forcibly removed as part of releasing the virtual display.

        if (mToken != null) {
            mGlobal.releaseVirtualDisplay(mToken);
            mToken = null;
        }
    
public voidresize(int width, int height, int densityDpi)
Asks the virtual display to resize.

This is really just a convenience to allow applications using virtual displays to adapt to changing conditions without having to tear down and recreate the display.

        mGlobal.resizeVirtualDisplay(mToken, width, height, densityDpi);
    
public voidsetSurface(android.view.Surface surface)
Sets the surface that backs the virtual display.

Detaching the surface that backs a virtual display has a similar effect to turning off the screen.

It is still the caller's responsibility to destroy the surface after it has been detached.

param
surface The surface to set, or null to detach the surface from the virtual display.

        if (mSurface != surface) {
            mGlobal.setVirtualDisplaySurface(mToken, surface);
            mSurface = surface;
        }
    
public java.lang.StringtoString()

        return "VirtualDisplay{display=" + mDisplay + ", token=" + mToken
                + ", surface=" + mSurface + "}";