From 9f74807e89063fdb5cc0dcae6e8dc45b16d4bf02 Mon Sep 17 00:00:00 2001 From: Daniel Hunt Date: Wed, 4 Dec 2019 13:43:02 +0100 Subject: [PATCH] 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 --- .../telephony/gsm/AutoSelectPreferenceController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java b/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java index 626390a9bbb..2eda9d94598 100644 --- a/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java +++ b/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java @@ -176,7 +176,11 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon private void dismissProgressBar() { if (mProgressDialog != null && mProgressDialog.isShowing()) { - mProgressDialog.dismiss(); + try { + mProgressDialog.dismiss(); + } catch (IllegalArgumentException e) { + // Ignore exception since the dialog will be gone anyway. + } } }