summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorRobert Carr <racarr@google.com>2016-06-16 15:17:07 -0700
committerRobert Carr <racarr@google.com>2016-06-21 17:13:15 -0700
commit6da3cc0237d2483ead16a7013d1326bccc5112af (patch)
treed65b47e1254fc44b3cb5bb7ab6ec3b2c05ab6a2d /core/java/android
parentd46ae2f7ed4885f80c2ad5372a44f0c6f690ed45 (diff)
Implement seamless rotation mode.
Add a rotation mode which does not require freezing the screen. For situations like Camera where only small elements move on screen, this allows for seamless changes of display orientation. This is achieved by transforming the windows with their current buffer in the same transaction that we rotate the display. We set things up so the windows are frozen this way until they submit buffers in the new orientation. There is a special case in the Camera window itself, and it's use of NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY. In this case the buffer contents are rotated by SurfaceFlinger and will never resize, for these windows we just need to update the scaling matrix. Bug: 28823590 Change-Id: I52dc6a86fcb3c08f736f0977ba3975a24fb8136c
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/Surface.java1
-rw-r--r--core/java/android/view/SurfaceControl.java18
-rw-r--r--core/java/android/view/WindowManagerPolicy.java2
3 files changed, 16 insertions, 5 deletions
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 7da849a832e4..286e0979d12b 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -58,6 +58,7 @@ public class Surface implements Parcelable {
private static native long nativeGetNextFrameNumber(long nativeObject);
private static native int nativeSetScalingMode(long nativeObject, int scalingMode);
+ private static native void nativeSetBuffersTransform(long nativeObject, long transform);
public static final Parcelable.Creator<Surface> CREATOR =
new Parcelable.Creator<Surface>() {
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 415e70ca03fd..f1abca8e2a0d 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -51,7 +51,7 @@ public class SurfaceControl {
private static native void nativeSetLayer(long nativeObject, int zorder);
private static native void nativeSetPosition(long nativeObject, float x, float y);
- private static native void nativeSetPositionAppliesWithResize(long nativeObject);
+ private static native void nativeSetGeometryAppliesWithResize(long nativeObject);
private static native void nativeSetSize(long nativeObject, int w, int h);
private static native void nativeSetTransparentRegionHint(long nativeObject, Region region);
private static native void nativeSetAlpha(long nativeObject, float alpha);
@@ -89,6 +89,8 @@ public class SurfaceControl {
private static native void nativeSetOverrideScalingMode(long nativeObject,
int scalingMode);
private static native IBinder nativeGetHandle(long nativeObject);
+ private static native boolean nativeGetTransformToDisplayInverse(long nativeObject);
+
private static native Display.HdrCapabilities nativeGetHdrCapabilities(IBinder displayToken);
@@ -393,6 +395,10 @@ public class SurfaceControl {
return nativeGetHandle(mNativeObject);
}
+ public boolean getTransformToDisplayInverse() {
+ return nativeGetTransformToDisplayInverse(mNativeObject);
+ }
+
/** flag the transaction as an animation */
public static void setAnimationTransaction() {
nativeSetAnimationTransaction();
@@ -409,13 +415,15 @@ public class SurfaceControl {
}
/**
- * If the size changes in this transaction, position updates specified
+ * If the buffer size changes in this transaction, position and crop updates specified
* in this transaction will not complete until a buffer of the new size
- * arrives.
+ * arrives. As transform matrix and size are already frozen in this fashion,
+ * this enables totally freezing the surface until the resize has completed
+ * (at which point the geometry influencing aspects of this transaction will then occur)
*/
- public void setPositionAppliesWithResize() {
+ public void setGeometryAppliesWithResize() {
checkNotReleased();
- nativeSetPositionAppliesWithResize(mNativeObject);
+ nativeSetGeometryAppliesWithResize(mNativeObject);
}
public void setSize(int w, int h) {
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index e6f5b8386d49..a8afaf20a1c5 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -1410,4 +1410,6 @@ public interface WindowManagerPolicy {
* Called when the configuration has changed, and it's safe to load new values from resources.
*/
public void onConfigurationChanged();
+
+ public boolean shouldRotateSeamlessly(int oldRotation, int newRotation);
}