Bug 900429 - Part 1: Add personalization state and lock type for CDMA. r=allstars.chh
authorEdgar Chen <echen@mozilla.com>
Thu, 20 Feb 2014 14:00:56 +0800
changeset 170505 da3d36e5822720caa19b1080dccb65100a760eb8
parent 170504 4ccc1189e7ecd8da084229e680ddacf3bcfc358a
child 170506 5d5f8561858860dccfe6066bf30c0677d97f87e1
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersallstars
bugs900429
milestone30.0a1
Bug 900429 - Part 1: Add personalization state and lock type for CDMA. r=allstars.chh
dom/system/gonk/ril_consts.js
dom/system/gonk/ril_worker.js
dom/webidl/MozIcc.webidl
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -2437,61 +2437,105 @@ this.GECKO_CARDSTATE_UNDETECTED         
 this.GECKO_CARDSTATE_ILLEGAL                       = "illegal";
 this.GECKO_CARDSTATE_UNKNOWN                       = "unknown";
 this.GECKO_CARDSTATE_PIN_REQUIRED                  = "pinRequired";
 this.GECKO_CARDSTATE_PUK_REQUIRED                  = "pukRequired";
 this.GECKO_CARDSTATE_PERSONALIZATION_IN_PROGRESS   = "personalizationInProgress";
 this.GECKO_CARDSTATE_PERSONALIZATION_READY         = "personalizationReady";
 this.GECKO_CARDSTATE_NETWORK_LOCKED                = "networkLocked";
 this.GECKO_CARDSTATE_NETWORK_SUBSET_LOCKED         = "networkSubsetLocked";
+this.GECKO_CARDSTATE_NETWORK1_LOCKED               = "network1Locked";
+this.GECKO_CARDSTATE_NETWORK2_LOCKED               = "network2Locked";
+this.GECKO_CARDSTATE_HRPD_NETWORK_LOCKED           = "hrpdNetworkLocked";
 this.GECKO_CARDSTATE_CORPORATE_LOCKED              = "corporateLocked";
 this.GECKO_CARDSTATE_SERVICE_PROVIDER_LOCKED       = "serviceProviderLocked";
 this.GECKO_CARDSTATE_SIM_LOCKED                    = "simPersonalizationLock";
+this.GECKO_CARDSTATE_RUIM_CORPORATE_LOCKED         = "ruimCorporateLocked";
+this.GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_LOCKED  = "ruimServiceProviderLocked";
+this.GECKO_CARDSTATE_RUIM_LOCKED                   = "ruimPersonalizationLock";
 this.GECKO_CARDSTATE_NETWORK_PUK_REQUIRED          = "networkPukRequired";
 this.GECKO_CARDSTATE_NETWORK_SUBSET_PUK_REQUIRED   = "networkSubsetPukRequired";
+this.GECKO_CARDSTATE_NETWORK1_PUK_REQUIRED         = "network1PukRequired";
+this.GECKO_CARDSTATE_NETWORK2_PUK_REQUIRED         = "network2PukRequired";
+this.GECKO_CARDSTATE_HRPD_NETWORK_PUK_REQUIRED     = "hrpdNetworkPukRequired";
 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_RUIM_CORPORATE_PUK_REQUIRED   = "ruimCorporatePukRequired";
+this.GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED = "ruimServiceProviderPukRequired";
+this.GECKO_CARDSTATE_RUIM_PUK_REQUIRED             = "ruimPersonalizationPukRequired";
 this.GECKO_CARDSTATE_READY                         = "ready";
 this.GECKO_CARDSTATE_PERMANENT_BLOCKED             = "permanentBlocked";
 
 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_NCK1     = "nck1";
+this.GECKO_CARDLOCK_NCK2     = "nck2";
+this.GECKO_CARDLOCK_HNCK     = "hnck";
 this.GECKO_CARDLOCK_CCK      = "cck";
 this.GECKO_CARDLOCK_SPCK     = "spck";
+this.GECKO_CARDLOCK_RCCK     = "rcck";
+this.GECKO_CARDLOCK_RSPCK    = "rspck";
 this.GECKO_CARDLOCK_NCK_PUK  = "nckPuk";
+this.GECKO_CARDLOCK_NCK1_PUK = "nck1Puk";
+this.GECKO_CARDLOCK_NCK2_PUK = "nck2Puk";
+this.GECKO_CARDLOCK_HNCK_PUK = "hnckPuk";
 this.GECKO_CARDLOCK_CCK_PUK  = "cckPuk";
 this.GECKO_CARDLOCK_SPCK_PUK = "spckPuk";
