Bug 943191 - Part 2: Attach/detach data registration on demand (for fugu). r=hsinyi

This commit is contained in:
Jessica Jong 2013-12-20 15:56:35 -05:00
parent 80db7abfcd
commit 3e587e9184
3 changed files with 55 additions and 0 deletions

View File

@ -42,6 +42,10 @@ function debug(s) {
dump("-*- RadioInterfaceLayer: " + s + "\n");
}
// Ril quirk to attach data registration on demand.
let RILQUIRKS_DATA_REGISTRATION_ON_DEMAND =
libcutils.property_get("ro.moz.ril.data_reg_on_demand", "false") == "true";
const RADIOINTERFACELAYER_CID =
Components.ID("{2d831c8d-6017-435b-a80c-e5d422810cea}");
const RADIOINTERFACE_CID =
@ -751,6 +755,9 @@ RadioInterfaceLayer.prototype = {
this.radioInterfaces[this._currentDataClientId];
if (!oldRadioInterface.anyDataConnected() &&
typeof this._pendingDataCallRequest === "function") {
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
oldRadioInterface.setDataRegistration(false);
}
if (DEBUG) debug("All data calls disconnected, setup pending data call.");
this._pendingDataCallRequest();
this._pendingDataCallRequest = null;
@ -811,6 +818,10 @@ RadioInterfaceLayer.prototype = {
if (this._currentDataClientId == -1) {
// This is to handle boot up stage.
this._currentDataClientId = this._dataDefaultClientId;
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
let radioInterface = this.radioInterfaces[this._currentDataClientId];
radioInterface.setDataRegistration(true);
}
if (this._dataEnabled) {
let radioInterface = this.radioInterfaces[this._currentDataClientId];
radioInterface.dataCallSettings.oldEnabled =
@ -822,6 +833,12 @@ RadioInterfaceLayer.prototype = {
}
if (!this._dataEnabled) {
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
let oldRadioInterface = this.radioInterfaces[this._currentDataClientId];
let newRadioInterface = this.radioInterfaces[this._dataDefaultClientId];
oldRadioInterface.setDataRegistration(false);
newRadioInterface.setDataRegistration(true);
}
this._currentDataClientId = this._dataDefaultClientId;
return;
}
@ -835,6 +852,9 @@ RadioInterfaceLayer.prototype = {
this._pendingDataCallRequest = function () {
if (DEBUG) debug("Executing pending data call request.");
let newRadioInterface = this.radioInterfaces[this._dataDefaultClientId];
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
newRadioInterface.setDataRegistration(true);
}
newRadioInterface.dataCallSettings.oldEnabled =
newRadioInterface.dataCallSettings.enabled;
newRadioInterface.dataCallSettings.enabled = this._dataEnabled;
@ -857,6 +877,10 @@ RadioInterfaceLayer.prototype = {
newRadioInterface.dataCallSettings.enabled = true;
this._currentDataClientId = this._dataDefaultClientId;
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND) {
oldRadioInterface.setDataRegistration(false);
newRadioInterface.setDataRegistration(true);
}
newRadioInterface.updateRILNetworkInterface();
},
@ -1970,6 +1994,10 @@ RadioInterface.prototype = {
apnSetting.types.length);
},
setDataRegistration: function setDataRegistration(attach) {
this.workerMessenger.send("setDataRegistration", {attach: attach});
},
updateRILNetworkInterface: function updateRILNetworkInterface() {
let apnSetting = this.apnSettings.byType.default;
if (!this.validateApnSetting(apnSetting)) {

View File

@ -152,6 +152,10 @@ this.REQUEST_MODIFY_QOS = 118;
this.REQUEST_SUSPEND_QOS = 119;
this.REQUEST_RESUME_QOS = 120;
// Fugu specific parcel types.
this.RIL_REQUEST_GPRS_ATTACH = 5018;
this.RIL_REQUEST_GPRS_DETACH = 5019;
// UICC Secure Access
this.REQUEST_SIM_OPEN_CHANNEL = 121;
this.REQUEST_SIM_CLOSE_CHANNEL = 122;

View File

@ -88,6 +88,10 @@ let RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT = libcutils.property_get("ro.moz.r
// Ril quirk to Send STK Profile Download
let RILQUIRKS_SEND_STK_PROFILE_DOWNLOAD = libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true";
// Ril quirk to attach data registration on demand.
let RILQUIRKS_DATA_REGISTRATION_ON_DEMAND =
libcutils.property_get("ro.moz.ril.data_reg_on_demand", "false") == "true";
// Marker object.
let PENDING_NETWORK_TYPE = {};
@ -1897,6 +1901,20 @@ let RIL = {
Buf.simpleRequest(REQUEST_DATA_CALL_LIST);
},
_attachDataRegistration: false,
/**
* Manually attach/detach data registration.
*
* @param attach
* Boolean value indicating attach or detach.
*/
setDataRegistration: function setDataRegistration(options) {
let request = options.attach ? RIL_REQUEST_GPRS_ATTACH :
RIL_REQUEST_GPRS_DETACH;
this._attachDataRegistration = options.attach;
Buf.simpleRequest(request);
},
/**
* Get failure casue code for the most recently failed PDP context.
*/
@ -6063,6 +6081,8 @@ RIL[REQUEST_GET_UNLOCK_RETRY_COUNT] = function REQUEST_GET_UNLOCK_RETRY_COUNT(le
options.retryCount = length ? Buf.readInt32List()[0] : -1;
this.sendChromeMessage(options);
};
RIL[RIL_REQUEST_GPRS_ATTACH] = null;
RIL[RIL_REQUEST_GPRS_DETACH] = null;
RIL[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED() {
let radioState = Buf.readInt32();
@ -6130,6 +6150,9 @@ RIL[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLICITED_RESPONSE_RA
this.updateCellBroadcastConfig();
this.setPreferredNetworkType();
this.setCLIR();
if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND && this._attachDataRegistration) {
this.setDataRegistration({attach: true});
}
}
this.radioState = newState;