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

Commit 56d1a2cf authored by Adrian Roos's avatar Adrian Roos
Browse files

Cutout: add runtime switch for screenshotting screen decorations

Bug: 65689439
Test: adb shell setprop debug.screenshot_rounded_corners true && adb shell kill `pid systemui` && adb exec-out screencap -p > out.png
Change-Id: Ibd2e8c94c0f1ad58b2357e8db1b20846588b1cce
parent 3bfe2b15
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.os.SystemProperties;
import android.provider.Settings.Secure;
import android.support.annotation.VisibleForTesting;
import android.util.DisplayMetrics;
@@ -64,6 +65,8 @@ import com.android.systemui.tuner.TunerService.Tunable;
public class ScreenDecorations extends SystemUI implements Tunable {
    public static final String SIZE = "sysui_rounded_size";
    public static final String PADDING = "sysui_rounded_content_padding";
    private static final boolean DEBUG_SCREENSHOT_ROUNDED_CORNERS =
            SystemProperties.getBoolean("debug.screenshot_rounded_corners", false);

    private int mRoundedDefault;
    private View mOverlay;
@@ -235,8 +238,10 @@ public class ScreenDecorations extends SystemUI implements Tunable {
                        | WindowManager.LayoutParams.FLAG_SLIPPERY
                        | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
                PixelFormat.TRANSLUCENT);
        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS
                | WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        if (!DEBUG_SCREENSHOT_ROUNDED_CORNERS) {
            lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
        }
        lp.setTitle("ScreenDecorOverlay");
        lp.gravity = Gravity.TOP | Gravity.LEFT;
        lp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;