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

Commit a9f5bdf3 authored by Marvin Ramin's avatar Marvin Ramin Committed by Android (Google) Code Review
Browse files

Merge "Don't show MediaProjection consent Dialog above lockscreen" into main

parents 3fa97821 496c34da
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;