summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/SurfaceControl.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index c0c29eba41d1..9109f50247e0 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -220,6 +220,8 @@ public final class SurfaceControl implements Parcelable {
private static native long nativeAcquireFrameRateFlexibilityToken();
private static native void nativeReleaseFrameRateFlexibilityToken(long token);
+ private static native void nativeSetFixedTransformHint(long transactionObj, long nativeObject,
+ int transformHint);
private final CloseGuard mCloseGuard = CloseGuard.get();
private String mName;
@@ -2307,6 +2309,39 @@ public final class SurfaceControl implements Parcelable {
}
/**
+ * Provide the graphic producer a transform hint if the layer and its children are
+ * in an orientation different from the display's orientation. The caller is responsible
+ * for clearing this transform hint if the layer is no longer in a fixed orientation.
+ *
+ * The transform hint is used to prevent allocating a buffer of different size when a
+ * layer is rotated. The producer can choose to consume the hint and allocate the buffer
+ * with the same size.
+ *
+ * @return This Transaction.
+ * @hide
+ */
+ @NonNull
+ public Transaction setFixedTransformHint(@NonNull SurfaceControl sc,
+ @Surface.Rotation int transformHint) {
+ checkPreconditions(sc);
+ nativeSetFixedTransformHint(mNativeObject, sc.mNativeObject, transformHint);
+ return this;
+ }
+
+ /**
+ * Clearing any transform hint if set on this layer.
+ *
+ * @return This Transaction.
+ * @hide
+ */
+ @NonNull
+ public Transaction unsetFixedTransformHint(@NonNull SurfaceControl sc) {
+ checkPreconditions(sc);
+ nativeSetFixedTransformHint(mNativeObject, sc.mNativeObject, -1/* INVALID_ROTATION */);
+ return this;
+ }
+
+ /**
* Set the Z-order for a given SurfaceControl, relative to it's siblings.
* If two siblings share the same Z order the ordering is undefined. Surfaces
* with a negative Z will be placed below the parent surface.