+ // Return the alert dialog.
+ return alertDialog
+ } catch (exception: Exception) { // The app was restarted while the dialog was displayed.
+ // Dismiss this new instance of the dialog. Amazingly, the old instance will be restored by Android and, even more amazingly, will be fully functional.
+ dismiss()
+
+ // Use an alert dialog builder to create an empty alert dialog.
+ val dialogBuilder = AlertDialog.Builder(requireContext(), R.style.PrivacyBrowserAlertDialog)
+
+ // Return the empty alert dialog.
+ return dialogBuilder.create()
+ }