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

Commit 79faca22 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Fix crash when showing the media projection dialog on work profile

Bug: 222713428
Test: Manual
Change-Id: Ic969b8270162c18227447d79fe55dbfaa75bfb83
parent f89f27e0
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class MediaProjectionPermissionActivity extends Activity
    private int mUid;
    private IMediaProjectionManager mService;

    private SystemUIDialog mDialog;
    private AlertDialog mDialog;

    @Override
    public void onCreate(Bundle icicle) {
@@ -141,13 +141,18 @@ public class MediaProjectionPermissionActivity extends Activity
            dialogTitle = getString(R.string.media_projection_dialog_title, appName);
        }

        mDialog = new SystemUIDialog(this);
        mDialog.setTitle(dialogTitle);
        mDialog.setIcon(R.drawable.ic_media_projection_permission);
        mDialog.setMessage(dialogText);
        mDialog.setPositiveButton(R.string.media_projection_action_text, this);
        mDialog.setNeutralButton(android.R.string.cancel, this);
        mDialog.setOnCancelListener(this);
        mDialog = new AlertDialog.Builder(this, R.style.Theme_SystemUI_Dialog)
                .setTitle(dialogTitle)
                .setIcon(R.drawable.ic_media_projection_permission)
                .setMessage(dialogText)
                .setPositiveButton(R.string.media_projection_action_text, this)
                .setNeutralButton(android.R.string.cancel, this)
                .setOnCancelListener(this)
                .create();

        SystemUIDialog.registerDismissListener(mDialog);
        SystemUIDialog.applyFlags(mDialog);
        SystemUIDialog.setDialogSize(mDialog);

        mDialog.create();
        mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setFilterTouchesWhenObscured(true);