This commit is contained in:
Phil Ringnalda 2013-06-30 16:45:45 -07:00
Родитель 69bf1bf3f6 95ac483c08
Коммит 1790cc89d5
3 изменённых файлов: 121 добавлений и 42 удалений

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

@ -1566,43 +1566,37 @@ RILContentHelper.prototype = {
let success = message.success;
let result = {
serviceCode: message.mmiServiceCode
};
switch (message.mmiServiceCode) {
case RIL.MMI_KS_SC_IMEI:
// We expect to have an IMEI at this point, so getting a successful
// reply from the RIL without containing an actual IMEI number is
// considered an error.
if (success && message.result) {
result.statusMessage = message.result;
} else {
result.name = message.errorMsg ?
message.errorMsg : RIL.GECKO_ERROR_GENERIC_FAILURE;
success = false;
}
break;
case RIL.MMI_KS_SC_PIN:
case RIL.MMI_KS_SC_PIN2:
case RIL.MMI_KS_SC_PUK:
case RIL.MMI_KS_SC_PUK2:
// TODO: Bug 874000: Use MMIResult for PIN/PIN2/PUK related
// functionality.
break;
case RIL.MMI_KS_SC_CALL_FORWARDING:
// TODO: Bug 884343 - Use MMIResult for Call Forwarding related
// functionality.
break;
// We expect to have an IMEI at this point if the request was supposed
// to query for the IMEI, so getting a successful reply from the RIL
// without containing an actual IMEI number is considered an error.
if (message.mmiServiceCode === RIL.MMI_KS_SC_IMEI &&
!message.statusMessage) {
message.errorMsg = message.errorMsg ?
message.errorMsg : RIL.GECKO_ERROR_GENERIC_FAILURE;
success = false;
}
// MMI query call forwarding options request returns a set of rules that
// will be exposed in the form of an array of nsIDOMMozMobileCFInfo
// instances.
if (message.mmiServiceCode === RIL.MMI_KS_SC_CALL_FORWARDING &&
message.additionalInformation) {
this._cfRulesToMobileCfInfo(message.additionalInformation);
}
let result = {
serviceCode: message.mmiServiceCode,
additionalInformation: message.additionalInformation
};
if (success) {
result.statusMessage = message.statusMessage;
let mmiResult = new DOMMMIResult(result);
Services.DOMRequest.fireSuccess(request, mmiResult);
} else {
let mmiError = new this._window.DOMMMIError(result.serviceCode,
result.name,
result.message,
message.errorMsg,
null,
result.additionalInformation);
Services.DOMRequest.fireDetailedError(request, mmiError);
}

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

@ -2555,6 +2555,22 @@ this.MMI_ERROR_KS_ERROR = "emMmiError";
this.MMI_ERROR_KS_NOT_SUPPORTED = "emMmiErrorNotSupported";
this.MMI_ERROR_KS_INVALID_ACTION = "emMmiErrorInvalidAction";
this.MMI_ERROR_KS_MISMATCH_PIN = "emMmiErrorMismatchPin";
this.MMI_ERROR_KS_BAD_PIN = "emMmiErrorBadPin";
this.MMI_ERROR_KS_BAD_PUK = "emMmiErrorBadPuk";
this.MMI_ERROR_KS_INVALID_PIN = "emMmiErrorInvalidPin";
this.MMI_ERROR_KS_NEEDS_PUK = "emMmiErrorNeedsPuk";
this.MMI_ERROR_KS_SIM_BLOCKED = "emMmiErrorSimBlocked";
// MMI status message.
this.MMI_SM_KS_PIN_CHANGED = "smPinChanged";
this.MMI_SM_KS_PIN2_CHANGED = "smPin2Changed";
this.MMI_SM_KS_PIN_UNBLOCKED = "smPinUnblocked";
this.MMI_SM_KS_PIN2_UNBLOCKED = "smPin2Unblocked";
this.MMI_SM_KS_SERVICE_ENABLED = "smServiceEnabled";
this.MMI_SM_KS_SERVICE_DISABLED = "smServiceDisabled";
this.MMI_SM_KS_SERVICE_REGISTERED = "smServiceRegistered";
this.MMI_SM_KS_SERVICE_ERASED = "smServiceErased";
this.MMI_SM_KS_SERVICE_INTERROGATED = "smServiceInterrogated";
/**
* CDMA PDU constants

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

@ -2184,6 +2184,7 @@ let RIL = {
let mmi = this._parseMMI(mmiString);
let _sendMMIError = (function _sendMMIError(errorMsg, mmiServiceCode) {
options.success = false;
options.rilMessageType = "sendMMI";
options.errorMsg = errorMsg;
if (mmiServiceCode) {
@ -2211,6 +2212,13 @@ let RIL = {
return;
}
if (mmi.sia.length < 4 || mmi.sia.length > 8 ||
mmi.sib.length < 4 || mmi.sib.length > 8 ||
mmi.sic.length < 4 || mmi.sic.length > 8) {
_sendMMIError(MMI_ERROR_KS_INVALID_PIN, mmiServiceCode);
return;
}
return true;
}
@ -2228,10 +2236,11 @@ let RIL = {
debug("MMI " + JSON.stringify(mmi));
}
options.rilMessageType = "sendMMI";
// We check if the MMI service code is supported and in that case we
// trigger the appropriate RIL request if possible.
let sc = mmi.serviceCode;
switch (sc) {
// Call forwarding
case MMI_SC_CFU:
@ -2246,7 +2255,6 @@ let RIL = {
// code.
options.mmiServiceCode = MMI_KS_SC_CALL_FORWARDING;
options.action = MMI_PROC_TO_CF_ACTION[mmi.procedure];
options.rilMessageType = "sendMMI";
options.reason = MMI_SC_TO_CF_REASON[sc];
options.number = mmi.sia;
options.serviceClass = this._siToServiceClass(mmi.sib);
@ -2272,7 +2280,6 @@ let RIL = {
}
options.mmiServiceCode = MMI_KS_SC_PIN;
options.rilRequestType = "sendMMI";
options.pin = mmi.sia;
options.newPin = mmi.sib;
this.changeICCPIN(options);
@ -2289,7 +2296,6 @@ let RIL = {
}
options.mmiServiceCode = MMI_KS_SC_PIN2;
options.rilRequestType = "sendMMI";
options.pin = mmi.sia;
options.newPin = mmi.sib;
this.changeICCPIN2(options);
@ -2306,7 +2312,6 @@ let RIL = {
}
options.mmiServiceCode = MMI_KS_SC_PUK;
options.rilRequestType = "sendMMI";
options.puk = mmi.sia;
options.newPin = mmi.sib;
this.enterICCPUK(options);
@ -2323,7 +2328,6 @@ let RIL = {
}
options.mmiServiceCode = MMI_KS_SC_PUK2;
options.rilRequestType = "sendMMI";
options.puk = mmi.sia;
options.newPin = mmi.sib;
this.enterICCPUK2(options);
@ -2338,9 +2342,8 @@ let RIL = {
}
// If we already had the device's IMEI, we just send it to the DOM.
options.mmiServiceCode = MMI_KS_SC_IMEI;
options.rilMessageType = "sendMMI";
options.success = true;
options.result = this.IMEI;
options.statusMessage = this.IMEI;
this.sendDOMMessage(options);
return;
@ -3028,12 +3031,56 @@ let RIL = {
/**
* Helper for processing responses of functions such as enterICC* and changeICC*.
*/
_processEnterAndChangeICCResponses: function _processEnterAndChangeICCResponses(length, options) {
_processEnterAndChangeICCResponses:
function _processEnterAndChangeICCResponses(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
options.retryCount = length ? Buf.readUint32List()[0] : -1;
if (options.rilMessageType != "sendMMI") {
this.sendDOMMessage(options);
return;
}
let mmiServiceCode = options.mmiServiceCode;
if (options.success) {
switch (mmiServiceCode) {
case MMI_KS_SC_PIN:
options.statusMessage = MMI_SM_KS_PIN_CHANGED;
break;
case MMI_KS_SC_PIN2:
options.statusMessage = MMI_SM_KS_PIN2_CHANGED;
break;
case MMI_KS_SC_PUK:
options.statusMessage = MMI_SM_KS_PIN_UNBLOCKED;
break;
case MMI_KS_SC_PUK2:
options.statusMessage = MMI_SM_KS_PIN2_UNBLOCKED;
break;
}
} else {
if (options.retryCount <= 0) {
if (mmiServiceCode === MMI_KS_SC_PUK) {
options.errorMsg = MMI_ERROR_KS_SIM_BLOCKED;
} else if (mmiServiceCode === MMI_KS_SC_PIN) {
options.errorMsg = MMI_ERROR_KS_NEEDS_PUK;
}
} else {
if (mmiServiceCode === MMI_KS_SC_PIN ||
mmiServiceCode === MMI_KS_SC_PIN2) {
options.errorMsg = MMI_ERROR_KS_BAD_PIN;
} else if (mmiServiceCode === MMI_KS_SC_PUK ||
mmiServiceCode === MMI_KS_SC_PUK2) {
options.errorMsg = MMI_ERROR_KS_BAD_PUK;
}
if (options.retryCount != undefined) {
options.additionalInformation = options.retryCount;
}
}
}
this.sendDOMMessage(options);
},
@ -4803,8 +4850,7 @@ RIL[REQUEST_QUERY_CALL_FORWARD_STATUS] =
}
if (!rulesLength) {
options.success = false;
options.errorMsg =
"Invalid rule length while querying call forwarding status.";
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
this.sendDOMMessage(options);
return;
}
@ -4820,6 +4866,13 @@ RIL[REQUEST_QUERY_CALL_FORWARD_STATUS] =
rules[i] = rule;
}
options.rules = rules;
if (options.rilMessageType === "sendMMI") {
options.statusMessage = MMI_SM_KS_SERVICE_INTERROGATED;
// MMI query call forwarding options request returns a set of rules that
// will be exposed in the form of an array of nsIDOMMozMobileCFInfo
// instances.
options.additionalInformation = rules;
}
this.sendDOMMessage(options);
};
RIL[REQUEST_SET_CALL_FORWARD] =
@ -4828,6 +4881,22 @@ RIL[REQUEST_SET_CALL_FORWARD] =
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
if (options.success && options.isSendMMI) {
switch (options.action) {
case CALL_FORWARD_ACTION_ENABLE:
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED;
break;
case CALL_FORWARD_ACTION_DISABLE:
options.statusMessage = MMI_SM_KS_SERVICE_DISABLED;
break;
case CALL_FORWARD_ACTION_REGISTRATION:
options.statusMessage = MMI_SM_KS_SERVICE_REGISTERED;
break;
case CALL_FORWARD_ACTION_ERASURE:
options.statusMessage = MMI_SM_KS_SERVICE_ERASED;
break;
}
}
this.sendDOMMessage(options);
};
RIL[REQUEST_QUERY_CALL_WAITING] =
@ -4866,7 +4935,7 @@ RIL[REQUEST_GET_IMEI] = function REQUEST_GET_IMEI(length, options) {
if ((!options.success || this.IMEI == null) && !options.errorMsg) {
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
}
options.result = this.IMEI;
options.statusMessage = this.IMEI;
this.sendDOMMessage(options);
};
RIL[REQUEST_GET_IMEISV] = function REQUEST_GET_IMEISV(length, options) {