[Network Connection] Correct canceling dialog behavior
Use setCancelable() rather than setCanceledOnTouchOutside() for better
code smell and consisting with general not canceling behavior.
The back key and touching outside will not cancel this dialog for better
UX.
Bug: 128877712
Test: atest NetworkRequestDialogFragmentTest
Change-Id: I19bc5637a7307610e34db15d54c1d80d5b7e379b
diff --git a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
index e9057e6..2a7ac17 100644
--- a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
+++ b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
@@ -138,9 +138,9 @@
.setOnItemClickListener(
(parent, view, position, id) -> this.onClick(dialog, position));
- // Don't dismiss dialog when touching outside. User report it is easy to touch outside.
- // This causes dialog to close. Which is concerned as a bad UX (b/128877712).
- dialog.setCanceledOnTouchOutside(false);
+ // Don't dismiss dialog when touching outside. User reports it is easy to touch outside.
+ // This causes dialog to close.
+ setCancelable(false);
dialog.setOnShowListener((dialogInterface) -> {
// Replace NeutralButton onClickListener to avoid closing dialog