diff options
| author | Dan Stoza <stoza@google.com> | 2014-02-14 15:06:55 -0800 |
|---|---|---|
| committer | Dan Stoza <stoza@google.com> | 2014-02-14 23:10:29 +0000 |
| commit | 16ec12ae77fdd2b09ea0ea0885ac52f11bd32c59 (patch) | |
| tree | a489ab33cd1706382c24a4f71b4ab45990793c39 /core/java/android | |
| parent | d5c8044e7e1f1402fdd4a035690329294ab07b33 (diff) | |
Allow disabling layer rotation during screenshots
Add the ability to ignore layers' transformation matrices during
screenshot capture, which will allow the window manager to capture
unrotated images for recents during the device rotation animation.
Bug: 11805195
Change-Id: I96e65506b198d34724eb3aa84815aae6f6de4935
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/SurfaceControl.java | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 97a1f2155297..5a8d2c8381c5 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -39,9 +39,11 @@ public class SurfaceControl { private static native void nativeDestroy(long nativeObject); private static native Bitmap nativeScreenshot(IBinder displayToken, - int width, int height, int minLayer, int maxLayer, boolean allLayers); + int width, int height, int minLayer, int maxLayer, boolean allLayers, + boolean useIdentityTransform); private static native void nativeScreenshot(IBinder displayToken, Surface consumer, - int width, int height, int minLayer, int maxLayer, boolean allLayers); + int width, int height, int minLayer, int maxLayer, boolean allLayers, + boolean useIdentityTransform); private static native void nativeOpenTransaction(); private static native void nativeCloseTransaction(); @@ -554,10 +556,15 @@ public class SurfaceControl { * include in the screenshot. * @param maxLayer The highest (top-most Z order) surface layer to * include in the screenshot. + * @param useIdentityTransform Replace whatever transformation (rotation, + * scaling, translation) the surface layers are currently using with the + * identity transformation while taking the screenshot. */ public static void screenshot(IBinder display, Surface consumer, - int width, int height, int minLayer, int maxLayer) { - screenshot(display, consumer, width, height, minLayer, maxLayer, false); + int width, int height, int minLayer, int maxLayer, + boolean useIdentityTransform) { + screenshot(display, consumer, width, height, minLayer, maxLayer, false, + useIdentityTransform); } /** @@ -572,7 +579,7 @@ public class SurfaceControl { */ public static void screenshot(IBinder display, Surface consumer, int width, int height) { - screenshot(display, consumer, width, height, 0, 0, true); + screenshot(display, consumer, width, height, 0, 0, true, false); } /** @@ -582,7 +589,7 @@ public class SurfaceControl { * @param consumer The {@link Surface} to take the screenshot into. */ public static void screenshot(IBinder display, Surface consumer) { - screenshot(display, consumer, 0, 0, 0, 0, true); + screenshot(display, consumer, 0, 0, 0, 0, true, false); } @@ -602,15 +609,20 @@ public class SurfaceControl { * include in the screenshot. * @param maxLayer The highest (top-most Z order) surface layer to * include in the screenshot. + * @param useIdentityTransform Replace whatever transformation (rotation, + * scaling, translation) the surface layers are currently using with the + * identity transformation while taking the screenshot. * @return Returns a Bitmap containing the screen contents, or null * if an error occurs. Make sure to call Bitmap.recycle() as soon as * possible, once its content is not needed anymore. */ - public static Bitmap screenshot(int width, int height, int minLayer, int maxLayer) { + public static Bitmap screenshot(int width, int height, int minLayer, int maxLayer, + boolean useIdentityTransform) { // TODO: should take the display as a parameter IBinder displayToken = SurfaceControl.getBuiltInDisplay( SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN); - return nativeScreenshot(displayToken, width, height, minLayer, maxLayer, false); + return nativeScreenshot(displayToken, width, height, minLayer, maxLayer, false, + useIdentityTransform); } /** @@ -629,17 +641,19 @@ public class SurfaceControl { // TODO: should take the display as a parameter IBinder displayToken = SurfaceControl.getBuiltInDisplay( SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN); - return nativeScreenshot(displayToken, width, height, 0, 0, true); + return nativeScreenshot(displayToken, width, height, 0, 0, true, false); } private static void screenshot(IBinder display, Surface consumer, - int width, int height, int minLayer, int maxLayer, boolean allLayers) { + int width, int height, int minLayer, int maxLayer, boolean allLayers, + boolean useIdentityTransform) { if (display == null) { throw new IllegalArgumentException("displayToken must not be null"); } if (consumer == null) { throw new IllegalArgumentException("consumer must not be null"); } - nativeScreenshot(display, consumer, width, height, minLayer, maxLayer, allLayers); + nativeScreenshot(display, consumer, width, height, minLayer, maxLayer, allLayers, + useIdentityTransform); } } |
