mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 899400 - B2G RIL: Call Waiting MMI functionality. r=hsinyi
This commit is contained in:
parent
5d6bc2a854
commit
f8c7071085
@ -1458,6 +1458,58 @@ let RIL = {
|
||||
Buf.sendParcel();
|
||||
},
|
||||
|
||||
/**
|
||||
* Query call waiting status via MMI.
|
||||
*/
|
||||
_handleQueryMMICallWaiting: function _handleQueryMMICallWaiting(options) {
|
||||
function callback(options) {
|
||||
options.length = Buf.readUint32();
|
||||
options.enabled = (Buf.readUint32() === 1);
|
||||
let services = Buf.readUint32();
|
||||
if (options.enabled) {
|
||||
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED_FOR;
|
||||
let serviceClass = [];
|
||||
for (let serviceClassMask = 1;
|
||||
serviceClassMask <= ICC_SERVICE_CLASS_MAX;
|
||||
serviceClassMask <<= 1) {
|
||||
if ((serviceClassMask & services) !== 0) {
|
||||
serviceClass.push(MMI_KS_SERVICE_CLASS_MAPPING[serviceClassMask]);
|
||||
}
|
||||
}
|
||||
options.additionalInformation = serviceClass;
|
||||
} else {
|
||||
options.statusMessage = MMI_SM_KS_SERVICE_DISABLED;
|
||||
}
|
||||
|
||||
// Prevent DataCloneError when sending chrome messages.
|
||||
delete options.callback;
|
||||
this.sendChromeMessage(options);
|
||||
}
|
||||
|
||||
options.callback = callback;
|
||||
this.queryCallWaiting(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set call waiting status via MMI.
|
||||
*/
|
||||
_handleSetMMICallWaiting: function _handleSetMMICallWaiting(options) {
|
||||
function callback(options) {
|
||||
if (options.enabled) {
|
||||
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED;
|
||||
} else {
|
||||
options.statusMessage = MMI_SM_KS_SERVICE_DISABLED;
|
||||
}
|
||||
|
||||
// Prevent DataCloneError when sending chrome messages.
|
||||
delete options.callback;
|
||||
this.sendChromeMessage(options);
|
||||
}
|
||||
|
||||
options.callback = callback;
|
||||
this.setCallWaiting(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Query call waiting status.
|
||||
*
|
||||
@ -1481,7 +1533,8 @@ let RIL = {
|
||||
Buf.newParcel(REQUEST_SET_CALL_WAITING, options);
|
||||
Buf.writeUint32(2);
|
||||
Buf.writeUint32(options.enabled ? 1 : 0);
|
||||
Buf.writeUint32(ICC_SERVICE_CLASS_VOICE);
|
||||
Buf.writeUint32(options.serviceClass !== undefined ?
|
||||
options.serviceClass : ICC_SERVICE_CLASS_VOICE);
|
||||
Buf.sendParcel();
|
||||
},
|
||||
|
||||
@ -2690,9 +2743,31 @@ let RIL = {
|
||||
}
|
||||
this.setICCFacilityLock(options);
|
||||
return;
|
||||
|
||||
// Call waiting
|
||||
case MMI_SC_CALL_WAITING:
|
||||
_sendMMIError(MMI_ERROR_KS_NOT_SUPPORTED);
|
||||
if (!_isRadioAvailable(MMI_KS_SC_CALL_WAITING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
options.mmiServiceCode = MMI_KS_SC_CALL_WAITING;
|
||||
|
||||
if (mmi.procedure === MMI_PROCEDURE_INTERROGATION) {
|
||||
this._handleQueryMMICallWaiting(options);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mmi.procedure === MMI_PROCEDURE_ACTIVATION) {
|
||||
options.enabled = true;
|
||||
} else if (mmi.procedure === MMI_PROCEDURE_DEACTIVATION) {
|
||||
options.enabled = false;
|
||||
} else {
|
||||
_sendMMIError(MMI_ERROR_KS_NOT_SUPPORTED, MMI_KS_SC_CALL_WAITING);
|
||||
return;
|
||||
}
|
||||
|
||||
options.serviceClass = this._siToServiceClass(mmi.sia);
|
||||
this._handleSetMMICallWaiting(options);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5544,6 +5619,12 @@ RIL[REQUEST_QUERY_CALL_WAITING] =
|
||||
this.sendChromeMessage(options);
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.callback) {
|
||||
options.callback.call(this, options);
|
||||
return;
|
||||
}
|
||||
|
||||
options.length = Buf.readUint32();
|
||||
options.enabled = ((Buf.readUint32() == 1) &&
|
||||
((Buf.readUint32() & ICC_SERVICE_CLASS_VOICE) == 0x01));
|
||||
@ -5554,7 +5635,15 @@ RIL[REQUEST_SET_CALL_WAITING] = function REQUEST_SET_CALL_WAITING(length, option
|
||||
options.success = (options.rilRequestError === 0);
|
||||
if (!options.success) {
|
||||
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
|
||||
this.sendChromeMessage(options);
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.callback) {
|
||||
options.callback.call(this, options);
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendChromeMessage(options);
|
||||
};
|
||||
RIL[REQUEST_SMS_ACKNOWLEDGE] = null;
|
||||
|
@ -857,12 +857,6 @@ add_test(function test_sendMMI_call_barring_BAIC_procedure_not_supported() {
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_sendMMI_call_waiting() {
|
||||
testSendMMI("*43#", MMI_ERROR_KS_NOT_SUPPORTED);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_sendMMI_USSD() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
@ -912,3 +906,77 @@ add_test(function test_sendMMI_USSD_error() {
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
function setCallWaitingSuccess(mmi) {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
|
||||
worker.RIL.setCallWaiting = function fakeSetCallWaiting(options) {
|
||||
worker.RIL[REQUEST_SET_CALL_WAITING](0, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: mmi});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
|
||||
do_check_true(postedMessage.success);
|
||||
}
|
||||
|
||||
add_test(function test_sendMMI_call_waiting_activation() {
|
||||
setCallWaitingSuccess("*43*10#");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_sendMMI_call_waiting_deactivation() {
|
||||
setCallWaitingSuccess("#43#");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_sendMMI_call_waiting_registration() {
|
||||
testSendMMI("**43#", MMI_ERROR_KS_NOT_SUPPORTED);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_sendMMI_call_waiting_erasure() {
|
||||
testSendMMI("##43#", MMI_ERROR_KS_NOT_SUPPORTED);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_sendMMI_call_waiting_interrogation() {
|
||||
let workerhelper = getWorker();
|
||||
let worker = workerhelper.worker;
|
||||
|
||||
worker.Buf.readUint32 = function fakeReadUint32() {
|
||||
return worker.Buf.int32Array.pop();
|
||||
};
|
||||
|
||||
worker.RIL.queryCallWaiting = function fakeQueryCallWaiting(options) {
|
||||
worker.Buf.int32Array = [
|
||||
7, // serviceClass
|
||||
1, // enabled
|
||||
2 // length
|
||||
];
|
||||
worker.RIL[REQUEST_QUERY_CALL_WAITING](1, {
|
||||
rilRequestError: ERROR_SUCCESS
|
||||
});
|
||||
};
|
||||
|
||||
worker.RIL.radioState = GECKO_RADIOSTATE_READY;
|
||||
worker.RIL.sendMMI({mmi: "*#43#"});
|
||||
|
||||
let postedMessage = workerhelper.postedMessage;
|
||||
|
||||
do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
|
||||
do_check_true(postedMessage.success);
|
||||
do_check_eq(postedMessage.length, 2);
|
||||
do_check_true(postedMessage.enabled);
|
||||
run_next_test();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user