diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-05-12 00:08:25 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-05-12 00:08:25 +0000 |
| commit | a5014e1435c772194efd7e1114eff431fc4fd585 (patch) | |
| tree | 5637eaf4650c7381525fdb72cdc4e3696f88d9fe /core/java/android | |
| parent | 4d79a92078d5c44b0a0ce735b822d17c18016f61 (diff) | |
| parent | db5201d3abd526ad7fcbdf37fb825f9519297935 (diff) | |
Merge "Provide a fixed transform hint if the layer is in a fixed orientation 2/2" into rvc-dev am: db5201d3ab
Change-Id: I2f8cc902006808c78e635de9fb0b4a9143dab05b
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/SurfaceControl.java | 35 |
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. |
