Fix crash on potentially missing EuiccManager
Bug: 310710841 Test: it builds Change-Id: I9d2c88091a34a4e4e118fd1bd8d95c724c52e77e
This commit is contained in:
@@ -426,7 +426,7 @@ public class MainClear extends InstrumentedFragment implements OnGlobalLayoutLis
|
||||
@VisibleForTesting
|
||||
protected boolean isEuiccEnabled(Context context) {
|
||||
EuiccManager euiccManager = (EuiccManager) context.getSystemService(Context.EUICC_SERVICE);
|
||||
return euiccManager.isEnabled();
|
||||
return euiccManager != null && euiccManager.isEnabled();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@@ -293,7 +293,7 @@ public class ResetNetwork extends InstrumentedFragment {
|
||||
}
|
||||
EuiccManager euiccManager =
|
||||
(EuiccManager) context.getSystemService(Context.EUICC_SERVICE);
|
||||
if (!euiccManager.isEnabled()) {
|
||||
if (euiccManager == null || !euiccManager.isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
|
@@ -308,7 +308,7 @@ public class MobileNetworkUtils {
|
||||
public static Boolean showEuiccSettingsDetecting(Context context) {
|
||||
final EuiccManager euiccManager =
|
||||
(EuiccManager) context.getSystemService(EuiccManager.class);
|
||||
if (!euiccManager.isEnabled()) {
|
||||
if (euiccManager == null || !euiccManager.isEnabled()) {
|
||||
Log.w(TAG, "EuiccManager is not enabled.");
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user