diff options
Diffstat (limited to 'android/view/SurfaceControl.java')
-rw-r--r-- | android/view/SurfaceControl.java | 538 |
1 files changed, 129 insertions, 409 deletions
diff --git a/android/view/SurfaceControl.java b/android/view/SurfaceControl.java index 54825895..31daefff 100644 --- a/android/view/SurfaceControl.java +++ b/android/view/SurfaceControl.java @@ -21,22 +21,15 @@ import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE; import android.annotation.Size; import android.graphics.Bitmap; import android.graphics.GraphicBuffer; -import android.graphics.Point; -import android.graphics.PointF; import android.graphics.Rect; import android.graphics.Region; import android.os.Binder; -import android.os.Debug; import android.os.IBinder; import android.util.Log; import android.view.Surface.OutOfResourcesException; import dalvik.system.CloseGuard; -import java.io.Closeable; - -import libcore.util.NativeAllocationRegistry; - /** * SurfaceControl * @hide @@ -61,34 +54,25 @@ public class SurfaceControl { Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean allLayers, boolean useIdentityTransform); - private static native long nativeCreateTransaction(); - private static native long nativeGetNativeTransactionFinalizer(); - private static native void nativeApplyTransaction(long transactionObj, boolean sync); - private static native void nativeSetAnimationTransaction(long transactionObj); - - private static native void nativeSetLayer(long transactionObj, long nativeObject, int zorder); - private static native void nativeSetRelativeLayer(long transactionObj, long nativeObject, - IBinder relativeTo, int zorder); - private static native void nativeSetPosition(long transactionObj, long nativeObject, - float x, float y); - private static native void nativeSetGeometryAppliesWithResize(long transactionObj, - long nativeObject); - private static native void nativeSetSize(long transactionObj, long nativeObject, int w, int h); - private static native void nativeSetTransparentRegionHint(long transactionObj, - long nativeObject, Region region); - private static native void nativeSetAlpha(long transactionObj, long nativeObject, float alpha); - private static native void nativeSetMatrix(long transactionObj, long nativeObject, - float dsdx, float dtdx, + private static native void nativeOpenTransaction(); + private static native void nativeCloseTransaction(boolean sync); + private static native void nativeSetAnimationTransaction(); + + private static native void nativeSetLayer(long nativeObject, int zorder); + private static native void nativeSetRelativeLayer(long nativeObject, IBinder relativeTo, + int zorder); + private static native void nativeSetPosition(long nativeObject, float x, float y); + private static native void nativeSetGeometryAppliesWithResize(long nativeObject); + private static native void nativeSetSize(long nativeObject, int w, int h); + private static native void nativeSetTransparentRegionHint(long nativeObject, Region region); + private static native void nativeSetAlpha(long nativeObject, float alpha); + private static native void nativeSetColor(long nativeObject, float[] color); + private static native void nativeSetMatrix(long nativeObject, float dsdx, float dtdx, float dtdy, float dsdy); - private static native void nativeSetColor(long transactionObj, long nativeObject, float[] color); - private static native void nativeSetFlags(long transactionObj, long nativeObject, - int flags, int mask); - private static native void nativeSetWindowCrop(long transactionObj, long nativeObject, - int l, int t, int r, int b); - private static native void nativeSetFinalCrop(long transactionObj, long nativeObject, - int l, int t, int r, int b); - private static native void nativeSetLayerStack(long transactionObj, long nativeObject, - int layerStack); + private static native void nativeSetFlags(long nativeObject, int flags, int mask); + private static native void nativeSetWindowCrop(long nativeObject, int l, int t, int r, int b); + private static native void nativeSetFinalCrop(long nativeObject, int l, int t, int r, int b); + private static native void nativeSetLayerStack(long nativeObject, int layerStack); private static native boolean nativeClearContentFrameStats(long nativeObject); private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats); @@ -98,16 +82,15 @@ public class SurfaceControl { private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId); private static native IBinder nativeCreateDisplay(String name, boolean secure); private static native void nativeDestroyDisplay(IBinder displayToken); - private static native void nativeSetDisplaySurface(long transactionObj, + private static native void nativeSetDisplaySurface( IBinder displayToken, long nativeSurfaceObject); - private static native void nativeSetDisplayLayerStack(long transactionObj, + private static native void nativeSetDisplayLayerStack( IBinder displayToken, int layerStack); - private static native void nativeSetDisplayProjection(long transactionObj, + private static native void nativeSetDisplayProjection( 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(long transactionObj, IBinder displayToken, - int width, int height); + private static native void nativeSetDisplaySize(IBinder displayToken, int width, int height); private static native SurfaceControl.PhysicalDisplayInfo[] nativeGetDisplayConfigs( IBinder displayToken); private static native int nativeGetActiveConfig(IBinder displayToken); @@ -118,17 +101,16 @@ public class SurfaceControl { int colorMode); private static native void nativeSetDisplayPowerMode( IBinder displayToken, int mode); - private static native void nativeDeferTransactionUntil(long transactionObj, long nativeObject, + private static native void nativeDeferTransactionUntil(long nativeObject, IBinder handle, long frame); - private static native void nativeDeferTransactionUntilSurface(long transactionObj, - long nativeObject, + private static native void nativeDeferTransactionUntilSurface(long nativeObject, long surfaceObject, long frame); - private static native void nativeReparentChildren(long transactionObj, long nativeObject, + private static native void nativeReparentChildren(long nativeObject, IBinder handle); - private static native void nativeReparent(long transactionObj, long nativeObject, + private static native void nativeReparent(long nativeObject, IBinder parentHandle); - private static native void nativeSeverChildren(long transactionObj, long nativeObject); - private static native void nativeSetOverrideScalingMode(long transactionObj, long nativeObject, + private static native void nativeSeverChildren(long nativeObject); + private static native void nativeSetOverrideScalingMode(long nativeObject, int scalingMode); private static native IBinder nativeGetHandle(long nativeObject); private static native boolean nativeGetTransformToDisplayInverse(long nativeObject); @@ -140,9 +122,6 @@ public class SurfaceControl { private final String mName; long mNativeObject; // package visibility only for Surface.java access - static Transaction sGlobalTransaction; - static long sTransactionNestCount = 0; - /* flags used in constructor (keep in sync with ISurfaceComposerClient.h) */ /** @@ -398,6 +377,11 @@ public class SurfaceControl { } } + @Override + public String toString() { + return "Surface(name=" + mName + ")"; + } + /** * Release the local reference to the server-side surface. * Always call release() when you're done with a Surface. @@ -445,141 +429,102 @@ public class SurfaceControl { /** start a transaction */ public static void openTransaction() { - synchronized (SurfaceControl.class) { - if (sGlobalTransaction == null) { - sGlobalTransaction = new Transaction(); - } - synchronized(SurfaceControl.class) { - sTransactionNestCount++; - } - } - } - - private static void closeTransaction(boolean sync) { - synchronized(SurfaceControl.class) { - if (sTransactionNestCount == 0) { - Log.e(TAG, "Call to SurfaceControl.closeTransaction without matching openTransaction"); - } else if (--sTransactionNestCount > 0) { - return; - } - sGlobalTransaction.apply(sync); - } + nativeOpenTransaction(); } /** end a transaction */ public static void closeTransaction() { - closeTransaction(false); + nativeCloseTransaction(false); } public static void closeTransactionSync() { - closeTransaction(true); + nativeCloseTransaction(true); } public void deferTransactionUntil(IBinder handle, long frame) { if (frame > 0) { - synchronized(SurfaceControl.class) { - sGlobalTransaction.deferTransactionUntil(this, handle, frame); - } + nativeDeferTransactionUntil(mNativeObject, handle, frame); } } public void deferTransactionUntil(Surface barrier, long frame) { if (frame > 0) { - synchronized(SurfaceControl.class) { - sGlobalTransaction.deferTransactionUntilSurface(this, barrier, frame); - } + nativeDeferTransactionUntilSurface(mNativeObject, barrier.mNativeObject, frame); } } public void reparentChildren(IBinder newParentHandle) { - synchronized(SurfaceControl.class) { - sGlobalTransaction.reparentChildren(this, newParentHandle); - } + nativeReparentChildren(mNativeObject, newParentHandle); } + /** Re-parents this layer to a new parent. */ public void reparent(IBinder newParentHandle) { - synchronized(SurfaceControl.class) { - sGlobalTransaction.reparent(this, newParentHandle); - } + nativeReparent(mNativeObject, newParentHandle); } public void detachChildren() { - synchronized(SurfaceControl.class) { - sGlobalTransaction.detachChildren(this); - } + nativeSeverChildren(mNativeObject); } public void setOverrideScalingMode(int scalingMode) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setOverrideScalingMode(this, scalingMode); - } + nativeSetOverrideScalingMode(mNativeObject, scalingMode); } public IBinder getHandle() { return nativeGetHandle(mNativeObject); } + /** flag the transaction as an animation */ public static void setAnimationTransaction() { - synchronized (SurfaceControl.class) { - sGlobalTransaction.setAnimationTransaction(); - } + nativeSetAnimationTransaction(); } public void setLayer(int zorder) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setLayer(this, zorder); - } + nativeSetLayer(mNativeObject, zorder); } public void setRelativeLayer(IBinder relativeTo, int zorder) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setRelativeLayer(this, relativeTo, zorder); - } + nativeSetRelativeLayer(mNativeObject, relativeTo, zorder); } public void setPosition(float x, float y) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setPosition(this, x, y); - } + nativeSetPosition(mNativeObject, x, y); } + /** + * If the buffer size changes in this transaction, position and crop updates specified + * in this transaction will not complete until a buffer of the new size + * arrives. As transform matrix and size are already frozen in this fashion, + * this enables totally freezing the surface until the resize has completed + * (at which point the geometry influencing aspects of this transaction will then occur) + */ public void setGeometryAppliesWithResize() { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setGeometryAppliesWithResize(this); - } + nativeSetGeometryAppliesWithResize(mNativeObject); } public void setSize(int w, int h) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setSize(this, w, h); - } + nativeSetSize(mNativeObject, w, h); } public void hide() { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.hide(this); - } + nativeSetFlags(mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN); } public void show() { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.show(this); - } + nativeSetFlags(mNativeObject, 0, SURFACE_HIDDEN); } public void setTransparentRegionHint(Region region) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setTransparentRegionHint(this, region); - } + nativeSetTransparentRegionHint(mNativeObject, region); } public boolean clearContentFrameStats() { @@ -600,70 +545,80 @@ public class SurfaceControl { return nativeGetAnimationFrameStats(outStats); } + /** + * Sets an alpha value for the entire Surface. This value is combined with the + * per-pixel alpha. It may be used with opaque Surfaces. + */ public void setAlpha(float alpha) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setAlpha(this, alpha); - } + nativeSetAlpha(mNativeObject, alpha); } + /** + * Sets a color for the Surface. + * @param color A float array with three values to represent r, g, b in range [0..1] + */ public void setColor(@Size(3) float[] color) { checkNotReleased(); - synchronized (SurfaceControl.class) { - sGlobalTransaction.setColor(this, color); - } + nativeSetColor(mNativeObject, color); } public void setMatrix(float dsdx, float dtdx, float dtdy, float dsdy) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setMatrix(this, dsdx, dtdx, dtdy, dsdy); - } + nativeSetMatrix(mNativeObject, dsdx, dtdx, dtdy, dsdy); } public void setWindowCrop(Rect crop) { checkNotReleased(); - synchronized (SurfaceControl.class) { - sGlobalTransaction.setWindowCrop(this, crop); + if (crop != null) { + nativeSetWindowCrop(mNativeObject, + crop.left, crop.top, crop.right, crop.bottom); + } else { + nativeSetWindowCrop(mNativeObject, 0, 0, 0, 0); } } public void setFinalCrop(Rect crop) { checkNotReleased(); - synchronized (SurfaceControl.class) { - sGlobalTransaction.setFinalCrop(this, crop); + if (crop != null) { + nativeSetFinalCrop(mNativeObject, + crop.left, crop.top, crop.right, crop.bottom); + } else { + nativeSetFinalCrop(mNativeObject, 0, 0, 0, 0); } } public void setLayerStack(int layerStack) { checkNotReleased(); - synchronized(SurfaceControl.class) { - sGlobalTransaction.setLayerStack(this, layerStack); - } + nativeSetLayerStack(mNativeObject, layerStack); } + /** + * Sets the opacity of the surface. Setting the flag is equivalent to creating the + * Surface with the {@link #OPAQUE} flag. + */ public void setOpaque(boolean isOpaque) { checkNotReleased(); - - synchronized (SurfaceControl.class) { - sGlobalTransaction.setOpaque(this, isOpaque); + if (isOpaque) { + nativeSetFlags(mNativeObject, SURFACE_OPAQUE, SURFACE_OPAQUE); + } else { + nativeSetFlags(mNativeObject, 0, SURFACE_OPAQUE); } } + /** + * Sets the security of the surface. Setting the flag is equivalent to creating the + * Surface with the {@link #SECURE} flag. + */ public void setSecure(boolean isSecure) { checkNotReleased(); - - synchronized (SurfaceControl.class) { - sGlobalTransaction.setSecure(this, isSecure); + if (isSecure) { + nativeSetFlags(mNativeObject, SECURE, SECURE); + } else { + nativeSetFlags(mNativeObject, 0, SECURE); } } - @Override - public String toString() { - return "Surface(name=" + mName + ")/@0x" + - Integer.toHexString(System.identityHashCode(this)); - } - /* * set display parameters. * needs to be inside open/closeTransaction block @@ -786,28 +741,50 @@ public class SurfaceControl { public static void setDisplayProjection(IBinder displayToken, int orientation, Rect layerStackRect, Rect displayRect) { - synchronized (SurfaceControl.class) { - sGlobalTransaction.setDisplayProjection(displayToken, orientation, - layerStackRect, 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 setDisplayLayerStack(IBinder displayToken, int layerStack) { - synchronized (SurfaceControl.class) { - sGlobalTransaction.setDisplayLayerStack(displayToken, layerStack); + if (displayToken == null) { + throw new IllegalArgumentException("displayToken must not be null"); } + nativeSetDisplayLayerStack(displayToken, layerStack); } public static void setDisplaySurface(IBinder displayToken, Surface surface) { - synchronized (SurfaceControl.class) { - sGlobalTransaction.setDisplaySurface(displayToken, 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 static void setDisplaySize(IBinder displayToken, int width, int height) { - synchronized (SurfaceControl.class) { - sGlobalTransaction.setDisplaySize(displayToken, width, 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 Display.HdrCapabilities getHdrCapabilities(IBinder displayToken) { @@ -969,261 +946,4 @@ public class SurfaceControl { nativeScreenshot(display, consumer, sourceCrop, width, height, minLayer, maxLayer, allLayers, useIdentityTransform); } - - public static class Transaction implements Closeable { - public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry( - Transaction.class.getClassLoader(), - nativeGetNativeTransactionFinalizer(), 512); - private long mNativeObject; - - Runnable mFreeNativeResources; - - public Transaction() { - mNativeObject = nativeCreateTransaction(); - mFreeNativeResources - = sRegistry.registerNativeAllocation(this, mNativeObject); - } - - /** - * Apply the transaction, clearing it's state, and making it usable - * as a new transaction. - */ - public void apply() { - apply(false); - } - - /** - * Close the transaction, if the transaction was not already applied this will cancel the - * transaction. - */ - @Override - public void close() { - mFreeNativeResources.run(); - mNativeObject = 0; - } - - /** - * Jankier version of apply. Avoid use (b/28068298). - */ - public void apply(boolean sync) { - nativeApplyTransaction(mNativeObject, sync); - } - - public Transaction show(SurfaceControl sc) { - nativeSetFlags(mNativeObject, sc.mNativeObject, 0, SURFACE_HIDDEN); - return this; - } - - public Transaction hide(SurfaceControl sc) { - nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN); - return this; - } - - public Transaction setPosition(SurfaceControl sc, float x, float y) { - nativeSetPosition(mNativeObject, sc.mNativeObject, x, y); - return this; - } - - public Transaction setSize(SurfaceControl sc, int w, int h) { - nativeSetSize(mNativeObject, sc.mNativeObject, - w, h); - return this; - } - - public Transaction setLayer(SurfaceControl sc, int z) { - nativeSetLayer(mNativeObject, sc.mNativeObject, z); - return this; - } - - public Transaction setRelativeLayer(SurfaceControl sc, IBinder relativeTo, int z) { - nativeSetRelativeLayer(mNativeObject, sc.mNativeObject, - relativeTo, z); - return this; - } - - public Transaction setTransparentRegionHint(SurfaceControl sc, Region transparentRegion) { - nativeSetTransparentRegionHint(mNativeObject, - sc.mNativeObject, transparentRegion); - return this; - } - - public Transaction setAlpha(SurfaceControl sc, float alpha) { - nativeSetAlpha(mNativeObject, sc.mNativeObject, alpha); - return this; - } - - public Transaction setMatrix(SurfaceControl sc, - float dsdx, float dtdx, float dtdy, float dsdy) { - nativeSetMatrix(mNativeObject, sc.mNativeObject, - dsdx, dtdx, dtdy, dsdy); - return this; - } - - public Transaction setWindowCrop(SurfaceControl sc, Rect crop) { - if (crop != null) { - nativeSetWindowCrop(mNativeObject, sc.mNativeObject, - crop.left, crop.top, crop.right, crop.bottom); - } else { - nativeSetWindowCrop(mNativeObject, sc.mNativeObject, 0, 0, 0, 0); - } - - return this; - } - - public Transaction setFinalCrop(SurfaceControl sc, Rect crop) { - if (crop != null) { - nativeSetFinalCrop(mNativeObject, sc.mNativeObject, - crop.left, crop.top, crop.right, crop.bottom); - } else { - nativeSetFinalCrop(mNativeObject, sc.mNativeObject, 0, 0, 0, 0); - } - - return this; - } - - public Transaction setLayerStack(SurfaceControl sc, int layerStack) { - nativeSetLayerStack(mNativeObject, sc.mNativeObject, layerStack); - return this; - } - - public Transaction deferTransactionUntil(SurfaceControl sc, IBinder handle, long frameNumber) { - nativeDeferTransactionUntil(mNativeObject, sc.mNativeObject, handle, frameNumber); - return this; - } - - public Transaction deferTransactionUntilSurface(SurfaceControl sc, Surface barrierSurface, - long frameNumber) { - nativeDeferTransactionUntilSurface(mNativeObject, sc.mNativeObject, - barrierSurface.mNativeObject, frameNumber); - return this; - } - - public Transaction reparentChildren(SurfaceControl sc, IBinder newParentHandle) { - nativeReparentChildren(mNativeObject, sc.mNativeObject, newParentHandle); - return this; - } - - /** Re-parents a specific child layer to a new parent */ - public Transaction reparent(SurfaceControl sc, IBinder newParentHandle) { - nativeReparent(mNativeObject, sc.mNativeObject, - newParentHandle); - return this; - } - - public Transaction detachChildren(SurfaceControl sc) { - nativeSeverChildren(mNativeObject, sc.mNativeObject); - return this; - } - - public Transaction setOverrideScalingMode(SurfaceControl sc, int overrideScalingMode) { - nativeSetOverrideScalingMode(mNativeObject, sc.mNativeObject, - overrideScalingMode); - return this; - } - - /** - * Sets a color for the Surface. - * @param color A float array with three values to represent r, g, b in range [0..1] - */ - public Transaction setColor(SurfaceControl sc, @Size(3) float[] color) { - nativeSetColor(mNativeObject, sc.mNativeObject, color); - return this; - } - - /** - * If the buffer size changes in this transaction, position and crop updates specified - * in this transaction will not complete until a buffer of the new size - * arrives. As transform matrix and size are already frozen in this fashion, - * this enables totally freezing the surface until the resize has completed - * (at which point the geometry influencing aspects of this transaction will then occur) - */ - public Transaction setGeometryAppliesWithResize(SurfaceControl sc) { - nativeSetGeometryAppliesWithResize(mNativeObject, sc.mNativeObject); - return this; - } - - /** - * Sets the security of the surface. Setting the flag is equivalent to creating the - * Surface with the {@link #SECURE} flag. - */ - Transaction setSecure(SurfaceControl sc, boolean isSecure) { - if (isSecure) { - nativeSetFlags(mNativeObject, sc.mNativeObject, SECURE, SECURE); - } else { - nativeSetFlags(mNativeObject, sc.mNativeObject, 0, SECURE); - } - return this; - } - - /** - * Sets the opacity of the surface. Setting the flag is equivalent to creating the - * Surface with the {@link #OPAQUE} flag. - */ - public Transaction setOpaque(SurfaceControl sc, boolean isOpaque) { - if (isOpaque) { - nativeSetFlags(mNativeObject, sc.mNativeObject, OPAQUE, OPAQUE); - } else { - nativeSetFlags(mNativeObject, sc.mNativeObject, 0, OPAQUE); - } - return this; - } - - public Transaction setDisplaySurface(IBinder displayToken, Surface surface) { - if (displayToken == null) { - throw new IllegalArgumentException("displayToken must not be null"); - } - - if (surface != null) { - synchronized (surface.mLock) { - nativeSetDisplaySurface(mNativeObject, displayToken, surface.mNativeObject); - } - } else { - nativeSetDisplaySurface(mNativeObject, displayToken, 0); - } - return this; - } - - public Transaction setDisplayLayerStack(IBinder displayToken, int layerStack) { - if (displayToken == null) { - throw new IllegalArgumentException("displayToken must not be null"); - } - nativeSetDisplayLayerStack(mNativeObject, displayToken, layerStack); - return this; - } - - public Transaction setDisplayProjection(IBinder displayToken, - int orientation, Rect layerStackRect, 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(mNativeObject, displayToken, orientation, - layerStackRect.left, layerStackRect.top, layerStackRect.right, layerStackRect.bottom, - displayRect.left, displayRect.top, displayRect.right, displayRect.bottom); - return this; - } - - public Transaction setDisplaySize(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(mNativeObject, displayToken, width, height); - return this; - } - - /** flag the transaction as an animation */ - public Transaction setAnimationTransaction() { - nativeSetAnimationTransaction(mNativeObject); - return this; - } - } } |