SetupWizard: protect against IllegalStateExceptions in telephony

Telephony throws this exception in some cases when retrieving SIM state

Change-Id: I87e14aaa328d46ebba4990559f6531de4e961d68
This commit is contained in:
Raj Yengisetty 2015-06-18 16:21:06 -07:00
parent ffc0dbd2fb
commit b72e820a96
1 changed files with 8 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import android.os.SystemProperties;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.internal.telephony.TelephonyIntents;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
@ -171,7 +172,13 @@ public class CMSetupWizardData extends AbstractSetupData {
TelephonyManager tm = TelephonyManager.from(mContext);
int simSlotCount = tm.getSimCount();
for (int i = 0; i < simSlotCount; i++) {
int state = tm.getSimState(i);
int state;
try {
state = tm.getSimState(i);
} catch (IllegalStateException ise) {
Log.e(TAG, "Unable to get sim state from TelephonyManager");
continue;
}
if (state != TelephonyManager.SIM_STATE_ABSENT
&& state != TelephonyManager.SIM_STATE_UNKNOWN) {
return true;