Methods Summary |
---|
private void | checkNotReleased()
if (mNativeObject == 0) throw new NullPointerException(
"mNativeObject is null. Have you called release() already?");
|
public static boolean | clearAnimationFrameStats()
return nativeClearAnimationFrameStats();
|
public boolean | clearContentFrameStats()
checkNotReleased();
return nativeClearContentFrameStats(mNativeObject);
|
public static void | closeTransaction()end a transaction
nativeCloseTransaction();
|
public static android.os.IBinder | createDisplay(java.lang.String name, boolean secure)
if (name == null) {
throw new IllegalArgumentException("name must not be null");
}
return nativeCreateDisplay(name, secure);
|
public void | destroy()Free all server-side state associated with this surface and
release this object's reference. This method can only be
called from the process that created the service.
if (mNativeObject != 0) {
nativeDestroy(mNativeObject);
mNativeObject = 0;
}
mCloseGuard.close();
|
public static void | destroyDisplay(android.os.IBinder displayToken)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
nativeDestroyDisplay(displayToken);
|
protected void | finalize()
try {
if (mCloseGuard != null) {
mCloseGuard.warnIfOpen();
}
if (mNativeObject != 0) {
nativeRelease(mNativeObject);
}
} finally {
super.finalize();
}
|
public static int | getActiveConfig(android.os.IBinder displayToken)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
return nativeGetActiveConfig(displayToken);
|
public static boolean | getAnimationFrameStats(WindowAnimationFrameStats outStats)
return nativeGetAnimationFrameStats(outStats);
|
public static android.os.IBinder | getBuiltInDisplay(int builtInDisplayId)
return nativeGetBuiltInDisplay(builtInDisplayId);
|
public boolean | getContentFrameStats(WindowContentFrameStats outStats)
checkNotReleased();
return nativeGetContentFrameStats(mNativeObject, outStats);
|
public static android.view.SurfaceControl$PhysicalDisplayInfo[] | getDisplayConfigs(android.os.IBinder displayToken)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
return nativeGetDisplayConfigs(displayToken);
|
public void | hide()
checkNotReleased();
nativeSetFlags(mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN);
|
private static native boolean | nativeClearAnimationFrameStats()
|
private static native boolean | nativeClearContentFrameStats(long nativeObject)
|
private static native void | nativeCloseTransaction()
|
private static native long | nativeCreate(SurfaceSession session, java.lang.String name, int w, int h, int format, int flags)
|
private static native android.os.IBinder | nativeCreateDisplay(java.lang.String name, boolean secure)
|
private static native void | nativeDestroy(long nativeObject)
|
private static native void | nativeDestroyDisplay(android.os.IBinder displayToken)
|
private static native int | nativeGetActiveConfig(android.os.IBinder displayToken)
|
private static native boolean | nativeGetAnimationFrameStats(WindowAnimationFrameStats outStats)
|
private static native android.os.IBinder | nativeGetBuiltInDisplay(int physicalDisplayId)
|
private static native boolean | nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats)
|
private static native android.view.SurfaceControl$PhysicalDisplayInfo[] | nativeGetDisplayConfigs(android.os.IBinder displayToken)
|
private static native void | nativeOpenTransaction()
|
private static native void | nativeRelease(long nativeObject)
|
private static native android.graphics.Bitmap | nativeScreenshot(android.os.IBinder displayToken, android.graphics.Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean allLayers, boolean useIdentityTransform, int rotation)
|
private static native void | nativeScreenshot(android.os.IBinder displayToken, Surface consumer, android.graphics.Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean allLayers, boolean useIdentityTransform)
|
private static native boolean | nativeSetActiveConfig(android.os.IBinder displayToken, int id)
|
private static native void | nativeSetAlpha(long nativeObject, float alpha)
|
private static native void | nativeSetAnimationTransaction()
|
private static native void | nativeSetDisplayLayerStack(android.os.IBinder displayToken, int layerStack)
|
private static native void | nativeSetDisplayPowerMode(android.os.IBinder displayToken, int mode)
|
private static native void | nativeSetDisplayProjection(android.os.IBinder displayToken, int orientation, int l, int t, int r, int b, int L, int T, int R, int B)
|
private static native void | nativeSetDisplaySize(android.os.IBinder displayToken, int width, int height)
|
private static native void | nativeSetDisplaySurface(android.os.IBinder displayToken, long nativeSurfaceObject)
|
private static native void | nativeSetFlags(long nativeObject, int flags, int mask)
|
private static native void | nativeSetLayer(long nativeObject, int zorder)
|
private static native void | nativeSetLayerStack(long nativeObject, int layerStack)
|
private static native void | nativeSetMatrix(long nativeObject, float dsdx, float dtdx, float dsdy, float dtdy)
|
private static native void | nativeSetPosition(long nativeObject, float x, float y)
|
private static native void | nativeSetSize(long nativeObject, int w, int h)
|
private static native void | nativeSetTransparentRegionHint(long nativeObject, android.graphics.Region region)
|
private static native void | nativeSetWindowCrop(long nativeObject, int l, int t, int r, int b)
|
public static void | openTransaction()start a transaction
nativeOpenTransaction();
|
public void | release()Release the local reference to the server-side surface.
Always call release() when you're done with a Surface.
This will make the surface invalid.
if (mNativeObject != 0) {
nativeRelease(mNativeObject);
mNativeObject = 0;
}
mCloseGuard.close();
|
public static void | screenshot(android.os.IBinder display, Surface consumer, int width, int height, int minLayer, int maxLayer, boolean useIdentityTransform)Copy the current screen contents into the provided {@link Surface}
screenshot(display, consumer, new Rect(), width, height, minLayer, maxLayer,
false, useIdentityTransform);
|
public static void | screenshot(android.os.IBinder display, Surface consumer, int width, int height)Copy the current screen contents into the provided {@link Surface}
screenshot(display, consumer, new Rect(), width, height, 0, 0, true, false);
|
public static void | screenshot(android.os.IBinder display, Surface consumer)Copy the current screen contents into the provided {@link Surface}
screenshot(display, consumer, new Rect(), 0, 0, 0, 0, true, false);
|
public static android.graphics.Bitmap | screenshot(android.graphics.Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean useIdentityTransform, int rotation)Copy the current screen contents into a bitmap and return it.
CAVEAT: Versions of screenshot that return a {@link Bitmap} can
be extremely slow; avoid use unless absolutely necessary; prefer
the versions that use a {@link Surface} instead, such as
{@link SurfaceControl#screenshot(IBinder, Surface)}.
// TODO: should take the display as a parameter
IBinder displayToken = SurfaceControl.getBuiltInDisplay(
SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN);
return nativeScreenshot(displayToken, sourceCrop, width, height,
minLayer, maxLayer, false, useIdentityTransform, rotation);
|
public static android.graphics.Bitmap | screenshot(int width, int height)Like {@link SurfaceControl#screenshot(int, int, int, int, boolean)} but
includes all Surfaces in the screenshot.
// TODO: should take the display as a parameter
IBinder displayToken = SurfaceControl.getBuiltInDisplay(
SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN);
return nativeScreenshot(displayToken, new Rect(), width, height, 0, 0, true,
false, Surface.ROTATION_0);
|
private static void | screenshot(android.os.IBinder display, Surface consumer, android.graphics.Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean allLayers, boolean useIdentityTransform)
if (display == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
if (consumer == null) {
throw new IllegalArgumentException("consumer must not be null");
}
nativeScreenshot(display, consumer, sourceCrop, width, height,
minLayer, maxLayer, allLayers, useIdentityTransform);
|
public static boolean | setActiveConfig(android.os.IBinder displayToken, int id)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
return nativeSetActiveConfig(displayToken, id);
|
public void | setAlpha(float alpha)Sets an alpha value for the entire Surface. This value is combined with the
per-pixel alpha. It may be used with opaque Surfaces.
checkNotReleased();
nativeSetAlpha(mNativeObject, alpha);
|
public static void | setAnimationTransaction()flag the transaction as an animation
nativeSetAnimationTransaction();
|
public static void | setDisplayLayerStack(android.os.IBinder displayToken, int layerStack)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
nativeSetDisplayLayerStack(displayToken, layerStack);
|
public static void | setDisplayPowerMode(android.os.IBinder displayToken, int mode)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
nativeSetDisplayPowerMode(displayToken, mode);
|
public static void | setDisplayProjection(android.os.IBinder displayToken, int orientation, android.graphics.Rect layerStackRect, android.graphics.Rect displayRect)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
if (layerStackRect == null) {
throw new IllegalArgumentException("layerStackRect must not be null");
}
if (displayRect == null) {
throw new IllegalArgumentException("displayRect must not be null");
}
nativeSetDisplayProjection(displayToken, orientation,
layerStackRect.left, layerStackRect.top, layerStackRect.right, layerStackRect.bottom,
displayRect.left, displayRect.top, displayRect.right, displayRect.bottom);
|
public static void | setDisplaySize(android.os.IBinder displayToken, int width, int height)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
if (width <= 0 || height <= 0) {
throw new IllegalArgumentException("width and height must be positive");
}
nativeSetDisplaySize(displayToken, width, height);
|
public static void | setDisplaySurface(android.os.IBinder displayToken, Surface surface)
if (displayToken == null) {
throw new IllegalArgumentException("displayToken must not be null");
}
if (surface != null) {
synchronized (surface.mLock) {
nativeSetDisplaySurface(displayToken, surface.mNativeObject);
}
} else {
nativeSetDisplaySurface(displayToken, 0);
}
|
public void | setLayer(int zorder)
checkNotReleased();
nativeSetLayer(mNativeObject, zorder);
|
public void | setLayerStack(int layerStack)
checkNotReleased();
nativeSetLayerStack(mNativeObject, layerStack);
|
public void | setMatrix(float dsdx, float dtdx, float dsdy, float dtdy)
checkNotReleased();
nativeSetMatrix(mNativeObject, dsdx, dtdx, dsdy, dtdy);
|
public void | setOpaque(boolean isOpaque)Sets the opacity of the surface. Setting the flag is equivalent to creating the
Surface with the {@link #OPAQUE} flag.
checkNotReleased();
if (isOpaque) {
nativeSetFlags(mNativeObject, SURFACE_OPAQUE, SURFACE_OPAQUE);
} else {
nativeSetFlags(mNativeObject, 0, SURFACE_OPAQUE);
}
|
public void | setPosition(float x, float y)
checkNotReleased();
nativeSetPosition(mNativeObject, x, y);
|
public void | setSize(int w, int h)
checkNotReleased();
nativeSetSize(mNativeObject, w, h);
|
public void | setTransparentRegionHint(android.graphics.Region region)
checkNotReleased();
nativeSetTransparentRegionHint(mNativeObject, region);
|
public void | setWindowCrop(android.graphics.Rect crop)
checkNotReleased();
if (crop != null) {
nativeSetWindowCrop(mNativeObject,
crop.left, crop.top, crop.right, crop.bottom);
} else {
nativeSetWindowCrop(mNativeObject, 0, 0, 0, 0);
}
|
public void | show()
checkNotReleased();
nativeSetFlags(mNativeObject, 0, SURFACE_HIDDEN);
|
public java.lang.String | toString()
return "Surface(name=" + mName + ")";
|