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),
RADIO_POWER_OFF_TIMEOUT, Ci.nsITimer.TYPE_ONE_SHOT);
this._radioOffAfterDataDisconnected = true;
return;
}
this.setRadioEnabled(false);
@ -2004,7 +2005,7 @@ RadioInterface.prototype = {
// Process pending radio power off request after all data calls
// are disconnected.
if (datacall.state == RIL.GECKO_NETWORK_STATE_UNKNOWN &&
this._changingRadioPower) {
this._radioOffAfterDataDisconnected) {
let anyDataConnected = false;
for each (let apnSetting in this.apnSettings.byApn) {
for each (let type in apnSetting.types) {
@ -2019,6 +2020,7 @@ RadioInterface.prototype = {
}
if (!anyDataConnected) {
if (DEBUG) this.debug("All data connections are disconnected, set radio off.");
this._radioOffAfterDataDisconnected = false;
this._cancelRadioOffTimer();
this.setRadioEnabled(false);
}
@ -2282,6 +2284,10 @@ RadioInterface.prototype = {
// the radio power.
_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.
dataCallSettings: null,