summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-05-12 00:42:17 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-05-12 00:42:17 +0000
commit593cd4f3f7aa16c3be852581ecdc85909fceff09 (patch)
tree2f7e6f82c0c70f14549871c505fc57db5477a02f /core/java
parent8da297826d7ac6a065d67d02bb3b83f4f0ff9596 (diff)
parent2b5a43c3416d4a2c979f74c212610a4567124b38 (diff)
Merge "Provide a fixed transform hint if the layer is in a fixed orientation 2/2" into rvc-dev am: db5201d3ab am: a5014e1435 am: 2b5a43c341
Change-Id: Ib6a4a61c4ea58989a8f581f251b67c7d4106f471
Diffstat (limited to 'core/java')
-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.