Bug 900321 - Part 3: const card lock types to fix style nits. r=vicamo
authorYoshi Huang <allstars.chh@mozilla.com>
Wed, 07 Aug 2013 12:15:39 +0800
changeset 141786 daaaa9227b48525ab07d3d810c5c3ceb85d51cf1
parent 141785 4bb87898165aae5aafeafa462c7a046688c2e73c
child 141787 931032ea3e8bebec1d840968cbc2ee616976ac06
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersvicamo
bugs900321
milestone26.0a1
Bug 900321 - Part 3: const card lock types to fix style nits. r=vicamo
dom/system/gonk/ril_consts.js
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -2345,38 +2345,50 @@ this.GECKO_CARDSTATE_SERVICE_PROVIDER_LO
 this.GECKO_CARDSTATE_SIM_LOCKED                    = "simPersonalizationLock";
 this.GECKO_CARDSTATE_NETWORK_PUK_REQUIRED          = "networkPukRequired";
 this.GECKO_CARDSTATE_NETWORK_SUBSET_PUK_REQUIRED   = "networkSubsetPukRequired";
 this.GECKO_CARDSTATE_CORPORATE_PUK_REQUIRED        = "corporatePukRequired";
 this.GECKO_CARDSTATE_SERVICE_PROVIDER_PUK_REQUIRED = "serviceProviderPukRequired";
 this.GECKO_CARDSTATE_SIM_PUK_REQUIRED              = "simPersonalizationPukRequired";
 this.GECKO_CARDSTATE_READY                         = "ready";
 
+this.GECKO_CARDLOCK_PIN      = "pin";
+this.GECKO_CARDLOCK_PIN2     = "pin2";
+this.GECKO_CARDLOCK_PUK      = "puk";
+this.GECKO_CARDLOCK_PUK2     = "puk2";
+this.GECKO_CARDLOCK_FDN      = "fdn";
+this.GECKO_CARDLOCK_NCK      = "nck";
+this.GECKO_CARDLOCK_CCK      = "cck";
+this.GECKO_CARDLOCK_SPCK     = "spck";
+this.GECKO_CARDLOCK_NCK_PUK  = "nckPuk";
+this.GECKO_CARDLOCK_CCK_PUK  = "cckPuk";
+this.GECKO_CARDLOCK_SPCK_PUK = "spckPuk";
+
 // See ril.h RIL_PersoSubstate
 this.PERSONSUBSTATE = {};
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_UNKNOWN] = GECKO_CARDSTATE_UNKNOWN;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_IN_PROGRESS] = GECKO_CARDSTATE_PERSONALIZATION_IN_PROGRESS;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_NETWORK] = GECKO_CARDSTATE_NETWORK_LOCKED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_NETWORK_SUBSET] = GECKO_CARDSTATE_NETWORK_SUBSET_LOCKED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_CORPORATE] = GECKO_CARDSTATE_CORPORATE_LOCKED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER] = GECKO_CARDSTATE_SERVICE_PROVIDER_LOCKED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_SIM] = GECKO_CARDSTATE_SIM_LOCKED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_NETWORK_PUK] = GECKO_CARDSTATE_NETWORK_PUK_REQUIRED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK] = GECKO_CARDSTATE_NETWORK_SUBSET_PUK_REQUIRED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_CORPORATE_PUK] = GECKO_CARDSTATE_CORPORATE_PUK_REQUIRED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK] = GECKO_CARDSTATE_SERVICE_PROVIDER_PUK_REQUIRED;
 PERSONSUBSTATE[CARD_PERSOSUBSTATE_READY] = GECKO_CARDSTATE_READY;
 
 this.GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK = {};
-GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK["nck"] = CARD_PERSOSUBSTATE_SIM_NETWORK;
-GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK["cck"] = CARD_PERSOSUBSTATE_SIM_CORPORATE;
-GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK["spck"] = CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER;
-GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK["nckPuk"] = CARD_PERSOSUBSTATE_SIM_NETWORK_PUK;
-GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK["cckPuk"] = CARD_PERSOSUBSTATE_SIM_CORPORATE_PUK;
-GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK["spckPuk"] = CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK] = CARD_PERSOSUBSTATE_SIM_NETWORK;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_CCK] = CARD_PERSOSUBSTATE_SIM_CORPORATE;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_SPCK] = CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK_PUK] = CARD_PERSOSUBSTATE_SIM_NETWORK_PUK;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_CCK_PUK] = CARD_PERSOSUBSTATE_SIM_CORPORATE_PUK;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_SPCK_PUK] = CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK;
 
 this.GECKO_NETWORK_SELECTION_UNKNOWN   = null;
 this.GECKO_NETWORK_SELECTION_AUTOMATIC = "automatic";
 this.GECKO_NETWORK_SELECTION_MANUAL    = "manual";
 
 this.GECKO_MOBILE_CONNECTION_STATE_UNKNOWN = null;
 this.GECKO_MOBILE_CONNECTION_STATE_NOTSEARCHING = "notSearching";
 this.GECKO_MOBILE_CONNECTION_STATE_SEARCHING = "searching";
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -962,38 +962,38 @@ let RIL = {
     Buf.simpleRequest(REQUEST_GET_SIM_STATUS);
   },
 
   /**
    * Helper function for unlocking ICC locks.
    */
   iccUnlockCardLock: function iccUnlockCardLock(options) {
     switch (options.lockType) {
-      case "pin":
+      case GECKO_CARDLOCK_PIN:
         this.enterICCPIN(options);
         break;
-      case "pin2":
+      case GECKO_CARDLOCK_PIN2:
         this.enterICCPIN2(options);
         break;
-      case "puk":
+      case GECKO_CARDLOCK_PUK:
         this.enterICCPUK(options);
         break;
-      case "puk2":
+      case GECKO_CARDLOCK_PUK2:
         this.enterICCPUK2(options);
         break;
-      case "nck":
-      case "cck": // Fall through.
-      case "spck": {
+      case GECKO_CARDLOCK_NCK:
+      case GECKO_CARDLOCK_CCK: // Fall through.
+      case GECKO_CARDLOCK_SPCK: {
         let type = GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[options.lockType];
         this.enterDepersonalization(type, options.pin, options);
         break;
       }
-      case "nckPuk":
-      case "cckPuk": // Fall through.
-      case "spckPuk": {
+      case GECKO_CARDLOCK_NCK_PUK:
+      case GECKO_CARDLOCK_CCK_PUK: // Fall through.
+      case GECKO_CARDLOCK_SPCK_PUK: {
         let type = GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[options.lockType];
         this.enterDepersonalization(type, options.puk, options);
         break;
       }
       default:
         options.errorMsg = "Unsupported Card Lock.";
         options.success = false;
         this.sendChromeMessage(options);
@@ -1052,34 +1052,34 @@ let RIL = {
   },
 
   /**
    * Helper function for changing ICC locks.
    */
   iccSetCardLock: function iccSetCardLock(options) {
     if (options.newPin !== undefined) { // Change PIN lock.
       switch (options.lockType) {
-        case "pin":
+        case GECKO_CARDLOCK_PIN:
           this.changeICCPIN(options);
           break;
-        case "pin2":
+        case GECKO_CARDLOCK_PIN2:
           this.changeICCPIN2(options);
           break;
         default:
           options.errorMsg = "Unsupported Card Lock.";
           options.success = false;
           this.sendChromeMessage(options);
       }
     } else { // Enable/Disable lock.
       switch (options.lockType) {
-        case "pin":
+        case GECKO_CARDLOCK_PIN:
           options.facility = ICC_CB_FACILITY_SIM;
           options.password = options.pin;
           break;
-        case "fdn":
+        case GECKO_CARDLOCK_FDN:
           options.facility = ICC_CB_FACILITY_FDN;
           options.password = options.pin2;
           break;
         default:
           options.errorMsg = "Unsupported Card Lock.";
           options.success = false;
           this.sendChromeMessage(options);
           return;
@@ -1175,20 +1175,20 @@ let RIL = {
      Buf.sendParcel();
    },
 
   /**
    * Helper function for fetching the state of ICC locks.
    */
   iccGetCardLockState: function iccGetCardLockState(options) {
     switch (options.lockType) {
-      case "pin":
+      case GECKO_CARDLOCK_PIN:
         options.facility = ICC_CB_FACILITY_SIM;
         break;
-      case "fdn":
+      case GECKO_CARDLOCK_FDN:
         options.facility = ICC_CB_FACILITY_FDN;
         break;
       default:
         options.errorMsg = "Unsupported Card Lock.";
         options.success = false;
         this.sendChromeMessage(options);
         return;
     }