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

Commit a5f29f2e authored by Anna Bauza's avatar Anna Bauza Committed by Android (Google) Code Review
Browse files

Merge "Fix "Remove Guest" option shows "Reset Guest" dialog" into tm-dev

parents 4dcf0565 ee231520
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -209,8 +209,13 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
                            }
                        });
            case DIALOG_CONFIRM_RESET_GUEST:
                if (mGuestUserAutoCreated) {
                    return UserDialogs.createResetGuestDialog(getActivity(),
                        (dialog, which) -> resetGuest());
                } else {
                    return UserDialogs.createRemoveGuestDialog(getActivity(),
                        (dialog, which) -> resetGuest());
                }
        }
        throw new IllegalArgumentException("Unsupported dialogId " + dialogId);
    }
+21 −0
Original line number Diff line number Diff line
@@ -196,4 +196,25 @@ public final class UserDialogs {
                .setNegativeButton(android.R.string.cancel, null)
                .create();
    }


    /**
     * Creates a dialog to confirm with the user if it's ok to remove the guest user, which will
     * delete all the guest user's data.
     *
     * @param context a Context object
     * @param onConfirmListener Callback object for positive action
     * @return the created Dialog
     */
    public static Dialog createRemoveGuestDialog(Context context,
            DialogInterface.OnClickListener onConfirmListener) {
        return new AlertDialog.Builder(context)
                .setTitle(com.android.settingslib.R.string.guest_remove_guest_dialog_title)
                .setMessage(R.string.user_exit_guest_confirm_message)
                .setPositiveButton(
                        com.android.settingslib.R.string.guest_remove_guest_confirm_button,
                        onConfirmListener)
                .setNegativeButton(android.R.string.cancel, null)
                .create();
    }
}
+6 −1
Original line number Diff line number Diff line
@@ -737,8 +737,13 @@ public class UserSettings extends SettingsPreferenceFragment
                return buildAddUserDialog(USER_TYPE_RESTRICTED_PROFILE);
            }
            case DIALOG_CONFIRM_RESET_GUEST: {
                if (mGuestUserAutoCreated) {
                    return UserDialogs.createResetGuestDialog(getActivity(),
                        (dialog, which) -> resetGuest());
                } else {
                    return UserDialogs.createRemoveGuestDialog(getActivity(),
                        (dialog, which) -> resetGuest());
                }
            }
            default:
                return null;