am fec46e2f: am c593d00d: Input checks for some broadcasts

* commit 'fec46e2ff5f6fb3275bb000582a0b18a778807bb':
  Input checks for some broadcasts
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 8b0b8a9..d066de2 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -159,7 +159,7 @@
     static int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
     static boolean sVoiceCapable = true;
 
-    // Internal PhoneApp Call state tracker
+    // TODO: Remove, no longer used.
     CdmaPhoneCallState cdmaPhoneCallState;
 
     // The currently-active PUK entry activity and progress dialog.
@@ -780,14 +780,8 @@
         if (DBG) Log.d(LOG_TAG, "initForNewRadioTechnology...");
 
         final Phone phone = PhoneFactory.getPhone(phoneId);
-
-        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
-            // Create an instance of CdmaPhoneCallState and initialize it to IDLE
-            cdmaPhoneCallState = new CdmaPhoneCallState();
-            cdmaPhoneCallState.CdmaPhoneCallStateInit();
-        }
-        if (!TelephonyCapabilities.supportsOtasp(phone)) {
-            //Clean up OTA data in GSM/UMTS. It is valid only for CDMA
+        if (phone == null || !TelephonyCapabilities.supportsOtasp(phone)) {
+            // Clean up OTA for non-CDMA since it is only valid for CDMA.
             clearOtaState();
         }
 
@@ -795,7 +789,7 @@
         callStateMonitor.updateAfterRadioTechnologyChange();
 
         // Update registration for ICC status after radio technology change
-        IccCard sim = phone.getIccCard();
+        IccCard sim = phone == null ? null : phone.getIccCard();
         if (sim != null) {
             if (DBG) Log.d(LOG_TAG, "Update registration for ICC status...");
 
@@ -830,6 +824,7 @@
                 }
                 Phone phone = SubscriptionManager.isValidPhoneId(phoneId) ?
                         PhoneFactory.getPhone(phoneId) : PhoneFactory.getDefaultPhone();
+
                 // The "data disconnected due to roaming" notification is shown
                 // if (a) you have the "data roaming" feature turned off, and
                 // (b) you just lost data connectivity because you're roaming.
@@ -916,11 +911,13 @@
          */
 
         // If service just returned, start sending out the queued messages
-        ServiceState ss = ServiceState.newFromBundle(intent.getExtras());
-
-        if (ss != null) {
-            int state = ss.getState();
-            notificationMgr.updateNetworkSelection(state);
+        Bundle extras = intent.getExtras();
+        if (extras != null) {
+            ServiceState ss = ServiceState.newFromBundle(extras);
+            if (ss != null) {
+                int state = ss.getState();
+                notificationMgr.updateNetworkSelection(state);
+            }
         }
     }