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

Commit 496c34da authored by Marvin Ramin's avatar Marvin Ramin
Browse files

Don't show MediaProjection consent Dialog above lockscreen

Remove FLAG_SHOW_WHEN_LOCKED from the MediaProjection consent Dialog to
prevent it from showing above the lockscreen.

Bug: 351409536
Test: manual
Flag: EXEMPT bugfix
Change-Id: Icfbee72318d39b9b669973c1be22782095c76a2d
parent 29d12d84
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ public class MediaProjectionPermissionActivity extends Activity {

    private void setUpDialog(AlertDialog dialog) {
        SystemUIDialog.registerDismissListener(dialog);
        SystemUIDialog.applyFlags(dialog);
        SystemUIDialog.applyFlags(dialog, /* showWhenLocked= */ false);
        SystemUIDialog.setDialogSize(dialog);

        dialog.setOnCancelListener(this::onDialogDismissedOrCancelled);
+8 −2
Original line number Diff line number Diff line
@@ -480,10 +480,16 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh
    }

    public static AlertDialog applyFlags(AlertDialog dialog) {
        return applyFlags(dialog, true);
    }

    public static AlertDialog applyFlags(AlertDialog dialog, boolean showWhenLocked) {
        final Window window = dialog.getWindow();
        window.setType(WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL);
        window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
                | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
        window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        if (showWhenLocked) {
            window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
        }
        window.getAttributes().setFitInsetsTypes(
                window.getAttributes().getFitInsetsTypes() & ~Type.statusBars());
        return dialog;