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

Commit 6ce1983a authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 4532 into donut

* changes:
  Fixes #1924909. When restoring managed dialogs, do exactly the same thing as when showing a dialog.
parents cff19c1a 764d5331
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -864,11 +864,22 @@ public class Activity extends ContextThemeWrapper
            final Integer dialogId = ids[i];
            Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
            if (dialogState != null) {
                final Dialog dialog = onCreateDialog(dialogId);
                dialog.onRestoreInstanceState(dialogState);
                final Dialog dialog = createDialog(dialogId);
                mManagedDialogs.put(dialogId, dialog);
                onPrepareDialog(dialogId, dialog);
                dialog.onRestoreInstanceState(dialogState);
            }
        }
    }

    private Dialog createDialog(Integer dialogId) {
        final Dialog dialog = onCreateDialog(dialogId);
        if (dialog == null) {
            throw new IllegalArgumentException("Activity#onCreateDialog did "
                    + "not create a dialog for id " + dialogId);
        }
        dialog.dispatchOnCreate(null);
        return dialog;
    }

    private String savedDialogKeyFor(int key) {
@@ -2419,12 +2430,7 @@ public class Activity extends ContextThemeWrapper
        }
        Dialog dialog = mManagedDialogs.get(id);
        if (dialog == null) {
            dialog = onCreateDialog(id);
            if (dialog == null) {
                throw new IllegalArgumentException("Activity#onCreateDialog did "
                        + "not create a dialog for id " + id);
            }
            dialog.dispatchOnCreate(null);
            dialog = createDialog(id);
            mManagedDialogs.put(id, dialog);
        }