Bug 868934 - Support selecting authentication type for data call. r=hsinyi
authorEdgar Chen <echen@mozilla.com>
Mon, 06 May 2013 16:58:56 +0800
changeset 145981 66ef353a2fbc0eda7718643ef4c2f3e01e273988
parent 145980 8a05d7dc509f1d5c2518a26d36b6ad6f8447f2a9
child 145982 a7c70ff62b83aa50406c3460e5a029f8148e53e5
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi
bugs868934
milestone24.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 868934 - Support selecting authentication type for data call. r=hsinyi
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/ril_consts.js
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -307,40 +307,44 @@ function RadioInterfaceLayer() {
 
   // Read preferred network type from the setting DB.
   lock.get("ril.radio.preferredNetworkType", this);
 
   // Read the APN data from the settings DB.
   lock.get("ril.data.apn", this);
   lock.get("ril.data.user", this);
   lock.get("ril.data.passwd", this);
+  lock.get("ril.data.authtype", this);
   lock.get("ril.data.httpProxyHost", this);
   lock.get("ril.data.httpProxyPort", this);
   lock.get("ril.data.roaming_enabled", this);
   lock.get("ril.data.enabled", this);
   this._dataCallSettingsToRead = ["ril.data.enabled",
                                   "ril.data.roaming_enabled",
                                   "ril.data.apn",
                                   "ril.data.user",
                                   "ril.data.passwd",
+                                  "ril.data.authtype",
                                   "ril.data.httpProxyHost",
                                   "ril.data.httpProxyPort"];
 
   // Read secondary APNs from the settings DB.
   lock.get("ril.mms.apn", this);
   lock.get("ril.mms.user", this);
   lock.get("ril.mms.passwd", this);
+  lock.get("ril.mms.authtype", this);
   lock.get("ril.mms.httpProxyHost", this);
   lock.get("ril.mms.httpProxyPort", this);
   lock.get("ril.mms.mmsc", this);
   lock.get("ril.mms.mmsproxy", this);
   lock.get("ril.mms.mmsport", this);
   lock.get("ril.supl.apn", this);
   lock.get("ril.supl.user", this);
   lock.get("ril.supl.passwd", this);
+  lock.get("ril.supl.authtype", this);
   lock.get("ril.supl.httpProxyHost", this);
   lock.get("ril.supl.httpProxyPort", this);
 
   // Read the 'time.nitz.automatic-update.enabled' setting to see if
   // we need to adjust the system clock time and time zone by NITZ.
   lock.get(kTimeNitzAutomaticUpdateEnabled, this);
 
   // Set "time.nitz.available" to false when starting up.
@@ -2071,41 +2075,44 @@ RadioInterfaceLayer.prototype = {
         break;
       case "ril.data.enabled":
         this._oldRilDataEnabledState = this.dataCallSettings.enabled;
         // Fall through.
       case "ril.data.roaming_enabled":
       case "ril.data.apn":
       case "ril.data.user":
       case "ril.data.passwd":
+      case "ril.data.authtype":
       case "ril.data.httpProxyHost":
       case "ril.data.httpProxyPort":
         let key = aName.slice(9);
         this.dataCallSettings[key] = aResult;
         debug("'" + aName + "'" + " is now " + this.dataCallSettings[key]);
         let index = this._dataCallSettingsToRead.indexOf(aName);
         if (index != -1) {
           this._dataCallSettingsToRead.splice(index, 1);
         }
         this.updateRILNetworkInterface();
         break;
       case "ril.mms.apn":
       case "ril.mms.user":
       case "ril.mms.passwd":
+      case "ril.mms.authtype":
       case "ril.mms.httpProxyHost":
       case "ril.mms.httpProxyPort":
       case "ril.mms.mmsc":
       case "ril.mms.mmsproxy":
       case "ril.mms.mmsport":
         key = aName.slice(8);
         this.dataCallSettingsMMS[key] = aResult;
         break;
       case "ril.supl.apn":
       case "ril.supl.user":
       case "ril.supl.passwd":
+      case "ril.supl.authtype":
       case "ril.supl.httpProxyHost":
       case "ril.supl.httpProxyPort":
         key = aName.slice(9);
         this.dataCallSettingsSUPL[key] = aResult;
         break;
       case kTimeNitzAutomaticUpdateEnabled:
         this._nitzAutomaticUpdateEnabled = aResult;
 
@@ -3204,21 +3211,29 @@ RILNetworkInterface.prototype = {
     }
 
     this.httpProxyHost = this.dataCallSettings.httpProxyHost;
     this.httpProxyPort = this.dataCallSettings.httpProxyPort;
 
     debug("Going to set up data connection with APN " + this.dataCallSettings.apn);
     let radioTechType = this.mRIL.rilContext.data.type;
     let radioTechnology = RIL.GECKO_RADIO_TECH.indexOf(radioTechType);
+    let authType = RIL.RIL_DATACALL_AUTH_TO_GECKO.indexOf(this.dataCallSettings["authtype"]);
+    // Use the default authType if the value in database is invalid.
+    // For the case that user might not select the authentication type.
+    if (authType == -1) {
+      debug("Invalid authType " + this.dataCallSettings["authtype"]);
+      authType = RIL.RIL_DATACALL_AUTH_TO_GECKO.indexOf(RIL.GECKO_DATACALL_AUTH_DEFAULT);
+    }
     this.mRIL.setupDataCall(radioTechnology,
                             this.dataCallSettings.apn,
                             this.dataCallSettings.user,
                             this.dataCallSettings.passwd,
-                            RIL.DATACALL_AUTH_PAP_OR_CHAP, "IP");
+                            authType,
+                            "IP");
     this.connecting = true;
   },
 
   reset: function reset() {
     let apnRetryTimer;
     this.connecting = false;
     // We will retry the connection in increasing times
     // based on the function: time = A * numer_of_retries^2 + B
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -2159,16 +2159,28 @@ this.RADIOTECH_FAMILY_3GPP2 = 2; // CDMA
 this.DATACALL_RADIOTECHNOLOGY_CDMA = 0;
 this.DATACALL_RADIOTECHNOLOGY_GSM = 1;
 
 this.DATACALL_AUTH_NONE = 0;
 this.DATACALL_AUTH_PAP = 1;
 this.DATACALL_AUTH_CHAP = 2;
 this.DATACALL_AUTH_PAP_OR_CHAP = 3;
 
+this.GECKO_DATACALL_AUTH_NONE = "none";
+this.GECKO_DATACALL_AUTH_PAP = "pap";
+this.GECKO_DATACALL_AUTH_CHAP = "chap";
+this.GECKO_DATACALL_AUTH_PAP_OR_CHAP = "papOrChap";
+this.GECKO_DATACALL_AUTH_DEFAULT = GECKO_DATACALL_AUTH_PAP_OR_CHAP;
+this.RIL_DATACALL_AUTH_TO_GECKO = [
+  GECKO_DATACALL_AUTH_NONE,         // DATACALL_AUTH_NONE
+  GECKO_DATACALL_AUTH_PAP,          // DATACALL_AUTH_PAP
+  GECKO_DATACALL_AUTH_CHAP,         // DATACALL_AUTH_CHAP
+  GECKO_DATACALL_AUTH_PAP_OR_CHAP   // DATACALL_AUTH_PAP_OR_CHAP
+];
+
 this.DATACALL_PROFILE_DEFAULT = 0;
 this.DATACALL_PROFILE_TETHERED = 1;
 this.DATACALL_PROFILE_OEM_BASE = 1000;
 
 this.DATACALL_DEACTIVATE_NO_REASON = 0;
 this.DATACALL_DEACTIVATE_RADIO_SHUTDOWN = 1;
 
 this.DATACALL_ACTIVE_UNKNOWN = -1;