Loading core/java/android/view/SurfaceControl.java +59 −29 Original line number Original line Diff line number Diff line Loading @@ -2091,6 +2091,13 @@ public final class SurfaceControl implements Parcelable { private final ArrayMap<SurfaceControl, Point> mResizedSurfaces = new ArrayMap<>(); private final ArrayMap<SurfaceControl, Point> mResizedSurfaces = new ArrayMap<>(); Runnable mFreeNativeResources; Runnable mFreeNativeResources; /** * @hide */ protected void checkPreconditions(SurfaceControl sc) { sc.checkNotReleased(); } /** /** * Open a new transaction object. The transaction may be filed with commands to * Open a new transaction object. The transaction may be filed with commands to * manipulate {@link SurfaceControl} instances, and then applied atomically with * manipulate {@link SurfaceControl} instances, and then applied atomically with Loading Loading @@ -2155,7 +2162,7 @@ public final class SurfaceControl implements Parcelable { */ */ @NonNull @NonNull public Transaction setVisibility(@NonNull SurfaceControl sc, boolean visible) { public Transaction setVisibility(@NonNull SurfaceControl sc, boolean visible) { sc.checkNotReleased(); checkPreconditions(sc); if (visible) { if (visible) { return show(sc); return show(sc); } else { } else { Loading @@ -2172,7 +2179,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction show(SurfaceControl sc) { public Transaction show(SurfaceControl sc) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetFlags(mNativeObject, sc.mNativeObject, 0, SURFACE_HIDDEN); nativeSetFlags(mNativeObject, sc.mNativeObject, 0, SURFACE_HIDDEN); return this; return this; } } Loading @@ -2186,7 +2193,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction hide(SurfaceControl sc) { public Transaction hide(SurfaceControl sc) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN); nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN); return this; return this; } } Loading @@ -2196,7 +2203,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setPosition(SurfaceControl sc, float x, float y) { public Transaction setPosition(SurfaceControl sc, float x, float y) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetPosition(mNativeObject, sc.mNativeObject, x, y); nativeSetPosition(mNativeObject, sc.mNativeObject, x, y); return this; return this; } } Loading @@ -2213,7 +2220,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction setBufferSize(@NonNull SurfaceControl sc, public Transaction setBufferSize(@NonNull SurfaceControl sc, @IntRange(from = 0) int w, @IntRange(from = 0) int h) { @IntRange(from = 0) int w, @IntRange(from = 0) int h) { sc.checkNotReleased(); checkPreconditions(sc); mResizedSurfaces.put(sc, new Point(w, h)); mResizedSurfaces.put(sc, new Point(w, h)); nativeSetSize(mNativeObject, sc.mNativeObject, w, h); nativeSetSize(mNativeObject, sc.mNativeObject, w, h); return this; return this; Loading @@ -2231,7 +2238,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction setLayer(@NonNull SurfaceControl sc, public Transaction setLayer(@NonNull SurfaceControl sc, @IntRange(from = Integer.MIN_VALUE, to = Integer.MAX_VALUE) int z) { @IntRange(from = Integer.MIN_VALUE, to = Integer.MAX_VALUE) int z) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetLayer(mNativeObject, sc.mNativeObject, z); nativeSetLayer(mNativeObject, sc.mNativeObject, z); return this; return this; } } Loading @@ -2240,7 +2247,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setRelativeLayer(SurfaceControl sc, SurfaceControl relativeTo, int z) { public Transaction setRelativeLayer(SurfaceControl sc, SurfaceControl relativeTo, int z) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetRelativeLayer(mNativeObject, sc.mNativeObject, relativeTo.mNativeObject, z); nativeSetRelativeLayer(mNativeObject, sc.mNativeObject, relativeTo.mNativeObject, z); return this; return this; } } Loading @@ -2249,7 +2256,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setTransparentRegionHint(SurfaceControl sc, Region transparentRegion) { public Transaction setTransparentRegionHint(SurfaceControl sc, Region transparentRegion) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetTransparentRegionHint(mNativeObject, nativeSetTransparentRegionHint(mNativeObject, sc.mNativeObject, transparentRegion); sc.mNativeObject, transparentRegion); return this; return this; Loading @@ -2265,7 +2272,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction setAlpha(@NonNull SurfaceControl sc, public Transaction setAlpha(@NonNull SurfaceControl sc, @FloatRange(from = 0.0, to = 1.0) float alpha) { @FloatRange(from = 0.0, to = 1.0) float alpha) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetAlpha(mNativeObject, sc.mNativeObject, alpha); nativeSetAlpha(mNativeObject, sc.mNativeObject, alpha); return this; return this; } } Loading @@ -2274,7 +2281,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setInputWindowInfo(SurfaceControl sc, InputWindowHandle handle) { public Transaction setInputWindowInfo(SurfaceControl sc, InputWindowHandle handle) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetInputWindowInfo(mNativeObject, sc.mNativeObject, handle); nativeSetInputWindowInfo(mNativeObject, sc.mNativeObject, handle); return this; return this; } } Loading Loading @@ -2304,7 +2311,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction setGeometry(@NonNull SurfaceControl sc, @Nullable Rect sourceCrop, public Transaction setGeometry(@NonNull SurfaceControl sc, @Nullable Rect sourceCrop, @Nullable Rect destFrame, @Surface.Rotation int orientation) { @Nullable Rect destFrame, @Surface.Rotation int orientation) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetGeometry(mNativeObject, sc.mNativeObject, sourceCrop, destFrame, orientation); nativeSetGeometry(mNativeObject, sc.mNativeObject, sourceCrop, destFrame, orientation); return this; return this; } } Loading @@ -2315,7 +2322,7 @@ public final class SurfaceControl implements Parcelable { @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setMatrix(SurfaceControl sc, public Transaction setMatrix(SurfaceControl sc, float dsdx, float dtdx, float dtdy, float dsdy) { float dsdx, float dtdx, float dtdy, float dsdy) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetMatrix(mNativeObject, sc.mNativeObject, nativeSetMatrix(mNativeObject, sc.mNativeObject, dsdx, dtdx, dtdy, dsdy); dsdx, dtdx, dtdy, dsdy); return this; return this; Loading Loading @@ -2349,7 +2356,7 @@ public final class SurfaceControl implements Parcelable { */ */ public Transaction setColorTransform(SurfaceControl sc, @Size(9) float[] matrix, public Transaction setColorTransform(SurfaceControl sc, @Size(9) float[] matrix, @Size(3) float[] translation) { @Size(3) float[] translation) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetColorTransform(mNativeObject, sc.mNativeObject, matrix, translation); nativeSetColorTransform(mNativeObject, sc.mNativeObject, matrix, translation); return this; return this; } } Loading @@ -2361,7 +2368,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setColorSpaceAgnostic(SurfaceControl sc, boolean agnostic) { public Transaction setColorSpaceAgnostic(SurfaceControl sc, boolean agnostic) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetColorSpaceAgnostic(mNativeObject, sc.mNativeObject, agnostic); nativeSetColorSpaceAgnostic(mNativeObject, sc.mNativeObject, agnostic); return this; return this; } } Loading @@ -2378,7 +2385,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setWindowCrop(SurfaceControl sc, Rect crop) { public Transaction setWindowCrop(SurfaceControl sc, Rect crop) { sc.checkNotReleased(); checkPreconditions(sc); if (crop != null) { if (crop != null) { nativeSetWindowCrop(mNativeObject, sc.mNativeObject, nativeSetWindowCrop(mNativeObject, sc.mNativeObject, crop.left, crop.top, crop.right, crop.bottom); crop.left, crop.top, crop.right, crop.bottom); Loading @@ -2399,7 +2406,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setWindowCrop(SurfaceControl sc, int width, int height) { public Transaction setWindowCrop(SurfaceControl sc, int width, int height) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetWindowCrop(mNativeObject, sc.mNativeObject, 0, 0, width, height); nativeSetWindowCrop(mNativeObject, sc.mNativeObject, 0, 0, width, height); return this; return this; } } Loading @@ -2413,7 +2420,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setCornerRadius(SurfaceControl sc, float cornerRadius) { public Transaction setCornerRadius(SurfaceControl sc, float cornerRadius) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetCornerRadius(mNativeObject, sc.mNativeObject, cornerRadius); nativeSetCornerRadius(mNativeObject, sc.mNativeObject, cornerRadius); return this; return this; Loading @@ -2424,7 +2431,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.O) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.O) public Transaction setLayerStack(SurfaceControl sc, int layerStack) { public Transaction setLayerStack(SurfaceControl sc, int layerStack) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetLayerStack(mNativeObject, sc.mNativeObject, layerStack); nativeSetLayerStack(mNativeObject, sc.mNativeObject, layerStack); return this; return this; } } Loading @@ -2438,7 +2445,7 @@ public final class SurfaceControl implements Parcelable { if (frameNumber < 0) { if (frameNumber < 0) { return this; return this; } } sc.checkNotReleased(); checkPreconditions(sc); nativeDeferTransactionUntil(mNativeObject, sc.mNativeObject, barrier.mNativeObject, nativeDeferTransactionUntil(mNativeObject, sc.mNativeObject, barrier.mNativeObject, frameNumber); frameNumber); return this; return this; Loading @@ -2453,7 +2460,7 @@ public final class SurfaceControl implements Parcelable { if (frameNumber < 0) { if (frameNumber < 0) { return this; return this; } } sc.checkNotReleased(); checkPreconditions(sc); nativeDeferTransactionUntilSurface(mNativeObject, sc.mNativeObject, nativeDeferTransactionUntilSurface(mNativeObject, sc.mNativeObject, barrierSurface.mNativeObject, frameNumber); barrierSurface.mNativeObject, frameNumber); return this; return this; Loading @@ -2463,7 +2470,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction reparentChildren(SurfaceControl sc, SurfaceControl newParent) { public Transaction reparentChildren(SurfaceControl sc, SurfaceControl newParent) { sc.checkNotReleased(); checkPreconditions(sc); nativeReparentChildren(mNativeObject, sc.mNativeObject, newParent.mNativeObject); nativeReparentChildren(mNativeObject, sc.mNativeObject, newParent.mNativeObject); return this; return this; } } Loading @@ -2480,7 +2487,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction reparent(@NonNull SurfaceControl sc, public Transaction reparent(@NonNull SurfaceControl sc, @Nullable SurfaceControl newParent) { @Nullable SurfaceControl newParent) { sc.checkNotReleased(); checkPreconditions(sc); long otherObject = 0; long otherObject = 0; if (newParent != null) { if (newParent != null) { newParent.checkNotReleased(); newParent.checkNotReleased(); Loading @@ -2494,7 +2501,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction detachChildren(SurfaceControl sc) { public Transaction detachChildren(SurfaceControl sc) { sc.checkNotReleased(); checkPreconditions(sc); nativeSeverChildren(mNativeObject, sc.mNativeObject); nativeSeverChildren(mNativeObject, sc.mNativeObject); return this; return this; } } Loading @@ -2503,7 +2510,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setOverrideScalingMode(SurfaceControl sc, int overrideScalingMode) { public Transaction setOverrideScalingMode(SurfaceControl sc, int overrideScalingMode) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetOverrideScalingMode(mNativeObject, sc.mNativeObject, nativeSetOverrideScalingMode(mNativeObject, sc.mNativeObject, overrideScalingMode); overrideScalingMode); return this; return this; Loading @@ -2516,7 +2523,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setColor(SurfaceControl sc, @Size(3) float[] color) { public Transaction setColor(SurfaceControl sc, @Size(3) float[] color) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetColor(mNativeObject, sc.mNativeObject, color); nativeSetColor(mNativeObject, sc.mNativeObject, color); return this; return this; } } Loading @@ -2527,7 +2534,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setSecure(SurfaceControl sc, boolean isSecure) { public Transaction setSecure(SurfaceControl sc, boolean isSecure) { sc.checkNotReleased(); checkPreconditions(sc); if (isSecure) { if (isSecure) { nativeSetFlags(mNativeObject, sc.mNativeObject, SECURE, SECURE); nativeSetFlags(mNativeObject, sc.mNativeObject, SECURE, SECURE); } else { } else { Loading @@ -2542,7 +2549,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setOpaque(SurfaceControl sc, boolean isOpaque) { public Transaction setOpaque(SurfaceControl sc, boolean isOpaque) { sc.checkNotReleased(); checkPreconditions(sc); if (isOpaque) { if (isOpaque) { nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_OPAQUE, SURFACE_OPAQUE); nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_OPAQUE, SURFACE_OPAQUE); } else { } else { Loading Loading @@ -2657,7 +2664,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setMetadata(SurfaceControl sc, int key, Parcel data) { public Transaction setMetadata(SurfaceControl sc, int key, Parcel data) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetMetadata(mNativeObject, sc.mNativeObject, key, data); nativeSetMetadata(mNativeObject, sc.mNativeObject, key, data); return this; return this; } } Loading @@ -2680,7 +2687,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setShadowRadius(SurfaceControl sc, float shadowRadius) { public Transaction setShadowRadius(SurfaceControl sc, float shadowRadius) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetShadowRadius(mNativeObject, sc.mNativeObject, shadowRadius); nativeSetShadowRadius(mNativeObject, sc.mNativeObject, shadowRadius); return this; return this; } } Loading Loading @@ -2763,4 +2770,27 @@ public final class SurfaceControl implements Parcelable { } } }; }; } } /** * A debugging utility subclass of SurfaceControl.Transaction. At construction * you can pass in a monitor object, and all the other methods will throw an exception * if the monitor is not held when they are called. * @hide */ public static class LockDebuggingTransaction extends SurfaceControl.Transaction { Object mMonitor; public LockDebuggingTransaction(Object o) { mMonitor = o; } @Override protected void checkPreconditions(SurfaceControl sc) { super.checkPreconditions(sc); if (!Thread.holdsLock(mMonitor)) { throw new RuntimeException( "Unlocked access to synchronized SurfaceControl.Transaction"); } } } } } Loading
core/java/android/view/SurfaceControl.java +59 −29 Original line number Original line Diff line number Diff line Loading @@ -2091,6 +2091,13 @@ public final class SurfaceControl implements Parcelable { private final ArrayMap<SurfaceControl, Point> mResizedSurfaces = new ArrayMap<>(); private final ArrayMap<SurfaceControl, Point> mResizedSurfaces = new ArrayMap<>(); Runnable mFreeNativeResources; Runnable mFreeNativeResources; /** * @hide */ protected void checkPreconditions(SurfaceControl sc) { sc.checkNotReleased(); } /** /** * Open a new transaction object. The transaction may be filed with commands to * Open a new transaction object. The transaction may be filed with commands to * manipulate {@link SurfaceControl} instances, and then applied atomically with * manipulate {@link SurfaceControl} instances, and then applied atomically with Loading Loading @@ -2155,7 +2162,7 @@ public final class SurfaceControl implements Parcelable { */ */ @NonNull @NonNull public Transaction setVisibility(@NonNull SurfaceControl sc, boolean visible) { public Transaction setVisibility(@NonNull SurfaceControl sc, boolean visible) { sc.checkNotReleased(); checkPreconditions(sc); if (visible) { if (visible) { return show(sc); return show(sc); } else { } else { Loading @@ -2172,7 +2179,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction show(SurfaceControl sc) { public Transaction show(SurfaceControl sc) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetFlags(mNativeObject, sc.mNativeObject, 0, SURFACE_HIDDEN); nativeSetFlags(mNativeObject, sc.mNativeObject, 0, SURFACE_HIDDEN); return this; return this; } } Loading @@ -2186,7 +2193,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction hide(SurfaceControl sc) { public Transaction hide(SurfaceControl sc) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN); nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_HIDDEN, SURFACE_HIDDEN); return this; return this; } } Loading @@ -2196,7 +2203,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setPosition(SurfaceControl sc, float x, float y) { public Transaction setPosition(SurfaceControl sc, float x, float y) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetPosition(mNativeObject, sc.mNativeObject, x, y); nativeSetPosition(mNativeObject, sc.mNativeObject, x, y); return this; return this; } } Loading @@ -2213,7 +2220,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction setBufferSize(@NonNull SurfaceControl sc, public Transaction setBufferSize(@NonNull SurfaceControl sc, @IntRange(from = 0) int w, @IntRange(from = 0) int h) { @IntRange(from = 0) int w, @IntRange(from = 0) int h) { sc.checkNotReleased(); checkPreconditions(sc); mResizedSurfaces.put(sc, new Point(w, h)); mResizedSurfaces.put(sc, new Point(w, h)); nativeSetSize(mNativeObject, sc.mNativeObject, w, h); nativeSetSize(mNativeObject, sc.mNativeObject, w, h); return this; return this; Loading @@ -2231,7 +2238,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction setLayer(@NonNull SurfaceControl sc, public Transaction setLayer(@NonNull SurfaceControl sc, @IntRange(from = Integer.MIN_VALUE, to = Integer.MAX_VALUE) int z) { @IntRange(from = Integer.MIN_VALUE, to = Integer.MAX_VALUE) int z) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetLayer(mNativeObject, sc.mNativeObject, z); nativeSetLayer(mNativeObject, sc.mNativeObject, z); return this; return this; } } Loading @@ -2240,7 +2247,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setRelativeLayer(SurfaceControl sc, SurfaceControl relativeTo, int z) { public Transaction setRelativeLayer(SurfaceControl sc, SurfaceControl relativeTo, int z) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetRelativeLayer(mNativeObject, sc.mNativeObject, relativeTo.mNativeObject, z); nativeSetRelativeLayer(mNativeObject, sc.mNativeObject, relativeTo.mNativeObject, z); return this; return this; } } Loading @@ -2249,7 +2256,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setTransparentRegionHint(SurfaceControl sc, Region transparentRegion) { public Transaction setTransparentRegionHint(SurfaceControl sc, Region transparentRegion) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetTransparentRegionHint(mNativeObject, nativeSetTransparentRegionHint(mNativeObject, sc.mNativeObject, transparentRegion); sc.mNativeObject, transparentRegion); return this; return this; Loading @@ -2265,7 +2272,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction setAlpha(@NonNull SurfaceControl sc, public Transaction setAlpha(@NonNull SurfaceControl sc, @FloatRange(from = 0.0, to = 1.0) float alpha) { @FloatRange(from = 0.0, to = 1.0) float alpha) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetAlpha(mNativeObject, sc.mNativeObject, alpha); nativeSetAlpha(mNativeObject, sc.mNativeObject, alpha); return this; return this; } } Loading @@ -2274,7 +2281,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setInputWindowInfo(SurfaceControl sc, InputWindowHandle handle) { public Transaction setInputWindowInfo(SurfaceControl sc, InputWindowHandle handle) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetInputWindowInfo(mNativeObject, sc.mNativeObject, handle); nativeSetInputWindowInfo(mNativeObject, sc.mNativeObject, handle); return this; return this; } } Loading Loading @@ -2304,7 +2311,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction setGeometry(@NonNull SurfaceControl sc, @Nullable Rect sourceCrop, public Transaction setGeometry(@NonNull SurfaceControl sc, @Nullable Rect sourceCrop, @Nullable Rect destFrame, @Surface.Rotation int orientation) { @Nullable Rect destFrame, @Surface.Rotation int orientation) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetGeometry(mNativeObject, sc.mNativeObject, sourceCrop, destFrame, orientation); nativeSetGeometry(mNativeObject, sc.mNativeObject, sourceCrop, destFrame, orientation); return this; return this; } } Loading @@ -2315,7 +2322,7 @@ public final class SurfaceControl implements Parcelable { @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setMatrix(SurfaceControl sc, public Transaction setMatrix(SurfaceControl sc, float dsdx, float dtdx, float dtdy, float dsdy) { float dsdx, float dtdx, float dtdy, float dsdy) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetMatrix(mNativeObject, sc.mNativeObject, nativeSetMatrix(mNativeObject, sc.mNativeObject, dsdx, dtdx, dtdy, dsdy); dsdx, dtdx, dtdy, dsdy); return this; return this; Loading Loading @@ -2349,7 +2356,7 @@ public final class SurfaceControl implements Parcelable { */ */ public Transaction setColorTransform(SurfaceControl sc, @Size(9) float[] matrix, public Transaction setColorTransform(SurfaceControl sc, @Size(9) float[] matrix, @Size(3) float[] translation) { @Size(3) float[] translation) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetColorTransform(mNativeObject, sc.mNativeObject, matrix, translation); nativeSetColorTransform(mNativeObject, sc.mNativeObject, matrix, translation); return this; return this; } } Loading @@ -2361,7 +2368,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setColorSpaceAgnostic(SurfaceControl sc, boolean agnostic) { public Transaction setColorSpaceAgnostic(SurfaceControl sc, boolean agnostic) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetColorSpaceAgnostic(mNativeObject, sc.mNativeObject, agnostic); nativeSetColorSpaceAgnostic(mNativeObject, sc.mNativeObject, agnostic); return this; return this; } } Loading @@ -2378,7 +2385,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setWindowCrop(SurfaceControl sc, Rect crop) { public Transaction setWindowCrop(SurfaceControl sc, Rect crop) { sc.checkNotReleased(); checkPreconditions(sc); if (crop != null) { if (crop != null) { nativeSetWindowCrop(mNativeObject, sc.mNativeObject, nativeSetWindowCrop(mNativeObject, sc.mNativeObject, crop.left, crop.top, crop.right, crop.bottom); crop.left, crop.top, crop.right, crop.bottom); Loading @@ -2399,7 +2406,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setWindowCrop(SurfaceControl sc, int width, int height) { public Transaction setWindowCrop(SurfaceControl sc, int width, int height) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetWindowCrop(mNativeObject, sc.mNativeObject, 0, 0, width, height); nativeSetWindowCrop(mNativeObject, sc.mNativeObject, 0, 0, width, height); return this; return this; } } Loading @@ -2413,7 +2420,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setCornerRadius(SurfaceControl sc, float cornerRadius) { public Transaction setCornerRadius(SurfaceControl sc, float cornerRadius) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetCornerRadius(mNativeObject, sc.mNativeObject, cornerRadius); nativeSetCornerRadius(mNativeObject, sc.mNativeObject, cornerRadius); return this; return this; Loading @@ -2424,7 +2431,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.O) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.O) public Transaction setLayerStack(SurfaceControl sc, int layerStack) { public Transaction setLayerStack(SurfaceControl sc, int layerStack) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetLayerStack(mNativeObject, sc.mNativeObject, layerStack); nativeSetLayerStack(mNativeObject, sc.mNativeObject, layerStack); return this; return this; } } Loading @@ -2438,7 +2445,7 @@ public final class SurfaceControl implements Parcelable { if (frameNumber < 0) { if (frameNumber < 0) { return this; return this; } } sc.checkNotReleased(); checkPreconditions(sc); nativeDeferTransactionUntil(mNativeObject, sc.mNativeObject, barrier.mNativeObject, nativeDeferTransactionUntil(mNativeObject, sc.mNativeObject, barrier.mNativeObject, frameNumber); frameNumber); return this; return this; Loading @@ -2453,7 +2460,7 @@ public final class SurfaceControl implements Parcelable { if (frameNumber < 0) { if (frameNumber < 0) { return this; return this; } } sc.checkNotReleased(); checkPreconditions(sc); nativeDeferTransactionUntilSurface(mNativeObject, sc.mNativeObject, nativeDeferTransactionUntilSurface(mNativeObject, sc.mNativeObject, barrierSurface.mNativeObject, frameNumber); barrierSurface.mNativeObject, frameNumber); return this; return this; Loading @@ -2463,7 +2470,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction reparentChildren(SurfaceControl sc, SurfaceControl newParent) { public Transaction reparentChildren(SurfaceControl sc, SurfaceControl newParent) { sc.checkNotReleased(); checkPreconditions(sc); nativeReparentChildren(mNativeObject, sc.mNativeObject, newParent.mNativeObject); nativeReparentChildren(mNativeObject, sc.mNativeObject, newParent.mNativeObject); return this; return this; } } Loading @@ -2480,7 +2487,7 @@ public final class SurfaceControl implements Parcelable { @NonNull @NonNull public Transaction reparent(@NonNull SurfaceControl sc, public Transaction reparent(@NonNull SurfaceControl sc, @Nullable SurfaceControl newParent) { @Nullable SurfaceControl newParent) { sc.checkNotReleased(); checkPreconditions(sc); long otherObject = 0; long otherObject = 0; if (newParent != null) { if (newParent != null) { newParent.checkNotReleased(); newParent.checkNotReleased(); Loading @@ -2494,7 +2501,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction detachChildren(SurfaceControl sc) { public Transaction detachChildren(SurfaceControl sc) { sc.checkNotReleased(); checkPreconditions(sc); nativeSeverChildren(mNativeObject, sc.mNativeObject); nativeSeverChildren(mNativeObject, sc.mNativeObject); return this; return this; } } Loading @@ -2503,7 +2510,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setOverrideScalingMode(SurfaceControl sc, int overrideScalingMode) { public Transaction setOverrideScalingMode(SurfaceControl sc, int overrideScalingMode) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetOverrideScalingMode(mNativeObject, sc.mNativeObject, nativeSetOverrideScalingMode(mNativeObject, sc.mNativeObject, overrideScalingMode); overrideScalingMode); return this; return this; Loading @@ -2516,7 +2523,7 @@ public final class SurfaceControl implements Parcelable { */ */ @UnsupportedAppUsage @UnsupportedAppUsage public Transaction setColor(SurfaceControl sc, @Size(3) float[] color) { public Transaction setColor(SurfaceControl sc, @Size(3) float[] color) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetColor(mNativeObject, sc.mNativeObject, color); nativeSetColor(mNativeObject, sc.mNativeObject, color); return this; return this; } } Loading @@ -2527,7 +2534,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setSecure(SurfaceControl sc, boolean isSecure) { public Transaction setSecure(SurfaceControl sc, boolean isSecure) { sc.checkNotReleased(); checkPreconditions(sc); if (isSecure) { if (isSecure) { nativeSetFlags(mNativeObject, sc.mNativeObject, SECURE, SECURE); nativeSetFlags(mNativeObject, sc.mNativeObject, SECURE, SECURE); } else { } else { Loading @@ -2542,7 +2549,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setOpaque(SurfaceControl sc, boolean isOpaque) { public Transaction setOpaque(SurfaceControl sc, boolean isOpaque) { sc.checkNotReleased(); checkPreconditions(sc); if (isOpaque) { if (isOpaque) { nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_OPAQUE, SURFACE_OPAQUE); nativeSetFlags(mNativeObject, sc.mNativeObject, SURFACE_OPAQUE, SURFACE_OPAQUE); } else { } else { Loading Loading @@ -2657,7 +2664,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setMetadata(SurfaceControl sc, int key, Parcel data) { public Transaction setMetadata(SurfaceControl sc, int key, Parcel data) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetMetadata(mNativeObject, sc.mNativeObject, key, data); nativeSetMetadata(mNativeObject, sc.mNativeObject, key, data); return this; return this; } } Loading @@ -2680,7 +2687,7 @@ public final class SurfaceControl implements Parcelable { * @hide * @hide */ */ public Transaction setShadowRadius(SurfaceControl sc, float shadowRadius) { public Transaction setShadowRadius(SurfaceControl sc, float shadowRadius) { sc.checkNotReleased(); checkPreconditions(sc); nativeSetShadowRadius(mNativeObject, sc.mNativeObject, shadowRadius); nativeSetShadowRadius(mNativeObject, sc.mNativeObject, shadowRadius); return this; return this; } } Loading Loading @@ -2763,4 +2770,27 @@ public final class SurfaceControl implements Parcelable { } } }; }; } } /** * A debugging utility subclass of SurfaceControl.Transaction. At construction * you can pass in a monitor object, and all the other methods will throw an exception * if the monitor is not held when they are called. * @hide */ public static class LockDebuggingTransaction extends SurfaceControl.Transaction { Object mMonitor; public LockDebuggingTransaction(Object o) { mMonitor = o; } @Override protected void checkPreconditions(SurfaceControl sc) { super.checkPreconditions(sc); if (!Thread.holdsLock(mMonitor)) { throw new RuntimeException( "Unlocked access to synchronized SurfaceControl.Transaction"); } } } } }