Commit 86ed590d authored by Edgar Chen's avatar Edgar Chen
Browse files

Bug 952043 - Part 3: RIL implementation for providing the network types...

Bug 952043 - Part 3: RIL implementation for providing the network types supported by platform. r=hsinyi
parent daf51e68
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -677,6 +677,12 @@ RILContentHelper.prototype = {
    return context && context.radioState;
  },

  getSupportedNetworkTypes: function(clientId) {
    return cpmm.sendSyncMessage("RIL:GetSupportedNetworkTypes", {
      clientId: clientId
    })[0];
  },

  /**
   * The networks that are currently trying to be selected (or "automatic").
   * This helps ensure that only one network per client is selected at a time.
+29 −1
Original line number Diff line number Diff line
@@ -115,7 +115,8 @@ const RIL_IPC_MOBILECONNECTION_MSG_NAMES = [
  "RIL:ExitEmergencyCbMode",
  "RIL:SetRadioEnabled",
  "RIL:SetVoicePrivacyMode",
  "RIL:GetVoicePrivacyMode"
  "RIL:GetVoicePrivacyMode",
  "RIL:GetSupportedNetworkTypes"
];

const RIL_IPC_MOBILENETWORK_MSG_NAMES = [
@@ -1112,6 +1113,8 @@ function RadioInterface(options) {
    byApn: {}
  };

  this.supportedNetworkTypes = this.getSupportedNetworkTypes();

  this.rilContext = {
    radioState:     RIL.GECKO_RADIOSTATE_UNAVAILABLE,
    detailedRadioState: null,
@@ -1248,6 +1251,26 @@ RadioInterface.prototype = {
    return false;
  },

  /**
   * A utility function to get supportedNetworkTypes from system property
   */
  getSupportedNetworkTypes: function() {
    let key = "ro.moz.ril." + this.clientId + ".network_types";
    let supportedNetworkTypes = libcutils.property_get(key, "").split(",");
    for (let type of supportedNetworkTypes) {
      // If the value in system property is not valid, use the default one which
      // is defined in ril_consts.js.
      if (RIL.GECKO_SUPPORTED_NETWORK_TYPES.indexOf(type) < 0) {
        this.debug("Unknown network type: " + type);
        supportedNetworkTypes =
          RIL.GECKO_SUPPORTED_NETWORK_TYPES_DEFAULT.split(",");
        break;
      }
    }
    if (DEBUG) this.debug("Supported Network Types: " + supportedNetworkTypes);
    return supportedNetworkTypes;
  },

  /**
   * Process a message from the content process.
   */
@@ -1374,6 +1397,9 @@ RadioInterface.prototype = {
      case "RIL:GetVoicePrivacyMode":
        this.workerMessenger.sendWithIPCMessage(msg, "queryVoicePrivacyMode");
        break;
      case "RIL:GetSupportedNetworkTypes":
        // This message is sync.
        return this.supportedNetworkTypes;
    }
    return null;
  },
@@ -2689,6 +2715,8 @@ RadioInterface.prototype = {
    }
  },

  supportedNetworkTypes: null,

  // Data calls setting.
  dataCallSettings: null,

+9 −0
Original line number Diff line number Diff line
@@ -424,6 +424,15 @@ this.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO = [
  GECKO_PREFERRED_NETWORK_TYPE_WCDMA_GSM_CDMA_EVDO
];

this.GECKO_SUPPORTED_NETWORK_TYPES_DEFAULT = "gsm,wcdma,cdma,evdo";
this.GECKO_SUPPORTED_NETWORK_TYPES = [
  "gsm",
  "wcdma",
  "cdma",
  "evdo",
  "lte"
];

// Network registration states. See TS 27.007 7.2
this.NETWORK_CREG_STATE_NOT_SEARCHING = 0;
this.NETWORK_CREG_STATE_REGISTERED_HOME = 1;