Catch crash in mobile network ProgressDialog

When enabling "Automatically select network" in "Settings -> Network &
internet -> Mobile network -> Advanced" and rotating the device while
the dialog is showing there will be an IllegalArgumentException since
the decorView isn't attached to the window when dismissing the dialog.
Fixed by simply catching the exception since the dialog will be gone
anyway.

Bug: 146057372
Test: manual (see comment above)
Change-Id: I15f1d6f505fdf33964ce973ece31d6aa0d8f3909
This commit is contained in:
Daniel Hunt
2019-12-04 13:43:02 +01:00
committed by Ed Savage-Jones
parent e4ad103957
commit 9f74807e89

View File

@@ -176,7 +176,11 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
private void dismissProgressBar() {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
try {
mProgressDialog.dismiss();
} catch (IllegalArgumentException e) {
// Ignore exception since the dialog will be gone anyway.
}
}
}