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

Commit 6293525d authored by Nextbit's avatar Nextbit Committed by Adnan Begovic
Browse files

Support full size application screenshots

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

Change-Id: I6d154f6b33bfb8ec90e3757a40382c1dc6feaad3
parent c27950df
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -5680,8 +5680,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
     */
@@ -5832,6 +5832,12 @@ public class WindowManagerService extends IWindowManager.Stub
                int fw = frame.width();
                int fh = frame.height();

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

                // Constrain thumbnail to smaller of screen width or height. Assumes aspect
                // of thumbnail is the same as the screen (in landscape) or square.
                scale = Math.max(width / (float) fw, height / (float) fh);