diff options
author | Riley Andrews <riandrews@google.com> | 2014-08-21 15:47:07 -0700 |
---|---|---|
committer | Riley Andrews <riandrews@google.com> | 2014-09-09 03:15:48 +0000 |
commit | 1d13406538b79785d2d0928689b8d5037e851ecf (patch) | |
tree | 2b6757ac9990e9aab9edbeb1961828dadc3cb17a /core/java/android/view | |
parent | 1893d9b3a9845b602cbf9a107f3f8342205b0daf (diff) | |
download | frameworks_base-1d13406538b79785d2d0928689b8d5037e851ecf.zip frameworks_base-1d13406538b79785d2d0928689b8d5037e851ecf.tar.gz frameworks_base-1d13406538b79785d2d0928689b8d5037e851ecf.tar.bz2 |
Use surfaceflinger for recents thumbnail rotations.
+ This removes 30ms of latency on app to home transitions
on volantis.
Change-Id: Ia3747b8f8be0d41b9b3d095753edfe1df185c84d
Diffstat (limited to 'core/java/android/view')
-rw-r--r-- | core/java/android/view/SurfaceControl.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 1e28e33..4074529 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -39,7 +39,7 @@ public class SurfaceControl { private static native Bitmap nativeScreenshot(IBinder displayToken, Rect sourceCrop, int width, int height, int minLayer, int maxLayer, - boolean allLayers, boolean useIdentityTransform); + boolean allLayers, boolean useIdentityTransform, int rotation); private static native void nativeScreenshot(IBinder displayToken, Surface consumer, Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean allLayers, boolean useIdentityTransform); @@ -688,17 +688,23 @@ public class SurfaceControl { * @param useIdentityTransform Replace whatever transformation (rotation, * scaling, translation) the surface layers are currently using with the * identity transformation while taking the screenshot. + * @param rotation Apply a custom clockwise rotation to the screenshot, i.e. + * Surface.ROTATION_0,90,180,270. Surfaceflinger will always take + * screenshots in its native portrait orientation by default, so this is + * useful for returning screenshots that are independent of device + * orientation. * @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(Rect sourceCrop, int width, int height, - int minLayer, int maxLayer, boolean useIdentityTransform) { + int minLayer, int maxLayer, boolean useIdentityTransform, + int rotation) { // TODO: should take the display as a parameter IBinder displayToken = SurfaceControl.getBuiltInDisplay( SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN); return nativeScreenshot(displayToken, sourceCrop, width, height, - minLayer, maxLayer, false, useIdentityTransform); + minLayer, maxLayer, false, useIdentityTransform, rotation); } /** @@ -717,7 +723,8 @@ public class SurfaceControl { // TODO: should take the display as a parameter IBinder displayToken = SurfaceControl.getBuiltInDisplay( SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN); - return nativeScreenshot(displayToken, new Rect(), width, height, 0, 0, true, false); + return nativeScreenshot(displayToken, new Rect(), width, height, 0, 0, true, + false, Surface.ROTATION_0); } private static void screenshot(IBinder display, Surface consumer, Rect sourceCrop, |