Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2dea8e3e authored by Nextbit's avatar Nextbit Committed by Steve Kondik
Browse files

Support full size application screenshots

Add optional width and height parameters for
ease of capturing entire application screenshots

Change-Id: I6d154f6b33bfb8ec90e3757a40382c1dc6feaad3
parent ec32400b
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -6142,8 +6142,8 @@ public class WindowManagerService extends IWindowManager.Stub
     * of the target image.
     *
     * @param displayId the Display to take a screenshot of.
     * @param width the width of the target bitmap
     * @param height the height of the target bitmap
     * @param width the width of the target bitmap or -1 for a full screenshot
     * @param height the height of the target bitmap or -1 for a full screenshot
     * @param force565 if true the returned bitmap will be RGB_565, otherwise it
     *                 will be the same config as the surface
     */
@@ -6312,6 +6312,12 @@ public class WindowManagerService extends IWindowManager.Stub
                // Constrain frame to the screen size.
                frame.intersect(0, 0, dw, dh);

                // use the whole frame if width and height are not constrained
                if (width == -1 && height == -1) {
                    width = frame.width();
                    height = frame.height();
                }

                // Tell surface flinger what part of the image to crop. Take the top
                // right part of the application, and crop the larger dimension to fit.
                Rect crop = new Rect(frame);