From e005fb06f8ad707fe823a62bdcdb1174317d482d Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Fri, 10 Jul 2015 15:27:38 +0800 Subject: [PATCH] Bug 1159591 - Part 12: Move radio check for MMI to a common place. r=aknow --- dom/telephony/gonk/TelephonyService.js | 35 ++++---------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/dom/telephony/gonk/TelephonyService.js b/dom/telephony/gonk/TelephonyService.js index 7091183097c..9b5b33ecc98 100644 --- a/dom/telephony/gonk/TelephonyService.js +++ b/dom/telephony/gonk/TelephonyService.js @@ -1005,6 +1005,11 @@ TelephonyService.prototype = { aCallback.notifyDialMMI(mmiServiceCode); + if (mmiServiceCode !== RIL.MMI_KS_SC_IMEI && !this._isRadioOn(aClientId)) { + aCallback.notifyDialMMIError(DIAL_ERROR_RADIO_NOT_AVAILABLE); + return; + } + // We check if the MMI service code is supported and in that case we // trigger the appropriate RIL request if possible. switch (mmiServiceCode) { @@ -1059,11 +1064,6 @@ TelephonyService.prototype = { // Handle unknown MMI code as USSD. default: - if (!this._isRadioOn(aClientId)) { - aCallback.notifyDialMMIError(RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE); - return; - } - this._sendUSSDInternal(aClientId, aMmi.fullMMI, aResponse => { if (aResponse.errorMsg) { aCallback.notifyDialMMIError(aResponse.errorMsg); @@ -1087,11 +1087,6 @@ TelephonyService.prototype = { * A nsITelephonyDialCallback object. */ _callForwardingMMI: function(aClientId, aMmi, aCallback) { - if (!this._isRadioOn(aClientId)) { - aCallback.notifyDialMMIError(RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE); - return; - } - let connection = gGonkMobileConnectionService.getItemByServiceId(aClientId); let action = MMI_PROC_TO_CF_ACTION[aMmi.procedure]; let reason = MMI_SC_TO_CF_REASON[aMmi.serviceCode]; @@ -1135,11 +1130,6 @@ TelephonyService.prototype = { * A nsITelephonyDialCallback object. */ _iccChangeLockMMI: function(aClientId, aMmi, aCallback) { - if (!this._isRadioOn(aClientId)) { - aCallback.notifyDialMMIError(RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE); - return; - } - let errorMsg = this._getIccLockMMIError(aMmi); if (errorMsg) { aCallback.notifyDialMMIError(errorMsg); @@ -1181,11 +1171,6 @@ TelephonyService.prototype = { * A nsITelephonyDialCallback object. */ _iccUnlockMMI: function(aClientId, aMmi, aCallback) { - if (!this._isRadioOn(aClientId)) { - aCallback.notifyDialMMIError(RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE); - return; - } - let errorMsg = this._getIccLockMMIError(aMmi); if (errorMsg) { aCallback.notifyDialMMIError(errorMsg); @@ -1405,11 +1390,6 @@ TelephonyService.prototype = { * A nsITelephonyDialCallback object. */ _callBarringPasswordMMI: function(aClientId, aMmi, aCallback) { - if (!this._isRadioOn(aClientId)) { - aCallback.notifyDialMMIError(RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE); - return; - } - if (aMmi.procedure !== MMI_PROCEDURE_REGISTRATION && aMmi.procedure !== MMI_PROCEDURE_ACTIVATION) { aCallback.notifyDialMMIError(MMI_ERROR_KS_INVALID_ACTION); @@ -1514,11 +1494,6 @@ TelephonyService.prototype = { * A nsITelephonyDialCallback object. */ _callWaitingMMI: function(aClientId, aMmi, aCallback) { - if (!this._isRadioOn(aClientId)) { - aCallback.notifyDialMMIError(RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE); - return; - } - let connection = gGonkMobileConnectionService.getItemByServiceId(aClientId); switch (aMmi.procedure) {