diff --git a/core/java/android/hardware/HardwareBuffer.java b/core/java/android/hardware/HardwareBuffer.java index 515a0098b6c64..ac1bcf3186be3 100644 --- a/core/java/android/hardware/HardwareBuffer.java +++ b/core/java/android/hardware/HardwareBuffer.java @@ -131,7 +131,8 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable { /** Usage: The buffer will be written to by the GPU */ public static final long USAGE_GPU_COLOR_OUTPUT = 1 << 9; /** - * The buffer will be used as a composer HAL overlay layer. + * The buffer will be used as a hardware composer overlay layer. That is, it will be displayed + * using the system compositor via {@link SurfaceControl} * * This flag is currently only needed when using * {@link android.view.SurfaceControl.Transaction#setBuffer(SurfaceControl, HardwareBuffer)} diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 3cd1e0fd71d21..ce54968658858 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -3700,21 +3700,32 @@ public final class SurfaceControl implements Parcelable { /** * Sets the buffer transform that should be applied to the current buffer. * + * This can be used in combination with + * {@link AttachedSurfaceControl#addOnBufferTransformHintChangedListener(AttachedSurfaceControl.OnBufferTransformHintChangedListener)} + * to pre-rotate the buffer for the current display orientation. This can + * improve the performance of displaying the associated buffer. + * * @param sc The SurfaceControl to update * @param transform The transform to apply to the buffer. * @return this */ public @NonNull Transaction setBufferTransform(@NonNull SurfaceControl sc, - /* TODO: Mark the intdef */ int transform) { + @SurfaceControl.BufferTransform int transform) { checkPreconditions(sc); nativeSetBufferTransform(mNativeObject, sc.mNativeObject, transform); return this; } /** - * Updates the region for the content on this surface updated in this transaction. + * Updates the region for the content on this surface updated in this transaction. The + * damage region is the area of the buffer that has changed since the previously + * sent buffer. This can be used to reduce the amount of recomposition that needs + * to happen when only a small region of the buffer is being updated, such as for + * a small blinking cursor or a loading indicator. * - * If unspecified, the complete surface is assumed to be damaged. + * @param sc The SurfaceControl on which to set the damage region + * @param region The region to set. If null, the entire buffer is assumed dirty. This is + * equivalent to not setting a damage region at all. */ public @NonNull Transaction setDamageRegion(@NonNull SurfaceControl sc, @Nullable Region region) {