+this.GECKO_CARDLOCK_RCCK_PUK = "rcckPuk";
+this.GECKO_CARDLOCK_RSPCK_PUK = "rspckPuk";
 
 // 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_READY] = GECKO_CARDSTATE_PERSONALIZATION_READY;
 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_RUIM_NETWORK1] = GECKO_CARDSTATE_NETWORK1_LOCKED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_NETWORK2] = GECKO_CARDSTATE_NETWORK2_LOCKED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_HRPD] = GECKO_CARDSTATE_HRPD_NETWORK_LOCKED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_CORPORATE] = GECKO_CARDSTATE_RUIM_CORPORATE_LOCKED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER] = GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_LOCKED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_RUIM] = GECKO_CARDSTATE_RUIM_LOCKED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_NETWORK1_PUK] = GECKO_CARDSTATE_NETWORK1_PUK_REQUIRED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_NETWORK2_PUK] = GECKO_CARDSTATE_NETWORK2_PUK_REQUIRED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_HRPD_PUK] = GECKO_CARDSTATE_HRPD_NETWORK_PUK_REQUIRED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_CORPORATE_PUK] = GECKO_CARDSTATE_RUIM_CORPORATE_PUK_REQUIRED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK] = GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED;
+PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_RUIM_PUK] = GECKO_CARDSTATE_RUIM_PUK_REQUIRED;
 
 this.GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK = {};
 GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK] = CARD_PERSOSUBSTATE_SIM_NETWORK;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK1] = CARD_PERSOSUBSTATE_RUIM_NETWORK1;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK2] = CARD_PERSOSUBSTATE_RUIM_NETWORK2;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_HNCK] = CARD_PERSOSUBSTATE_RUIM_HRPD;
 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_RCCK] = CARD_PERSOSUBSTATE_RUIM_CORPORATE;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_RSPCK] = CARD_PERSOSUBSTATE_RUIM_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_NCK1_PUK] = CARD_PERSOSUBSTATE_RUIM_NETWORK1_PUK;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_NCK2_PUK] = CARD_PERSOSUBSTATE_RUIM_NETWORK2_PUK;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_HNCK_PUK] = CARD_PERSOSUBSTATE_RUIM_HRPD_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;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_RCCK_PUK] = CARD_PERSOSUBSTATE_RUIM_CORPORATE_PUK;
+GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[GECKO_CARDLOCK_RSPCK_PUK] = CARD_PERSOSUBSTATE_RUIM_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
@@ -482,25 +482,35 @@ RilObject.prototype = {
         break;
       case GECKO_CARDLOCK_PUK:
         this.enterICCPUK(options);
         break;
       case GECKO_CARDLOCK_PUK2:
         this.enterICCPUK2(options);
         break;
       case GECKO_CARDLOCK_NCK:
-      case GECKO_CARDLOCK_CCK: // Fall through.
-      case GECKO_CARDLOCK_SPCK: {
+      case GECKO_CARDLOCK_NCK1:
+      case GECKO_CARDLOCK_NCK2:
+      case GECKO_CARDLOCK_HNCK:
+      case GECKO_CARDLOCK_CCK:
+      case GECKO_CARDLOCK_SPCK:
+      case GECKO_CARDLOCK_RCCK: // Fall through.
+      case GECKO_CARDLOCK_RSPCK: {
         let type = GECKO_PERSO_LOCK_TO_CARD_PERSO_LOCK[options.lockType];
         this.enterDepersonalization(type, options.pin, options);
         break;
       }
       case GECKO_CARDLOCK_NCK_PUK:
-      case GECKO_CARDLOCK_CCK_PUK: // Fall through.
-      case GECKO_CARDLOCK_SPCK_PUK: {
+      case GECKO_CARDLOCK_NCK1_PUK:
+      case GECKO_CARDLOCK_NCK2_PUK:
+      case GECKO_CARDLOCK_HNCK_PUK:
+      case GECKO_CARDLOCK_CCK_PUK:
+      case GECKO_CARDLOCK_SPCK_PUK:
+      case GECKO_CARDLOCK_RCCK_PUK: // Fall through.
+      case GECKO_CARDLOCK_RSPCK_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);
--- a/dom/webidl/MozIcc.webidl
+++ b/dom/webidl/MozIcc.webidl
@@ -24,21 +24,25 @@ interface MozIcc : EventTarget
    */
   attribute EventHandler oniccinfochange;
 
   // Integrated Circuit Card State.
 
   /**
    * Indicates the state of the device's ICC.
    *
-   * Possible values: 'illegal', 'unknown', 'pinRequired',
-   * 'pukRequired', 'personalizationInProgress', 'networkLocked',
-   * 'corporateLocked', 'serviceProviderLocked', 'networkPukRequired',
-   * 'corporatePukRequired', 'serviceProviderPukRequired',
-   * 'personalizationReady', 'ready', 'permanentBlocked'.
+   * Possible values: 'illegal', 'unknown', 'pinRequired', 'pukRequired',
+   * 'personalizationInProgress', 'networkLocked', 'network1Locked',
+   * 'network2Locked', 'hrpdNetworkLocked', 'corporateLocked',
+   * 'serviceProviderLocked', 'ruimCorporateLocked', 'ruimServiceProviderLocked',
+   * 'networkPukRequired', 'network1PukRequired', 'network2PukRequired',
+   * 'hrpdNetworkPukRequired', 'corporatePukRequired',
+   * 'serviceProviderPukRequired', 'ruimCorporatePukRequired',
+   * 'ruimServiceProviderPukRequired', 'personalizationReady', 'ready',
+   * 'permanentBlocked'.
    *
    * Once the ICC becomes undetectable, cardstatechange event will be notified.
    * Also, the attribute is set to null and this MozIcc object becomes invalid.
    * Calling asynchronous functions raises exception then.
    */
   readonly attribute DOMString? cardState;
 
   /**
@@ -154,44 +158,104 @@ interface MozIcc : EventTarget
    *                   puk: "...",
    *                   newPin: "..."});
    *
    * (3) Network depersonalization. Unlocking the network control key (NCK).
    *
    *   unlockCardLock({lockType: "nck",
    *                   pin: "..."});
    *
-   * (4) Corporate depersonalization. Unlocking the corporate control key (CCK).
+   * (4) Network type 1 depersonalization. Unlocking the network type 1 control
+   *     key (NCK1).
+   *
+   *   unlockCardLock({lockType: "nck1",
+   *                   pin: "..."});
+   *
+   * (5) Network type 2 depersonalization. Unlocking the network type 2 control
+   *     key (NCK2).
+   *
+   *   unlockCardLock({lockType: "nck2",
+   *                   pin: "..."});
+   *
+   * (6) HRPD network depersonalization. Unlocking the HRPD network control key
+   *     (HNCK).
+   *
+   *   unlockCardLock({lockType: "hnck",
+   *                   pin: "..."});
+   *
+   * (7) Corporate depersonalization. Unlocking the corporate control key (CCK).
    *
    *   unlockCardLock({lockType: "cck",
    *                   pin: "..."});
    *
-   * (5) Service Provider depersonalization. Unlocking the service provider
+   * (8) Service provider depersonalization. Unlocking the service provider
    *     control key (SPCK).
    *
    *   unlockCardLock({lockType: "spck",
    *                   pin: "..."});
    *
-   * (6) Network PUK depersonalization. Unlocking the network control key (NCK).
+   * (9) RUIM corporate depersonalization. Unlocking the RUIM corporate control
+   *     key (RCCK).
+   *
+   *   unlockCardLock({lockType: "rcck",
+   *                   pin: "..."});
+   *
+   * (10) RUIM service provider depersonalization. Unlocking the RUIM service
+   *      provider control key (RSPCK).
+   *
+   *   unlockCardLock({lockType: "rspck",
+   *                   pin: "..."});
+   *
+   * (11) Network PUK depersonalization. Unlocking the network control key (NCK).
    *
    *   unlockCardLock({lockType: "nckPuk",
    *                   puk: "..."});
    *
-   * (7) Corporate PUK depersonalization. Unlocking the corporate control key
-   *     (CCK).
+   * (12) Network type 1 PUK depersonalization. Unlocking the network type 1
+   *      control key (NCK1).
+   *
+   *   unlockCardLock({lockType: "nck1Puk",
+   *                   pin: "..."});
+   *
+   * (13) Network type 2 PUK depersonalization. Unlocking the Network type 2
+   *      control key (NCK2).
+   *
+   *   unlockCardLock({lockType: "nck2Puk",
+   *                   pin: "..."});
+   *
+   * (14) HRPD network PUK depersonalization. Unlocking the HRPD network control
+   *      key (HNCK).
+   *
+   *   unlockCardLock({lockType: "hnckPuk",
+   *                   pin: "..."});
+   *
+   * (15) Corporate PUK depersonalization. Unlocking the corporate control key
+   *      (CCK).
    *
    *   unlockCardLock({lockType: "cckPuk",
    *                   puk: "..."});
    *
-   * (8) Service Provider PUK depersonalization. Unlocking the service provider
-   *     control key (SPCK).
+   * (16) Service provider PUK depersonalization. Unlocking the service provider
+   *      control key (SPCK).
    *
    *   unlockCardLock({lockType: "spckPuk",
    *                   puk: "..."});
    *
+   * (17) RUIM corporate PUK depersonalization. Unlocking the RUIM corporate
+   *      control key (RCCK).
+   *
+   *   unlockCardLock({lockType: "rcckPuk",
+   *                   puk: "..."});
+   *
+   * (18) RUIM service provider PUK depersonalization. Unlocking the service
+   *      provider control key (SPCK).
+   *
+   *   unlockCardLock({lockType: "rspckPuk",
+   *                   puk: "..."});
+   *
    * @return a DOMRequest.
    *         The request's result will be an object containing
    *         information about the unlock operation.
    *
    * Examples:
    *
    * (1) Unlocking failed:
    *