Bug 783150 - B2G RIL: Fetch ICC Record only when SIM_READY. r=vicamo
authorYoshi Huang <allstars.chh@mozilla.com>
Fri, 10 Aug 2012 14:55:08 +0800
changeset 102505 e0f50d6dc61e7ad0740b921c8677f1d57476c99b
parent 102504 cb192b83831c57b6f4eb3bb025ac042211199098
child 102506 56ae921df543697d729b8b77f2b3b2dd9fc0c5e7
push id13494
push useryhuang@mozilla.com
push dateThu, 16 Aug 2012 02:58:49 +0000
treeherdermozilla-inbound@e0f50d6dc61e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs783150
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 783150 - B2G RIL: Fetch ICC Record only when SIM_READY. r=vicamo
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -1976,30 +1976,34 @@ let RIL = {
         return;
       }
       this.cardState = GECKO_CARDSTATE_ABSENT;
       this.sendDOMMessage({rilMessageType: "cardstatechange",
                            cardState: this.cardState});
       return;
     }
 
-    let app = iccStatus.apps[iccStatus.gsmUmtsSubscriptionAppIndex];
+    // TODO: Bug 726098, change to use cdmaSubscriptionAppIndex when in CDMA.
+    let index = iccStatus.gsmUmtsSubscriptionAppIndex;
+    let app = iccStatus.apps[index];
     if (!app) {
       if (DEBUG) {
         debug("Subscription application is not present in iccStatus.");
       }
       if (this.cardState == GECKO_CARDSTATE_ABSENT) {
         return;
       }
       this.cardState = GECKO_CARDSTATE_ABSENT;
       this.operator = null;
       this.sendDOMMessage({rilMessageType: "cardstatechange",
                            cardState: this.cardState});
       return;
     }
+    // fetchICCRecords will need to read aid, so read aid here.
+    this.aid = app.aid;
 
     let newCardState;
     switch (app.app_state) {
       case CARD_APPSTATE_PIN:
         newCardState = GECKO_CARDSTATE_PIN_REQUIRED;
         break;
       case CARD_APPSTATE_PUK:
         newCardState = GECKO_CARDSTATE_PUK_REQUIRED;
@@ -2015,25 +2019,22 @@ let RIL = {
       default:
         newCardState = GECKO_CARDSTATE_NOT_READY;
     }
 
     if (this.cardState == newCardState) {
       return;
     }
 
-    // TODO: Bug 726098, change to use cdmaSubscriptionAppIndex when in CDMA.
-    // fetchICCRecords will need to read aid, so read aid here.
-    let index = iccStatus.gsmUmtsSubscriptionAppIndex;
-    this.aid = iccStatus.apps[index].aid;
-
     // This was moved down from CARD_APPSTATE_READY
     this.requestNetworkInfo();
     this.getSignalStrength();
-    this.fetchICCRecords();
+    if (newCardState == GECKO_CARDSTATE_READY) {
+      this.fetchICCRecords();
+    }
 
     this.cardState = newCardState;
     this.sendDOMMessage({rilMessageType: "cardstatechange",
                          cardState: this.cardState});
   },
 
    /**
    * Helper for processing responses of functions such as enterICC* and changeICC*.