Bug 935537 - Fix powerOffRadioSafely. r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2013-11-20 11:14:43 -05:00
Родитель 25dc7d87e2
Коммит c17a6f573b
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -1562,6 +1562,7 @@ RadioInterface.prototype = {
} }
this._radioOffTimer.initWithCallback(this._fireRadioOffTimer.bind(this), this._radioOffTimer.initWithCallback(this._fireRadioOffTimer.bind(this),
RADIO_POWER_OFF_TIMEOUT, Ci.nsITimer.TYPE_ONE_SHOT); RADIO_POWER_OFF_TIMEOUT, Ci.nsITimer.TYPE_ONE_SHOT);
this._radioOffAfterDataDisconnected = true;
return; return;
} }
this.setRadioEnabled(false); this.setRadioEnabled(false);
@ -2004,7 +2005,7 @@ RadioInterface.prototype = {
// Process pending radio power off request after all data calls // Process pending radio power off request after all data calls
// are disconnected. // are disconnected.
if (datacall.state == RIL.GECKO_NETWORK_STATE_UNKNOWN && if (datacall.state == RIL.GECKO_NETWORK_STATE_UNKNOWN &&
this._changingRadioPower) { this._radioOffAfterDataDisconnected) {
let anyDataConnected = false; let anyDataConnected = false;
for each (let apnSetting in this.apnSettings.byApn) { for each (let apnSetting in this.apnSettings.byApn) {
for each (let type in apnSetting.types) { for each (let type in apnSetting.types) {
@ -2019,6 +2020,7 @@ RadioInterface.prototype = {
} }
if (!anyDataConnected) { if (!anyDataConnected) {
if (DEBUG) this.debug("All data connections are disconnected, set radio off."); if (DEBUG) this.debug("All data connections are disconnected, set radio off.");
this._radioOffAfterDataDisconnected = false;
this._cancelRadioOffTimer(); this._cancelRadioOffTimer();
this.setRadioEnabled(false); this.setRadioEnabled(false);
} }
@ -2282,6 +2284,10 @@ RadioInterface.prototype = {
// the radio power. // the radio power.
_changingRadioPower: false, _changingRadioPower: false,
// Flag to determine if we need to set radio off when we are notified a data
// call has been disconnected.
_radioOffAfterDataDisconnected: false,
// Data calls setting. // Data calls setting.
dataCallSettings: null, dataCallSettings: null,