Always initialize CDMA OTA state
We only used to initialize CDMA OTA state for CDMA devices. New devices
can be both and switch between them. The order of operations doesn't
guarantee that RAT change notification will run before OTA request which
caused a NPE when we switch from GSM to CDMA because the state wasn't
initialized.
This change always initializes those state objects so that they are
always ready to perform initialization.
Bug:17869501
Change-Id: Iddb0a538c5d0c1d08c7db22f80081d6542803af8
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 4dd8ee2..31337ee 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -434,12 +434,10 @@
PhoneUtils.setAudioMode(mCM);
}
- if (TelephonyCapabilities.supportsOtasp(phone)) {
- cdmaOtaProvisionData = new OtaUtils.CdmaOtaProvisionData();
- cdmaOtaConfigData = new OtaUtils.CdmaOtaConfigData();
- cdmaOtaScreenState = new OtaUtils.CdmaOtaScreenState();
- cdmaOtaInCallScreenUiState = new OtaUtils.CdmaOtaInCallScreenUiState();
- }
+ cdmaOtaProvisionData = new OtaUtils.CdmaOtaProvisionData();
+ cdmaOtaConfigData = new OtaUtils.CdmaOtaConfigData();
+ cdmaOtaScreenState = new OtaUtils.CdmaOtaScreenState();
+ cdmaOtaInCallScreenUiState = new OtaUtils.CdmaOtaInCallScreenUiState();
// XXX pre-load the SimProvider so that it's ready
resolver.getType(Uri.parse("content://icc/adn"));
@@ -759,21 +757,7 @@
cdmaPhoneCallState = new CdmaPhoneCallState();
cdmaPhoneCallState.CdmaPhoneCallStateInit();
}
- if (TelephonyCapabilities.supportsOtasp(phone)) {
- //create instances of CDMA OTA data classes
- if (cdmaOtaProvisionData == null) {
- cdmaOtaProvisionData = new OtaUtils.CdmaOtaProvisionData();
- }
- if (cdmaOtaConfigData == null) {
- cdmaOtaConfigData = new OtaUtils.CdmaOtaConfigData();
- }
- if (cdmaOtaScreenState == null) {
- cdmaOtaScreenState = new OtaUtils.CdmaOtaScreenState();
- }
- if (cdmaOtaInCallScreenUiState == null) {
- cdmaOtaInCallScreenUiState = new OtaUtils.CdmaOtaInCallScreenUiState();
- }
- } else {
+ if (!TelephonyCapabilities.supportsOtasp(phone)) {
//Clean up OTA data in GSM/UMTS. It is valid only for CDMA
clearOtaState();
}