SetupWizard: don't crash without SIMs
SubscriptionManager may be null Change-Id: Ia2112044400576a93931474a3fff2af161ccda21 Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
parent
c225cd58f7
commit
98b5eb9958
@ -113,12 +113,15 @@ public class SetupWizardUtils {
|
|||||||
public static boolean isSimMissing(Context context) {
|
public static boolean isSimMissing(Context context) {
|
||||||
TelephonyManager tm =
|
TelephonyManager tm =
|
||||||
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
int simCount = SubscriptionController.getInstance().getActiveSubInfoCount();
|
SubscriptionController subscriptionController = SubscriptionController.getInstance();
|
||||||
for (int i = 0; i < simCount; i++) {
|
if (subscriptionController != null) {
|
||||||
int simState = tm.getSimState(i);
|
int simCount = subscriptionController.getActiveSubInfoCount();
|
||||||
if (simState != TelephonyManager.SIM_STATE_ABSENT &&
|
for (int i = 0; i < simCount; i++) {
|
||||||
simState != TelephonyManager.SIM_STATE_UNKNOWN) {
|
int simState = tm.getSimState(i);
|
||||||
return false;
|
if (simState != TelephonyManager.SIM_STATE_ABSENT &&
|
||||||
|
simState != TelephonyManager.SIM_STATE_UNKNOWN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user