mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge b2g-inbound to m-c. a=merge
This commit is contained in:
commit
c1f402438a
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="aac9cc4bb94cf720baf8f7ee419b4d76ac86b1ac"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5c487ecd9afbcea1d507b9e4dfd09b3a8787fa65"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="aac9cc4bb94cf720baf8f7ee419b4d76ac86b1ac"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c",
|
||||
"git_revision": "e0fbadeb78a96137f071d9be7a47ef9fe882d17f",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "f9a69757f448f43953d09442183e858c236ff328",
|
||||
"revision": "aa2355f8f650e320a73584dfd2c5a4932577f6ea",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5c487ecd9afbcea1d507b9e4dfd09b3a8787fa65"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="9e10483c5808f94f4a0a9f6afe30aae2c5b42b4c"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e0fbadeb78a96137f071d9be7a47ef9fe882d17f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5deaf27fd266316f27e68206cc3be0e6f47ded54"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -131,8 +131,10 @@ function runEmulatorCmdSafe(aCommand) {
|
||||
/**
|
||||
* Send stk proactive pdu.
|
||||
*
|
||||
* Fulfill params: (none)
|
||||
* Reject params: (none)
|
||||
* Fulfill params:
|
||||
* result -- an array of emulator response lines.
|
||||
* Reject params:
|
||||
* result -- an array of emulator response lines.
|
||||
*
|
||||
* @param aPdu
|
||||
*
|
||||
@ -143,6 +145,84 @@ function sendEmulatorStkPdu(aPdu) {
|
||||
return runEmulatorCmdSafe(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek the last STK terminal response sent to modem.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- last terminal response in HEX String.
|
||||
* Reject params:
|
||||
* result -- an array of emulator response lines.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function peekLastStkResponse() {
|
||||
return runEmulatorCmdSafe("stk lastresponse")
|
||||
.then(aResult => aResult[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek the last STK envelope sent to modem.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- last envelope in HEX String.
|
||||
* Reject params:
|
||||
* result -- an array of emulator response lines.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function peekLastStkEnvelope() {
|
||||
return runEmulatorCmdSafe("stk lastenvelope")
|
||||
.then(aResult => aResult[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify with the peeked STK response.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- (none)
|
||||
* Reject params:
|
||||
* result -- an array of emulator response lines.
|
||||
*
|
||||
* @param aExpectResponse
|
||||
* The expected Response PDU in HEX String.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function verifyWithPeekedStkResponse(aExpectResponse) {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
window.setTimeout(function() {
|
||||
peekLastStkResponse().then(aResult => {
|
||||
is(aResult, aExpectResponse, "Verify sent APDU");
|
||||
aResolve();
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify with the peeked STK response.
|
||||
*
|
||||
* Fulfill params:
|
||||
* result -- (none)
|
||||
* Reject params:
|
||||
* result -- an array of emulator response lines.
|
||||
*
|
||||
* @param aExpectEnvelope
|
||||
* The expected Envelope PDU in HEX String.
|
||||
*
|
||||
* @return A deferred promise.
|
||||
*/
|
||||
function verifyWithPeekedStkEnvelope(aExpectEnvelope) {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
window.setTimeout(function() {
|
||||
peekLastStkEnvelope().then(aResult => {
|
||||
is(aResult, aExpectEnvelope, "Verify sent APDU");
|
||||
aResolve();
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
|
||||
let workingFrame;
|
||||
let iccManager;
|
||||
|
||||
|
@ -36,3 +36,7 @@ qemu = true
|
||||
[test_icc_detected_undetected_event.js]
|
||||
[test_icc_match_mvno.js]
|
||||
[test_icc_service_state.js]
|
||||
[test_stk_menu_selection.js]
|
||||
[test_stk_timer_expiration.js]
|
||||
[test_stk_event_download.js]
|
||||
[test_stk_response.js]
|
||||
|
204
dom/icc/tests/marionette/test_stk_event_download.js
Normal file
204
dom/icc/tests/marionette/test_stk_event_download.js
Normal file
@ -0,0 +1,204 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 90000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
|
||||
// APDU format of ENVELOPE:
|
||||
// Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le)
|
||||
|
||||
// Since |sendStkEventDownload| is an API without call back to identify the
|
||||
// result, the tests of |sendStkMenuSelection| must be executed one by one with
|
||||
// |verifyWithPeekedStkEnvelope| introduced here.
|
||||
return Promise.resolve()
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_USER_ACTIVITY
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"07" + // Length
|
||||
"990104" + // TAG_EVENT_LIST (STK_EVENT_TYPE_USER_ACTIVITY)
|
||||
"82028281" // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"07" + // Length
|
||||
"990105" + // TAG_EVENT_LIST (STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE)
|
||||
"82020281" // TAG_DEVICE_ID (STK_DEVICE_ID_DISPLAY, STK_DEVICE_ID_SIM)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS,
|
||||
locationStatus: MozIccManager.STK_SERVICE_STATE_NORMAL,
|
||||
locationInfo: {
|
||||
mcc: "466",
|
||||
mnc: "92",
|
||||
gsmLocationAreaCode: 10291,
|
||||
gsmCellId: 19072823
|
||||
}
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"15" + // Length
|
||||
"990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS)
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"9B0100" + // TAG_LOCATION_STATUS (STK_SERVICE_STATE_NORMAL)
|
||||
"930964F629283301230737" // TAG_LOCATION_INFO (mccmnc = 46692, lac = 10291, cellId = 19072823)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS,
|
||||
locationStatus: MozIccManager.STK_SERVICE_STATE_LIMITED,
|
||||
// locationInfo shall be ignored if locationStatus != STK_SERVICE_STATE_NORMAL
|
||||
locationInfo: {
|
||||
mcc: "466",
|
||||
mnc: "92",
|
||||
gsmLocationAreaCode: 10291,
|
||||
gsmCellId: 19072823
|
||||
}
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0A" + // Length
|
||||
"990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS)
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"9B0101" // TAG_LOCATION_STATUS (STK_SERVICE_STATE_LIMITED)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS,
|
||||
locationStatus: MozIccManager.STK_SERVICE_STATE_UNAVAILABLE,
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0A" + // Length
|
||||
"990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS)
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"9B0102" // TAG_LOCATION_STATUS (STK_SERVICE_STATE_UNAVAILABLE)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_MT_CALL,
|
||||
number: "+9876543210", // International number
|
||||
isIssuedByRemote: true,
|
||||
error: null
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"12" + // Length
|
||||
"990100" + // TAG_EVENT_LIST (STK_EVENT_TYPE_MT_CALL)
|
||||
"82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM)
|
||||
"9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0)
|
||||
"8606918967452301" // TAG_ADDRESS (+9876543210)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_MT_CALL,
|
||||
number: "987654321", // National number
|
||||
isIssuedByRemote: true,
|
||||
error: null
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"12" + // Length
|
||||
"990100" + // TAG_EVENT_LIST (STK_EVENT_TYPE_MT_CALL)
|
||||
"82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM)
|
||||
"9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0)
|
||||
"86068189674523F1" // TAG_ADDRESS (987654321)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED,
|
||||
isIssuedByRemote: true,
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0A" + // Length
|
||||
"990101" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_CONNECTED)
|
||||
"82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM)
|
||||
"9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED,
|
||||
isIssuedByRemote: false,
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0A" + // Length
|
||||
"990101" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_CONNECTED)
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED,
|
||||
isIssuedByRemote: false,
|
||||
error: "BusyError"
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0E" + // Length
|
||||
"990102" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_DISCONNECTED)
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0)
|
||||
"9A026091" // TAG_CAUSE (Busy)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED,
|
||||
isIssuedByRemote: true,
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0A" + // Length
|
||||
"990102" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_DISCONNECTED)
|
||||
"82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM)
|
||||
"9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_LANGUAGE_SELECTION,
|
||||
language: "zh",
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0B" + // Length
|
||||
"990107" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LANGUAGE_SELECTION)
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"2D027A68" // TAG_LANGUAGE ("zh")
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION,
|
||||
terminationCause: MozIccManager.STK_BROWSER_TERMINATION_CAUSE_USER,
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0A" + // Length
|
||||
"990108" + // TAG_EVENT_LIST (STK_EVENT_TYPE_BROWSER_TERMINATION)
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"B40100" // TAG_BROWSER_TERMINATION_CAUSE (USER)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkEventDownload({
|
||||
eventType: MozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION,
|
||||
terminationCause: MozIccManager.STK_BROWSER_TERMINATION_CAUSE_ERROR,
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D6" + // BER_EVENT_DOWNLOAD_TAG
|
||||
"0A" + // Length
|
||||
"990108" + // TAG_EVENT_LIST (STK_EVENT_TYPE_BROWSER_TERMINATION)
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"B40101" // TAG_BROWSER_TERMINATION_CAUSE (ERROR)
|
||||
));
|
||||
});
|
35
dom/icc/tests/marionette/test_stk_menu_selection.js
Normal file
35
dom/icc/tests/marionette/test_stk_menu_selection.js
Normal file
@ -0,0 +1,35 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
|
||||
// APDU format of ENVELOPE:
|
||||
// Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le)
|
||||
|
||||
// Since |sendStkMenuSelection| is an API without call back to identify the
|
||||
// result, the tests of |sendStkMenuSelection| must be executed one by one with
|
||||
// |verifyWithPeekedStkEnvelope| introduced here.
|
||||
return Promise.resolve()
|
||||
.then(() => icc.sendStkMenuSelection(1, true))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D3" + // BER_MENU_SELECTION_TAG
|
||||
"09" + // Length
|
||||
"82020181" + // TAG_DEVICE_ID (STK_DEVICE_ID_KEYPAD, STK_DEVICE_ID_SIM)
|
||||
"900101" + // TAG_ITEM_ID (Item (1))
|
||||
"9500" // TAG_HELP_REQUEST
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkMenuSelection(0, false))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D3" + // BER_MENU_SELECTION_TAG
|
||||
"07" + // Length
|
||||
"82020181" + // TAG_DEVICE_ID (STK_DEVICE_ID_KEYPAD, STK_DEVICE_ID_SIM)
|
||||
"900100" // TAG_ITEM_ID (Item (0))
|
||||
));
|
||||
});
|
288
dom/icc/tests/marionette/test_stk_response.js
Normal file
288
dom/icc/tests/marionette/test_stk_response.js
Normal file
@ -0,0 +1,288 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 120000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
|
||||
// APDU format of TERMINAL RESPONSE:
|
||||
// Class = 'A0', INS = '14', P1 = '00', P2 = '00', XXXX, (No Le)
|
||||
|
||||
// Since |sendStkResponse| is an API without call back to identify the
|
||||
// result, the tests of |sendStkResponse| must be executed one by one with
|
||||
// |verifyWithPeekedStkResponse| introduced here.
|
||||
return Promise.resolve()
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x01,
|
||||
typeOfCommand: MozIccManager.STK_CMD_LAUNCH_BROWSER,
|
||||
commandQualifier: 0x00,
|
||||
options: {
|
||||
url: "",
|
||||
mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103011500" + // TAG_COMMAND_DETAILS (STK_CMD_LAUNCH_BROWSER)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" // TAG_RESULT (STK_RESULT_OK)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x02,
|
||||
typeOfCommand: MozIccManager.STK_CMD_DISPLAY_TEXT,
|
||||
commandQualifier: 0x01,
|
||||
options: {
|
||||
text: "Toolkit Test 1",
|
||||
responseNeeded: false
|
||||
}
|
||||
}, {
|
||||
resultCode:
|
||||
MozIccManager.STK_RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS,
|
||||
additionalInformation:
|
||||
MozIccManager.STK_ADDITIONAL_INFO_ME_PROBLEM_SCREEN_IS_BUSY
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103022101" + // TAG_COMMAND_DETAILS (STK_CMD_DISPLAY_TEXT)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"83022001" // TAG_RESULT (STK_ADDITIONAL_INFO_ME_PROBLEM_SCREEN_IS_BUSY)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x03,
|
||||
typeOfCommand: MozIccManager.STK_CMD_SELECT_ITEM,
|
||||
commandQualifier: 0x00,
|
||||
options: {
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"},
|
||||
{identifier: 2, text: "Item 2"},
|
||||
{identifier: 3, text: "Item 3"},
|
||||
{identifier: 4, text: "Item 4"}]
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_HELP_INFO_REQUIRED,
|
||||
itemIdentifier: 5
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103032400" + // TAG_COMMAND_DETAILS (STK_CMD_SELECT_ITEM)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830113" + // TAG_RESULT (STK_RESULT_HELP_INFO_REQUIRED)
|
||||
"900105" // TAG_ITEM_ID (5)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x04,
|
||||
typeOfCommand: MozIccManager.STK_CMD_GET_INKEY,
|
||||
commandQualifier: 0x04,
|
||||
options: {
|
||||
text: "Enter Y/N"
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK,
|
||||
isYesNo: true
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103042204" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INKEY)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" + // TAG_RESULT (STK_RESULT_OK)
|
||||
"8D020401" // TAG_TEXT_STRING (STK_TEXT_CODING_GSM_8BIT, YES)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x05,
|
||||
typeOfCommand: MozIccManager.STK_CMD_GET_INKEY,
|
||||
commandQualifier: 0x04,
|
||||
options: {
|
||||
text: "Enter Y/N",
|
||||
duration: {
|
||||
timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
|
||||
timeInterval: 10
|
||||
}
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_NO_RESPONSE_FROM_USER,
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103052204" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INKEY)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830112" + // TAG_RESULT (STK_RESULT_NO_RESPONSE_FROM_USER)
|
||||
"0402010A" // TAG_DURATION (10 seconds)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x06,
|
||||
typeOfCommand: MozIccManager.STK_CMD_GET_INPUT,
|
||||
commandQualifier: 0x01,
|
||||
options: {
|
||||
text: "Enter Yes"
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK,
|
||||
input: "Yes"
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103062301" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INPUT)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" + // TAG_RESULT (STK_RESULT_OK)
|
||||
"8D0404596573" // TAG_TEXT_STRING (STK_TEXT_CODING_GSM_8BIT, "Yes")
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x07,
|
||||
typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT,
|
||||
commandQualifier: MozIccManager.STK_TIMER_START,
|
||||
options: {
|
||||
timerAction: MozIccManager.STK_TIMER_START,
|
||||
timerId: 0x01,
|
||||
timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK,
|
||||
timer: {
|
||||
timerAction: MozIccManager.STK_TIMER_START,
|
||||
timerId: 0x01,
|
||||
timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03
|
||||
},
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103072700" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" + // TAG_RESULT (STK_RESULT_OK)
|
||||
"240101" + // TIMER_IDENTIFIER (TIMER ID = 1)
|
||||
"2503102030" // TAG_TIMER_VALUE
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x08,
|
||||
typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT,
|
||||
commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE,
|
||||
options: {
|
||||
timerAction: MozIccManager.STK_TIMER_DEACTIVATE,
|
||||
timerId: 0x02,
|
||||
timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK,
|
||||
timer: {
|
||||
timerId: 0x02
|
||||
},
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103082701" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" + // TAG_RESULT (STK_RESULT_OK)
|
||||
"240102" // TIMER_IDENTIFIER (TIMER ID = 2)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x09,
|
||||
typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT,
|
||||
commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
|
||||
options: {
|
||||
timerAction: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
|
||||
timerId: 0x03,
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_ACTION_CONTRADICTION_TIMER_STATE,
|
||||
timer: {
|
||||
timerId: 0x03
|
||||
},
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"8103092702" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830124" + // TAG_RESULT (STK_RESULT_ACTION_CONTRADICTION_TIMER_STATE)
|
||||
"240103" // TIMER_IDENTIFIER (TIMER ID = 3)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x0A,
|
||||
typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
|
||||
commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO,
|
||||
options: {
|
||||
localInfoType: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK,
|
||||
localInfo: {
|
||||
locationInfo: {
|
||||
mcc: "466",
|
||||
mnc: "92",
|
||||
gsmLocationAreaCode: 10291,
|
||||
gsmCellId: 19072823
|
||||
}
|
||||
},
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"81030A2600" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" + // TAG_RESULT (STK_RESULT_OK)
|
||||
"930964F629283301230737" // TAG_LOCATION_INFO (mccmnc = 46692, lac = 10291, cellId = 19072823)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x0B,
|
||||
typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
|
||||
commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI,
|
||||
options: {
|
||||
localInfoType: MozIccManager.STK_LOCAL_INFO_IMEI
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK,
|
||||
localInfo: {
|
||||
imei: "123456789012345"
|
||||
},
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"81030B2601" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" + // TAG_RESULT (STK_RESULT_OK)
|
||||
"14081234567890123450" // TAG_IMEI ("123456789012345")
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x0C,
|
||||
typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
|
||||
commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE,
|
||||
options: {
|
||||
localInfoType: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK,
|
||||
localInfo: {
|
||||
// 2012, 3/4, 5:06:07 (Month is zero-based)
|
||||
date: new Date(Date.UTC(2012, 2, 4, 5, 6, 7))
|
||||
},
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"81030C2603" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" + // TAG_RESULT (STK_RESULT_OK)
|
||||
"260721304050607000" // TAG_DATE_TIME_ZONE ("2012, 3/4, 5:06:07" in UTC)
|
||||
))
|
||||
|
||||
.then(() => icc.sendStkResponse({
|
||||
commandNumber: 0x0D,
|
||||
typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
|
||||
commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE,
|
||||
options: {
|
||||
localInfoType: MozIccManager.STK_LOCAL_INFO_LANGUAGE
|
||||
}
|
||||
}, {
|
||||
resultCode: MozIccManager.STK_RESULT_OK,
|
||||
localInfo: {
|
||||
language: "zh"
|
||||
},
|
||||
}))
|
||||
.then(() => verifyWithPeekedStkResponse(
|
||||
"81030D2604" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO)
|
||||
"02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"830100" + // TAG_RESULT (STK_RESULT_OK)
|
||||
"2D027A68" // TAG_LANGUAGE ("zh")
|
||||
));
|
||||
});
|
27
dom/icc/tests/marionette/test_stk_timer_expiration.js
Normal file
27
dom/icc/tests/marionette/test_stk_timer_expiration.js
Normal file
@ -0,0 +1,27 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 20000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
let icc = getMozIcc();
|
||||
|
||||
// APDU format of ENVELOPE:
|
||||
// Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le)
|
||||
|
||||
// Since |sendStkTimerExpiration| is an API without call back to identify the
|
||||
// result, the tests of |sendStkMenuSelection| must be executed one by one with
|
||||
// |verifyWithPeekedStkEnvelope| introduced here.
|
||||
return Promise.resolve()
|
||||
.then(() => icc.sendStkTimerExpiration({ timerId: 5, timerValue: 1234567 / 1000 }))
|
||||
.then(() => verifyWithPeekedStkEnvelope(
|
||||
"D7" + // BER_TIMER_EXPIRATION_TAG
|
||||
"0C" + // Length
|
||||
"82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
|
||||
"A40105" + // TAG_TIMER_IDENTIFIER (5)
|
||||
"A503000243" // TIMER_VALUE (00:20:34) = 1234 seconds
|
||||
));
|
||||
});
|
@ -300,7 +300,7 @@ bool
|
||||
MobileConnection::IsValidCallBarringProgram(int32_t aProgram)
|
||||
{
|
||||
return aProgram >= nsIMobileConnection::CALL_BARRING_PROGRAM_ALL_OUTGOING &&
|
||||
aProgram <= nsIMobileConnection::CALL_BARRING_PROGRAM_INCOMING_ROAMING;
|
||||
aProgram <= nsIMobileConnection::CALL_BARRING_PROGRAM_INCOMING_SERVICE;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -163,7 +163,7 @@ already_AddRefed<nsIMobileConnectionService>
|
||||
NS_CreateMobileConnectionService();
|
||||
%}
|
||||
|
||||
[scriptable, uuid(b9845f09-7cbb-46d0-b713-773d80844e0d)]
|
||||
[scriptable, uuid(59a6d450-144b-47f9-8f4a-2132331e9e05)]
|
||||
interface nsIMobileConnection : nsISupports
|
||||
{
|
||||
/*
|
||||
@ -214,6 +214,9 @@ interface nsIMobileConnection : nsISupports
|
||||
const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2;
|
||||
const long CALL_BARRING_PROGRAM_ALL_INCOMING = 3;
|
||||
const long CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4;
|
||||
const long CALL_BARRING_PROGRAM_ALL_SERVICE = 5;
|
||||
const long CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6;
|
||||
const long CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7;
|
||||
|
||||
/**
|
||||
* Calling line identification restriction constants.
|
||||
|
@ -16,7 +16,7 @@ qemu = true
|
||||
[test_mobile_data_state.js]
|
||||
[test_mobile_roaming_preference.js]
|
||||
[test_call_barring_basic_operations.js]
|
||||
[test_call_barring_get_option.js]
|
||||
[test_call_barring_get_error.js]
|
||||
[test_call_barring_set_error.js]
|
||||
[test_call_barring_change_password.js]
|
||||
[test_mobile_set_radio.js]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
@ -90,18 +90,41 @@ function testAllPrograms(aPrograms) {
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
function testUnsupportedPrograms() {
|
||||
// Emulator now doesn't support these three programs.
|
||||
let unsupportedPrograms =
|
||||
[MozMobileConnection.CALL_BARRING_PROGRAM_ALL_SERVICE,
|
||||
MozMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_SERVICE,
|
||||
MozMobileConnection.CALL_BARRING_PROGRAM_INCOMING_SERVICE];
|
||||
|
||||
return unsupportedPrograms.reduce((previousPromise, program) => {
|
||||
return previousPromise
|
||||
.then(() => log("Test " + program))
|
||||
.then(() => setProgram(program, false))
|
||||
.then(() => {
|
||||
ok(false, "Should be rejected");
|
||||
}, error => {
|
||||
is(error.name, "RequestNotSupported",
|
||||
"Failed to setProgram: "+ error.name);
|
||||
});
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
// Start tests
|
||||
startTestCommon(function() {
|
||||
return Promise.resolve()
|
||||
.then(() => setProgram(null, outgoingPrograms))
|
||||
.then(() => setProgram(null, incomingPrograms))
|
||||
.then(() => setAndCheckProgram(null, outgoingPrograms))
|
||||
.then(() => setAndCheckProgram(null, incomingPrograms))
|
||||
|
||||
.then(() => log("=== Test outgoing call barring programs ==="))
|
||||
.then(() => testAllPrograms(outgoingPrograms))
|
||||
.then(() => log("=== Test incoming call barring programs ==="))
|
||||
.then(() => testAllPrograms(incomingPrograms))
|
||||
|
||||
.then(() => log("=== Test unsupported call barring programs ==="))
|
||||
.then(() => testUnsupportedPrograms())
|
||||
|
||||
.catch(aError => ok(false, "promise rejects during test: " + aError))
|
||||
.then(() => setProgram(null, outgoingPrograms))
|
||||
.then(() => setProgram(null, incomingPrograms));
|
||||
});
|
||||
.then(() => setAndCheckProgram(null, outgoingPrograms))
|
||||
.then(() => setAndCheckProgram(null, incomingPrograms));
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
@ -21,7 +21,7 @@ startTestCommon(function() {
|
||||
|
||||
// Test program
|
||||
.then(() => testGetCallBarringOption("InvalidParameter", {
|
||||
program: 5, /* Invalid program */
|
||||
program: 8, /* Invalid program */
|
||||
serviceClass: 0
|
||||
}))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
@ -21,7 +21,7 @@ startTestCommon(function() {
|
||||
|
||||
// Test program
|
||||
.then(() => testSetCallBarringOption("InvalidParameter", {
|
||||
"program": 5, /* Invalid program */
|
||||
"program": 8, /* Invalid program */
|
||||
"enabled": true,
|
||||
"password": "0000",
|
||||
"serviceClass": 0
|
||||
|
@ -412,7 +412,7 @@ NetworkManager.prototype = {
|
||||
.then(() => {
|
||||
if (networkInterface.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
|
||||
// Remove routing table in /proc/net/route
|
||||
return this._resetRoutingTable(networkInterface);
|
||||
return this._resetRoutingTable(networkInterface.name);
|
||||
}
|
||||
if (networkInterface.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
return this._removeDefaultRoute(networkInterface)
|
||||
@ -904,7 +904,10 @@ NetworkManager.prototype = {
|
||||
|
||||
_setDNS: function(aNetwork) {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
gNetworkService.setDNS(aNetwork, (aError) => {
|
||||
let dnses = aNetwork.getDnses();
|
||||
let gateways = aNetwork.getGateways();
|
||||
gNetworkService.setDNS(aNetwork.name, dnses.length, dnses,
|
||||
gateways.length, gateways, (aError) => {
|
||||
if (aError) {
|
||||
aReject("setDNS failed");
|
||||
return;
|
||||
@ -938,9 +941,9 @@ NetworkManager.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
_resetRoutingTable: function(aNetwork) {
|
||||
_resetRoutingTable: function(aInterfaceName) {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
gNetworkService.resetRoutingTable(aNetwork, (aSuccess) => {
|
||||
gNetworkService.resetRoutingTable(aInterfaceName, (aSuccess) => {
|
||||
if (!aSuccess) {
|
||||
debug("resetRoutingTable failed");
|
||||
}
|
||||
@ -952,7 +955,9 @@ NetworkManager.prototype = {
|
||||
|
||||
_removeDefaultRoute: function(aNetwork) {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
gNetworkService.removeDefaultRoute(aNetwork, (aSuccess) => {
|
||||
let gateways = aNetwork.getGateways();
|
||||
gNetworkService.removeDefaultRoute(aNetwork.name, gateways.length,
|
||||
gateways, (aSuccess) => {
|
||||
if (!aSuccess) {
|
||||
debug("removeDefaultRoute failed");
|
||||
}
|
||||
@ -964,7 +969,10 @@ NetworkManager.prototype = {
|
||||
|
||||
_setDefaultRouteAndProxy: function(aNetwork, aOldInterface) {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
gNetworkService.setDefaultRoute(aNetwork, aOldInterface, (aSuccess) => {
|
||||
let gateways = aNetwork.getGateways();
|
||||
let oldInterfaceName = (aOldInterface ? aOldInterface.name : "");
|
||||
gNetworkService.setDefaultRoute(aNetwork.name, gateways.length, gateways,
|
||||
oldInterfaceName, (aSuccess) => {
|
||||
if (!aSuccess) {
|
||||
gNetworkService.destroyNetwork(aNetwork, function() {
|
||||
aReject("setDefaultRoute failed");
|
||||
|
@ -54,23 +54,23 @@ function updateDebug() {
|
||||
}
|
||||
updateDebug();
|
||||
|
||||
function netdResponseType(code) {
|
||||
return Math.floor(code / 100) * 100;
|
||||
function netdResponseType(aCode) {
|
||||
return Math.floor(aCode / 100) * 100;
|
||||
}
|
||||
|
||||
function isError(code) {
|
||||
let type = netdResponseType(code);
|
||||
function isError(aCode) {
|
||||
let type = netdResponseType(aCode);
|
||||
return (type !== NETD_COMMAND_PROCEEDING && type !== NETD_COMMAND_OKAY);
|
||||
}
|
||||
|
||||
function Task(id, params, setupFunction) {
|
||||
this.id = id;
|
||||
this.params = params;
|
||||
this.setupFunction = setupFunction;
|
||||
function Task(aId, aParams, aSetupFunction) {
|
||||
this.id = aId;
|
||||
this.params = aParams;
|
||||
this.setupFunction = aSetupFunction;
|
||||
}
|
||||
|
||||
function NetworkWorkerRequestQueue(networkService) {
|
||||
this.networkService = networkService;
|
||||
function NetworkWorkerRequestQueue(aNetworkService) {
|
||||
this.networkService = aNetworkService;
|
||||
this.tasks = [];
|
||||
}
|
||||
NetworkWorkerRequestQueue.prototype = {
|
||||
@ -95,20 +95,20 @@ NetworkWorkerRequestQueue.prototype = {
|
||||
gNetworkWorker.postMessage(task.params);
|
||||
},
|
||||
|
||||
enqueue: function(id, params, setupFunction) {
|
||||
debug("enqueue id: " + id);
|
||||
this.tasks.push(new Task(id, params, setupFunction));
|
||||
enqueue: function(aId, aParams, aSetupFunction) {
|
||||
debug("enqueue id: " + aId);
|
||||
this.tasks.push(new Task(aId, aParams, aSetupFunction));
|
||||
|
||||
if (this.tasks.length === 1) {
|
||||
this.runQueue();
|
||||
}
|
||||
},
|
||||
|
||||
dequeue: function(id) {
|
||||
debug("dequeue id: " + id);
|
||||
dequeue: function(aId) {
|
||||
debug("dequeue id: " + aId);
|
||||
|
||||
if (!this.tasks.length || this.tasks[0].id != id) {
|
||||
debug("Id " + id + " is not on top of the queue");
|
||||
if (!this.tasks.length || this.tasks[0].id != aId) {
|
||||
debug("Id " + aId + " is not on top of the queue");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -128,14 +128,14 @@ NetworkWorkerRequestQueue.prototype = {
|
||||
* adjusts routes etc. accordingly.
|
||||
*/
|
||||
function NetworkService() {
|
||||
debug("Starting net_worker.");
|
||||
debug("Starting NetworkService.");
|
||||
|
||||
let self = this;
|
||||
|
||||
if (gNetworkWorker) {
|
||||
let networkListener = {
|
||||
onEvent: function(event) {
|
||||
self.handleWorkerMessage(event);
|
||||
onEvent: function(aEvent) {
|
||||
self.handleWorkerMessage(aEvent);
|
||||
}
|
||||
};
|
||||
gNetworkWorker.start(networkListener);
|
||||
@ -166,10 +166,10 @@ NetworkService.prototype = {
|
||||
|
||||
// nsIObserver
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case TOPIC_PREF_CHANGED:
|
||||
if (data === PREF_NETWORK_DEBUG_ENABLED) {
|
||||
if (aData === PREF_NETWORK_DEBUG_ENABLED) {
|
||||
updateDebug();
|
||||
}
|
||||
break;
|
||||
@ -190,39 +190,39 @@ NetworkService.prototype = {
|
||||
// Helpers
|
||||
|
||||
idgen: 0,
|
||||
controlMessage: function(params, callback, setupFunction) {
|
||||
controlMessage: function(aParams, aCallback, aSetupFunction) {
|
||||
if (this.shutdown) {
|
||||
return;
|
||||
}
|
||||
|
||||
let id = this.idgen++;
|
||||
params.id = id;
|
||||
if (callback) {
|
||||
this.controlCallbacks[id] = callback;
|
||||
aParams.id = id;
|
||||
if (aCallback) {
|
||||
this.controlCallbacks[id] = aCallback;
|
||||
}
|
||||
|
||||
// For now, we use setupFunction to determine if this command needs to be
|
||||
// For now, we use aSetupFunction to determine if this command needs to be
|
||||
// queued or not.
|
||||
if (setupFunction) {
|
||||
this.netWorkerRequestQueue.enqueue(id, params, setupFunction);
|
||||
if (aSetupFunction) {
|
||||
this.netWorkerRequestQueue.enqueue(id, aParams, aSetupFunction);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gNetworkWorker) {
|
||||
gNetworkWorker.postMessage(params);
|
||||
gNetworkWorker.postMessage(aParams);
|
||||
}
|
||||
},
|
||||
|
||||
handleWorkerMessage: function(response) {
|
||||
debug("NetworkManager received message from worker: " + JSON.stringify(response));
|
||||
let id = response.id;
|
||||
if (response.broadcast === true) {
|
||||
Services.obs.notifyObservers(null, response.topic, response.reason);
|
||||
handleWorkerMessage: function(aResponse) {
|
||||
debug("NetworkManager received message from worker: " + JSON.stringify(aResponse));
|
||||
let id = aResponse.id;
|
||||
if (aResponse.broadcast === true) {
|
||||
Services.obs.notifyObservers(null, aResponse.topic, aResponse.reason);
|
||||
return;
|
||||
}
|
||||
let callback = this.controlCallbacks[id];
|
||||
if (callback) {
|
||||
callback.call(this, response);
|
||||
callback.call(this, aResponse);
|
||||
delete this.controlCallbacks[id];
|
||||
}
|
||||
|
||||
@ -231,12 +231,12 @@ NetworkService.prototype = {
|
||||
|
||||
// nsINetworkService
|
||||
|
||||
getNetworkInterfaceStats: function(networkName, callback) {
|
||||
debug("getNetworkInterfaceStats for " + networkName);
|
||||
getNetworkInterfaceStats: function(aInterfaceName, aCallback) {
|
||||
debug("getNetworkInterfaceStats for " + aInterfaceName);
|
||||
|
||||
let file = new FileUtils.File("/proc/net/dev");
|
||||
if (!file) {
|
||||
callback.networkStatsAvailable(false, 0, 0, Date.now());
|
||||
aCallback.networkStatsAvailable(false, 0, 0, Date.now());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ NetworkService.prototype = {
|
||||
.split("\n");
|
||||
for (let i = 2; i < data.length; i++) {
|
||||
let parseResult = statExpr.exec(data[i]);
|
||||
if (parseResult && parseResult[1] === networkName) {
|
||||
if (parseResult && parseResult[1] === aInterfaceName) {
|
||||
rxBytes = parseInt(parseResult[2], 10);
|
||||
txBytes = parseInt(parseResult[3], 10);
|
||||
break;
|
||||
@ -265,168 +265,168 @@ NetworkService.prototype = {
|
||||
}
|
||||
|
||||
// netd always return success even interface doesn't exist.
|
||||
callback.networkStatsAvailable(true, rxBytes, txBytes, now);
|
||||
aCallback.networkStatsAvailable(true, rxBytes, txBytes, now);
|
||||
});
|
||||
},
|
||||
|
||||
setNetworkInterfaceAlarm: function(networkName, threshold, callback) {
|
||||
if (!networkName) {
|
||||
callback.networkUsageAlarmResult(-1);
|
||||
setNetworkInterfaceAlarm: function(aInterfaceName, aThreshold, aCallback) {
|
||||
if (!aInterfaceName) {
|
||||
aCallback.networkUsageAlarmResult(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
let self = this;
|
||||
this._disableNetworkInterfaceAlarm(networkName, function(result) {
|
||||
if (threshold < 0) {
|
||||
if (!isError(result.resultCode)) {
|
||||
callback.networkUsageAlarmResult(null);
|
||||
this._disableNetworkInterfaceAlarm(aInterfaceName, function(aResult) {
|
||||
if (aThreshold < 0) {
|
||||
if (!isError(aResult.resultCode)) {
|
||||
aCallback.networkUsageAlarmResult(null);
|
||||
return;
|
||||
}
|
||||
callback.networkUsageAlarmResult(result.reason);
|
||||
aCallback.networkUsageAlarmResult(aResult.reason);
|
||||
return
|
||||
}
|
||||
|
||||
self._setNetworkInterfaceAlarm(networkName, threshold, callback);
|
||||
self._setNetworkInterfaceAlarm(aInterfaceName, aThreshold, aCallback);
|
||||
});
|
||||
},
|
||||
|
||||
_setNetworkInterfaceAlarm: function(networkName, threshold, callback) {
|
||||
debug("setNetworkInterfaceAlarm for " + networkName + " at " + threshold + "bytes");
|
||||
_setNetworkInterfaceAlarm: function(aInterfaceName, aThreshold, aCallback) {
|
||||
debug("setNetworkInterfaceAlarm for " + aInterfaceName + " at " + aThreshold + "bytes");
|
||||
|
||||
let params = {
|
||||
cmd: "setNetworkInterfaceAlarm",
|
||||
ifname: networkName,
|
||||
threshold: threshold
|
||||
ifname: aInterfaceName,
|
||||
threshold: aThreshold
|
||||
};
|
||||
|
||||
params.report = true;
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
if (!isError(result.resultCode)) {
|
||||
callback.networkUsageAlarmResult(null);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
if (!isError(aResult.resultCode)) {
|
||||
aCallback.networkUsageAlarmResult(null);
|
||||
return;
|
||||
}
|
||||
|
||||
this._enableNetworkInterfaceAlarm(networkName, threshold, callback);
|
||||
this._enableNetworkInterfaceAlarm(aInterfaceName, aThreshold, aCallback);
|
||||
});
|
||||
},
|
||||
|
||||
_enableNetworkInterfaceAlarm: function(networkName, threshold, callback) {
|
||||
debug("enableNetworkInterfaceAlarm for " + networkName + " at " + threshold + "bytes");
|
||||
_enableNetworkInterfaceAlarm: function(aInterfaceName, aThreshold, aCallback) {
|
||||
debug("enableNetworkInterfaceAlarm for " + aInterfaceName + " at " + aThreshold + "bytes");
|
||||
|
||||
let params = {
|
||||
cmd: "enableNetworkInterfaceAlarm",
|
||||
ifname: networkName,
|
||||
threshold: threshold
|
||||
ifname: aInterfaceName,
|
||||
threshold: aThreshold
|
||||
};
|
||||
|
||||
params.report = true;
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
if (!isError(result.resultCode)) {
|
||||
callback.networkUsageAlarmResult(null);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
if (!isError(aResult.resultCode)) {
|
||||
aCallback.networkUsageAlarmResult(null);
|
||||
return;
|
||||
}
|
||||
callback.networkUsageAlarmResult(result.reason);
|
||||
aCallback.networkUsageAlarmResult(aResult.reason);
|
||||
});
|
||||
},
|
||||
|
||||
_disableNetworkInterfaceAlarm: function(networkName, callback) {
|
||||
debug("disableNetworkInterfaceAlarm for " + networkName);
|
||||
_disableNetworkInterfaceAlarm: function(aInterfaceName, aCallback) {
|
||||
debug("disableNetworkInterfaceAlarm for " + aInterfaceName);
|
||||
|
||||
let params = {
|
||||
cmd: "disableNetworkInterfaceAlarm",
|
||||
ifname: networkName,
|
||||
ifname: aInterfaceName,
|
||||
};
|
||||
|
||||
params.report = true;
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback(result);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback(aResult);
|
||||
});
|
||||
},
|
||||
|
||||
setWifiOperationMode: function(interfaceName, mode, callback) {
|
||||
debug("setWifiOperationMode on " + interfaceName + " to " + mode);
|
||||
setWifiOperationMode: function(aInterfaceName, aMode, aCallback) {
|
||||
debug("setWifiOperationMode on " + aInterfaceName + " to " + aMode);
|
||||
|
||||
let params = {
|
||||
cmd: "setWifiOperationMode",
|
||||
ifname: interfaceName,
|
||||
mode: mode
|
||||
ifname: aInterfaceName,
|
||||
mode: aMode
|
||||
};
|
||||
|
||||
params.report = true;
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
if (isError(result.resultCode)) {
|
||||
callback.wifiOperationModeResult("netd command error");
|
||||
this.controlMessage(params, function(aResult) {
|
||||
if (isError(aResult.resultCode)) {
|
||||
aCallback.wifiOperationModeResult("netd command error");
|
||||
} else {
|
||||
callback.wifiOperationModeResult(null);
|
||||
aCallback.wifiOperationModeResult(null);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
resetRoutingTable: function(network, callback) {
|
||||
resetRoutingTable: function(aInterfaceName, aCallback) {
|
||||
let options = {
|
||||
cmd: "removeNetworkRoute",
|
||||
ifname: network.name
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
this.controlMessage(options, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(options, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
setDNS: function(networkInterface, callback) {
|
||||
debug("Going DNS to " + networkInterface.name);
|
||||
let dnses = networkInterface.getDnses();
|
||||
setDNS: function(aInterfaceName, aDnsesCount, aDnses, aGatewaysCount,
|
||||
aGateways, aCallback) {
|
||||
debug("Going to set DNS to " + aInterfaceName);
|
||||
let options = {
|
||||
cmd: "setDNS",
|
||||
ifname: networkInterface.name,
|
||||
domain: "mozilla." + networkInterface.name + ".doman",
|
||||
dnses: dnses,
|
||||
gateways: networkInterface.getGateways()
|
||||
ifname: aInterfaceName,
|
||||
domain: "mozilla." + aInterfaceName + ".domain",
|
||||
dnses: aDnses,
|
||||
gateways: aGateways
|
||||
};
|
||||
this.controlMessage(options, function(result) {
|
||||
callback.setDnsResult(result.success ? null : result.reason);
|
||||
this.controlMessage(options, function(aResult) {
|
||||
aCallback.setDnsResult(aResult.success ? null : aResult.reason);
|
||||
});
|
||||
},
|
||||
|
||||
setDefaultRoute: function(network, oldInterface, callback) {
|
||||
debug("Going to change default route to " + network.name);
|
||||
let gateways = network.getGateways();
|
||||
setDefaultRoute: function(aInterfaceName, aCount, aGateways,
|
||||
aOldInterfaceName, aCallback) {
|
||||
debug("Going to change default route to " + aInterfaceName);
|
||||
let options = {
|
||||
cmd: "setDefaultRoute",
|
||||
ifname: network.name,
|
||||
oldIfname: (oldInterface && oldInterface !== network) ? oldInterface.name : null,
|
||||
gateways: gateways
|
||||
ifname: aInterfaceName,
|
||||
oldIfname: (aOldInterfaceName && aOldInterfaceName !== aInterfaceName) ?
|
||||
aOldInterfaceName : null,
|
||||
gateways: aGateways
|
||||
};
|
||||
this.controlMessage(options, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(options, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
removeDefaultRoute: function(network, callback) {
|
||||
debug("Remove default route for " + network.name);
|
||||
let gateways = network.getGateways();
|
||||
removeDefaultRoute: function(aInterfaceName, aCount, aGateways, aCallback) {
|
||||
debug("Remove default route for " + aInterfaceName);
|
||||
let options = {
|
||||
cmd: "removeDefaultRoute",
|
||||
ifname: network.name,
|
||||
gateways: gateways
|
||||
ifname: aInterfaceName,
|
||||
gateways: aGateways
|
||||
};
|
||||
this.controlMessage(options, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(options, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
_routeToString: function(interfaceName, host, prefixLength, gateway) {
|
||||
return host + "-" + prefixLength + "-" + gateway + "-" + interfaceName;
|
||||
_routeToString: function(aInterfaceName, aHost, aPrefixLength, aGateway) {
|
||||
return aHost + "-" + aPrefixLength + "-" + aGateway + "-" + aInterfaceName;
|
||||
},
|
||||
|
||||
modifyRoute: function(action, interfaceName, host, prefixLength, gateway) {
|
||||
modifyRoute: function(aAction, aInterfaceName, aHost, aPrefixLength, aGateway) {
|
||||
let command;
|
||||
|
||||
switch (action) {
|
||||
switch (aAction) {
|
||||
case Ci.nsINetworkService.MODIFY_ROUTE_ADD:
|
||||
command = 'addHostRoute';
|
||||
break;
|
||||
@ -434,18 +434,18 @@ NetworkService.prototype = {
|
||||
command = 'removeHostRoute';
|
||||
break;
|
||||
default:
|
||||
debug('Unknown action: ' + action);
|
||||
debug('Unknown action: ' + aAction);
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
let route = this._routeToString(interfaceName, host, prefixLength, gateway);
|
||||
let route = this._routeToString(aInterfaceName, aHost, aPrefixLength, aGateway);
|
||||
let setupFunc = () => {
|
||||
let count = this.addedRoutes.get(route);
|
||||
debug(command + ": " + route + " -> " + count);
|
||||
|
||||
// Return false if there is no need to send the command to network worker.
|
||||
if ((action == Ci.nsINetworkService.MODIFY_ROUTE_ADD && count) ||
|
||||
(action == Ci.nsINetworkService.MODIFY_ROUTE_REMOVE &&
|
||||
if ((aAction == Ci.nsINetworkService.MODIFY_ROUTE_ADD && count) ||
|
||||
(aAction == Ci.nsINetworkService.MODIFY_ROUTE_REMOVE &&
|
||||
(!count || count > 1))) {
|
||||
return false;
|
||||
}
|
||||
@ -453,21 +453,21 @@ NetworkService.prototype = {
|
||||
return true;
|
||||
};
|
||||
|
||||
debug(command + " " + host + " on " + interfaceName);
|
||||
debug(command + " " + aHost + " on " + aInterfaceName);
|
||||
let options = {
|
||||
cmd: command,
|
||||
ifname: interfaceName,
|
||||
gateway: gateway,
|
||||
prefixLength: prefixLength,
|
||||
ip: host
|
||||
ifname: aInterfaceName,
|
||||
gateway: aGateway,
|
||||
prefixLength: aPrefixLength,
|
||||
ip: aHost
|
||||
};
|
||||
|
||||
return new Promise((aResolve, aReject) => {
|
||||
this.controlMessage(options, (data) => {
|
||||
this.controlMessage(options, (aData) => {
|
||||
let count = this.addedRoutes.get(route);
|
||||
|
||||
// Remove route from addedRoutes on success or failure.
|
||||
if (action == Ci.nsINetworkService.MODIFY_ROUTE_REMOVE) {
|
||||
if (aAction == Ci.nsINetworkService.MODIFY_ROUTE_REMOVE) {
|
||||
if (count > 1) {
|
||||
this.addedRoutes.set(route, count - 1);
|
||||
} else {
|
||||
@ -475,12 +475,12 @@ NetworkService.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
if (data.error) {
|
||||
aReject(data.reason);
|
||||
if (aData.error) {
|
||||
aReject(aData.reason);
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == Ci.nsINetworkService.MODIFY_ROUTE_ADD) {
|
||||
if (aAction == Ci.nsINetworkService.MODIFY_ROUTE_ADD) {
|
||||
this.addedRoutes.set(route, count ? count + 1 : 1);
|
||||
}
|
||||
|
||||
@ -489,108 +489,108 @@ NetworkService.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
addSecondaryRoute: function(ifname, route, callback) {
|
||||
debug("Going to add route to secondary table on " + ifname);
|
||||
addSecondaryRoute: function(aInterfaceName, aRoute, aCallback) {
|
||||
debug("Going to add route to secondary table on " + aInterfaceName);
|
||||
let options = {
|
||||
cmd: "addSecondaryRoute",
|
||||
ifname: ifname,
|
||||
ip: route.ip,
|
||||
prefix: route.prefix,
|
||||
gateway: route.gateway
|
||||
ifname: aInterfaceName,
|
||||
ip: aRoute.ip,
|
||||
prefix: aRoute.prefix,
|
||||
gateway: aRoute.gateway
|
||||
};
|
||||
this.controlMessage(options, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(options, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
removeSecondaryRoute: function(ifname, route, callback) {
|
||||
debug("Going to remove route from secondary table on " + ifname);
|
||||
removeSecondaryRoute: function(aInterfaceName, aRoute, aCallback) {
|
||||
debug("Going to remove route from secondary table on " + aInterfaceName);
|
||||
let options = {
|
||||
cmd: "removeSecondaryRoute",
|
||||
ifname: ifname,
|
||||
ip: route.ip,
|
||||
prefix: route.prefix,
|
||||
gateway: route.gateway
|
||||
ifname: aInterfaceName,
|
||||
ip: aRoute.ip,
|
||||
prefix: aRoute.prefix,
|
||||
gateway: aRoute.gateway
|
||||
};
|
||||
this.controlMessage(options, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(options, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
// Enable/Disable DHCP server.
|
||||
setDhcpServer: function(enabled, config, callback) {
|
||||
if (null === config) {
|
||||
config = {};
|
||||
setDhcpServer: function(aEnabled, aConfig, aCallback) {
|
||||
if (null === aConfig) {
|
||||
aConfig = {};
|
||||
}
|
||||
|
||||
config.cmd = "setDhcpServer";
|
||||
config.enabled = enabled;
|
||||
aConfig.cmd = "setDhcpServer";
|
||||
aConfig.enabled = aEnabled;
|
||||
|
||||
this.controlMessage(config, function setDhcpServerResult(response) {
|
||||
if (!response.success) {
|
||||
callback.dhcpServerResult('Set DHCP server error');
|
||||
this.controlMessage(aConfig, function(aResponse) {
|
||||
if (!aResponse.success) {
|
||||
aCallback.dhcpServerResult('Set DHCP server error');
|
||||
return;
|
||||
}
|
||||
callback.dhcpServerResult(null);
|
||||
aCallback.dhcpServerResult(null);
|
||||
});
|
||||
},
|
||||
|
||||
// Enable/disable WiFi tethering by sending commands to netd.
|
||||
setWifiTethering: function(enable, config, callback) {
|
||||
setWifiTethering: function(aEnable, aConfig, aCallback) {
|
||||
// config should've already contained:
|
||||
// .ifname
|
||||
// .internalIfname
|
||||
// .externalIfname
|
||||
config.wifictrlinterfacename = WIFI_CTRL_INTERFACE;
|
||||
config.cmd = "setWifiTethering";
|
||||
aConfig.wifictrlinterfacename = WIFI_CTRL_INTERFACE;
|
||||
aConfig.cmd = "setWifiTethering";
|
||||
|
||||
// The callback function in controlMessage may not be fired immediately.
|
||||
this.controlMessage(config, function setWifiTetheringResult(data) {
|
||||
let code = data.resultCode;
|
||||
let reason = data.resultReason;
|
||||
let enable = data.enable;
|
||||
let enableString = enable ? "Enable" : "Disable";
|
||||
this.controlMessage(aConfig, function(aData) {
|
||||
let code = aData.resultCode;
|
||||
let reason = aData.resultReason;
|
||||
let enable = aData.enable;
|
||||
let enableString = aEnable ? "Enable" : "Disable";
|
||||
|
||||
debug(enableString + " Wifi tethering result: Code " + code + " reason " + reason);
|
||||
|
||||
if (isError(code)) {
|
||||
callback.wifiTetheringEnabledChange("netd command error");
|
||||
aCallback.wifiTetheringEnabledChange("netd command error");
|
||||
} else {
|
||||
callback.wifiTetheringEnabledChange(null);
|
||||
aCallback.wifiTetheringEnabledChange(null);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Enable/disable USB tethering by sending commands to netd.
|
||||
setUSBTethering: function(enable, config, callback) {
|
||||
config.cmd = "setUSBTethering";
|
||||
setUSBTethering: function(aEnable, aConfig, aCallback) {
|
||||
aConfig.cmd = "setUSBTethering";
|
||||
// The callback function in controlMessage may not be fired immediately.
|
||||
this.controlMessage(config, function setUsbTetheringResult(data) {
|
||||
let code = data.resultCode;
|
||||
let reason = data.resultReason;
|
||||
let enable = data.enable;
|
||||
let enableString = enable ? "Enable" : "Disable";
|
||||
this.controlMessage(aConfig, function(aData) {
|
||||
let code = aData.resultCode;
|
||||
let reason = aData.resultReason;
|
||||
let enable = aData.enable;
|
||||
let enableString = aEnable ? "Enable" : "Disable";
|
||||
|
||||
debug(enableString + " USB tethering result: Code " + code + " reason " + reason);
|
||||
|
||||
if (isError(code)) {
|
||||
callback.usbTetheringEnabledChange("netd command error");
|
||||
aCallback.usbTetheringEnabledChange("netd command error");
|
||||
} else {
|
||||
callback.usbTetheringEnabledChange(null);
|
||||
aCallback.usbTetheringEnabledChange(null);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Switch usb function by modifying property of persist.sys.usb.config.
|
||||
enableUsbRndis: function(enable, callback) {
|
||||
debug("enableUsbRndis: " + enable);
|
||||
enableUsbRndis: function(aEnable, aCallback) {
|
||||
debug("enableUsbRndis: " + aEnable);
|
||||
|
||||
let params = {
|
||||
cmd: "enableUsbRndis",
|
||||
enable: enable
|
||||
enable: aEnable
|
||||
};
|
||||
// Ask net work to report the result when this value is set to true.
|
||||
if (callback) {
|
||||
if (aCallback) {
|
||||
params.report = true;
|
||||
} else {
|
||||
params.report = false;
|
||||
@ -598,125 +598,125 @@ NetworkService.prototype = {
|
||||
|
||||
// The callback function in controlMessage may not be fired immediately.
|
||||
//this._usbTetheringAction = TETHERING_STATE_ONGOING;
|
||||
this.controlMessage(params, function(data) {
|
||||
callback.enableUsbRndisResult(data.result, data.enable);
|
||||
this.controlMessage(params, function(aData) {
|
||||
aCallback.enableUsbRndisResult(aData.result, aData.enable);
|
||||
});
|
||||
},
|
||||
|
||||
updateUpStream: function(previous, current, callback) {
|
||||
updateUpStream: function(aPrevious, aCurrent, aCallback) {
|
||||
let params = {
|
||||
cmd: "updateUpStream",
|
||||
preInternalIfname: previous.internalIfname,
|
||||
preExternalIfname: previous.externalIfname,
|
||||
curInternalIfname: current.internalIfname,
|
||||
curExternalIfname: current.externalIfname
|
||||
preInternalIfname: aPrevious.internalIfname,
|
||||
preExternalIfname: aPrevious.externalIfname,
|
||||
curInternalIfname: aCurrent.internalIfname,
|
||||
curExternalIfname: aCurrent.externalIfname
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(data) {
|
||||
let code = data.resultCode;
|
||||
let reason = data.resultReason;
|
||||
this.controlMessage(params, function(aData) {
|
||||
let code = aData.resultCode;
|
||||
let reason = aData.resultReason;
|
||||
debug("updateUpStream result: Code " + code + " reason " + reason);
|
||||
callback.updateUpStreamResult(!isError(code), data.curExternalIfname);
|
||||
aCallback.updateUpStreamResult(!isError(code), aData.curExternalIfname);
|
||||
});
|
||||
},
|
||||
|
||||
configureInterface: function(config, callback) {
|
||||
configureInterface: function(aConfig, aCallback) {
|
||||
let params = {
|
||||
cmd: "configureInterface",
|
||||
ifname: config.ifname,
|
||||
ipaddr: config.ipaddr,
|
||||
mask: config.mask,
|
||||
gateway_long: config.gateway,
|
||||
dns1_long: config.dns1,
|
||||
dns2_long: config.dns2,
|
||||
ifname: aConfig.ifname,
|
||||
ipaddr: aConfig.ipaddr,
|
||||
mask: aConfig.mask,
|
||||
gateway_long: aConfig.gateway,
|
||||
dns1_long: aConfig.dns1,
|
||||
dns2_long: aConfig.dns2,
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
dhcpRequest: function(interfaceName, callback) {
|
||||
dhcpRequest: function(aInterfaceName, aCallback) {
|
||||
let params = {
|
||||
cmd: "dhcpRequest",
|
||||
ifname: interfaceName
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback.dhcpRequestResult(!result.error, result.error ? null : result);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback.dhcpRequestResult(!aResult.error, aResult.error ? null : aResult);
|
||||
});
|
||||
},
|
||||
|
||||
stopDhcp: function(interfaceName, callback) {
|
||||
stopDhcp: function(aInterfaceName, aCallback) {
|
||||
let params = {
|
||||
cmd: "stopDhcp",
|
||||
ifname: interfaceName
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
enableInterface: function(interfaceName, callback) {
|
||||
enableInterface: function(aInterfaceName, aCallback) {
|
||||
let params = {
|
||||
cmd: "enableInterface",
|
||||
ifname: interfaceName
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
disableInterface: function(interfaceName, callback) {
|
||||
disableInterface: function(aInterfaceName, aCallback) {
|
||||
let params = {
|
||||
cmd: "disableInterface",
|
||||
ifname: interfaceName
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
resetConnections: function(interfaceName, callback) {
|
||||
resetConnections: function(aInterfaceName, aCallback) {
|
||||
let params = {
|
||||
cmd: "resetConnections",
|
||||
ifname: interfaceName
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
createNetwork: function(interfaceName, callback) {
|
||||
createNetwork: function(aInterfaceName, aCallback) {
|
||||
let params = {
|
||||
cmd: "createNetwork",
|
||||
ifname: interfaceName
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
destroyNetwork: function(interfaceName, callback) {
|
||||
destroyNetwork: function(aInterfaceName, aCallback) {
|
||||
let params = {
|
||||
cmd: "destroyNetwork",
|
||||
ifname: interfaceName
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
callback.nativeCommandResult(!result.error);
|
||||
this.controlMessage(params, function(aResult) {
|
||||
aCallback.nativeCommandResult(!aResult.error);
|
||||
});
|
||||
},
|
||||
|
||||
getNetId: function(interfaceName) {
|
||||
getNetId: function(aInterfaceName) {
|
||||
let params = {
|
||||
cmd: "getNetId",
|
||||
ifname: interfaceName
|
||||
ifname: aInterfaceName
|
||||
};
|
||||
|
||||
return new Promise((aResolve, aReject) => {
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsINetworkInterface;
|
||||
|
||||
[scriptable, function, uuid(91824160-fb25-11e1-a21f-0800200c9a66)]
|
||||
interface nsIWifiTetheringCallback : nsISupports
|
||||
{
|
||||
@ -159,7 +157,7 @@ interface nsIDhcpRequestCallback : nsISupports
|
||||
/**
|
||||
* Provide network services.
|
||||
*/
|
||||
[scriptable, uuid(214c0810-fd41-11e4-b939-0800200c9a66)]
|
||||
[scriptable, uuid(5d6b1877-890a-4c7f-8403-94d57ceba6cf)]
|
||||
interface nsINetworkService : nsISupports
|
||||
{
|
||||
const long MODIFY_ROUTE_ADD = 0;
|
||||
@ -268,45 +266,78 @@ interface nsINetworkService : nsISupports
|
||||
/**
|
||||
* Reset routing table.
|
||||
*
|
||||
* @param networkInterface
|
||||
* The network interface we want remove from the routing table.
|
||||
* @param interfaceName
|
||||
* The name of the network interface we want to remove from the routing
|
||||
* table.
|
||||
*
|
||||
* @param callback
|
||||
* Callback to notify the result of resetting routing table.
|
||||
*/
|
||||
void resetRoutingTable(in nsINetworkInterface networkInterface,
|
||||
void resetRoutingTable(in DOMString interfaceName,
|
||||
in nsINativeCommandCallback callback);
|
||||
|
||||
/**
|
||||
* Set DNS.
|
||||
*
|
||||
* @param networkInterface
|
||||
* The network interface which contains the DNS we want to set.
|
||||
* @param interfaceName
|
||||
* The network interface name of the DNS we want to set.
|
||||
* @param dnsesCount
|
||||
* Number of elements in dnses.
|
||||
* @param dnses
|
||||
* Dnses to set.
|
||||
* @param gatewaysCount
|
||||
* Number of elements in gateways.
|
||||
* @param gateways
|
||||
* Gateways for the dnses, the most suitable, usually the one with the
|
||||
* same address family, will be selected for each dns.
|
||||
*
|
||||
* @param callback
|
||||
* Callback to notify the result of setting DNS server.
|
||||
*/
|
||||
void setDNS(in nsINetworkInterface networkInterface,
|
||||
void setDNS(in DOMString interfaceName,
|
||||
in unsigned long dnsesCount,
|
||||
[array, size_is(dnsesCount)] in wstring dnses,
|
||||
in unsigned long gatewaysCount,
|
||||
[array, size_is(gatewaysCount)] in wstring gateways,
|
||||
in nsISetDnsCallback callback);
|
||||
|
||||
/**
|
||||
* Set default route.
|
||||
*
|
||||
* @param networkInterface
|
||||
* The network interface we want to set to the default route.
|
||||
* @param oldInterface
|
||||
* The previous network interface.
|
||||
* @param interfaceName
|
||||
* The network interface name of the default route we want to set.
|
||||
* @param count
|
||||
* Number of elements in gateways.
|
||||
* @param gateways
|
||||
* Default gateways for setting default route.
|
||||
* @param oldInterfaceName
|
||||
* The previous network interface name.
|
||||
*
|
||||
* @param callback
|
||||
* Callback to notify the result of setting default route.
|
||||
*/
|
||||
void setDefaultRoute(in nsINetworkInterface networkInterface,
|
||||
in nsINetworkInterface oldInterface,
|
||||
void setDefaultRoute(in DOMString interfaceName,
|
||||
in unsigned long count,
|
||||
[array, size_is(count)] in wstring gateways,
|
||||
in DOMString oldInterfaceName,
|
||||
in nsINativeCommandCallback callback);
|
||||
|
||||
/**
|
||||
* Remove default route.
|
||||
*
|
||||
* @param networkInterface
|
||||
* The network interface we want remove from the default route.
|
||||
* @param interfaceName
|
||||
* The network interface name of the default route we want to remove.
|
||||
* @param count
|
||||
* Number of elements in gateways.
|
||||
* @param gatways
|
||||
* Default gateways for removing default route.
|
||||
*
|
||||
* @param callback
|
||||
* Callback to notify the result of removing default route.
|
||||
*/
|
||||
void removeDefaultRoute(in nsINetworkInterface networkInterface,
|
||||
void removeDefaultRoute(in DOMString interfaceName,
|
||||
in unsigned long count,
|
||||
[array, size_is(count)] in wstring gateways,
|
||||
in nsINativeCommandCallback callback);
|
||||
|
||||
/**
|
||||
|
@ -2972,6 +2972,9 @@ this.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL = 1;
|
||||
this.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2;
|
||||
this.CALL_BARRING_PROGRAM_ALL_INCOMING = 3;
|
||||
this.CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4;
|
||||
this.CALL_BARRING_PROGRAM_ALL_SERVICE = 5;
|
||||
this.CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6;
|
||||
this.CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7;
|
||||
|
||||
this.CALL_BARRING_PROGRAM_TO_FACILITY = {};
|
||||
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_OUTGOING] = ICC_CB_FACILITY_BAOC;
|
||||
@ -2979,6 +2982,9 @@ CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL] =
|
||||
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME] = ICC_CB_FACILITY_BAOICxH;
|
||||
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_INCOMING] = ICC_CB_FACILITY_BAIC;
|
||||
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_INCOMING_ROAMING] = ICC_CB_FACILITY_BAICr;
|
||||
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_ALL_SERVICE] = ICC_CB_FACILITY_BA_ALL;
|
||||
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_OUTGOING_SERVICE] = ICC_CB_FACILITY_BA_MO;
|
||||
CALL_BARRING_PROGRAM_TO_FACILITY[CALL_BARRING_PROGRAM_INCOMING_SERVICE] = ICC_CB_FACILITY_BA_MT;
|
||||
|
||||
// CLIR constants. Must be in sync with nsIMobileConnectionService interface
|
||||
this.CLIR_DEFAULT = 0;
|
||||
|
@ -2788,8 +2788,10 @@ RilObject.prototype = {
|
||||
if (options.address) {
|
||||
GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_ADDRESS |
|
||||
COMPREHENSIONTLV_FLAG_CR);
|
||||
let addressLength = options.address[0] == '+' ? options.address.length - 1
|
||||
: options.address.length;
|
||||
ComprehensionTlvHelper.writeLength(
|
||||
Math.ceil(options.address.length/2) + 1 // address BCD + TON
|
||||
Math.ceil(addressLength / 2) + 1 // address BCD + TON
|
||||
);
|
||||
this.context.ICCPDUHelper.writeDiallingNumber(options.address);
|
||||
}
|
||||
@ -11379,19 +11381,29 @@ ComprehensionTlvHelperObject.prototype = {
|
||||
let GsmPDUHelper = this.context.GsmPDUHelper;
|
||||
|
||||
let cause = -1;
|
||||
for (let errorNo in RIL_ERROR_TO_GECKO_ERROR) {
|
||||
if (geckoError == RIL_ERROR_TO_GECKO_ERROR[errorNo]) {
|
||||
for (let errorNo in RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR) {
|
||||
if (geckoError == RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR[errorNo]) {
|
||||
cause = errorNo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Causes specified in 10.5.4.11 of TS 04.08 are less than 128.
|
||||
// we can ignore causes > 127 since Cause TLV is optional in
|
||||
// STK_EVENT_TYPE_CALL_DISCONNECTED.
|
||||
if (cause > 127) {
|
||||
return;
|
||||
}
|
||||
|
||||
cause = (cause == -1) ? ERROR_SUCCESS : cause;
|
||||
|
||||
GsmPDUHelper.writeHexOctet(COMPREHENSIONTLV_TAG_CAUSE |
|
||||
COMPREHENSIONTLV_FLAG_CR);
|
||||
GsmPDUHelper.writeHexOctet(2); // For single cause value.
|
||||
|
||||
// TS 04.08, clause 10.5.4.11: National standard code + user location.
|
||||
// TS 04.08, clause 10.5.4.11:
|
||||
// Code Standard : Standard defined for GSM PLMNS
|
||||
// Location: User
|
||||
GsmPDUHelper.writeHexOctet(0x60);
|
||||
|
||||
// TS 04.08, clause 10.5.4.11: ext bit = 1 + 7 bits for cause.
|
||||
@ -11438,11 +11450,11 @@ ComprehensionTlvHelperObject.prototype = {
|
||||
|
||||
// TS 102.223, clause 8.38
|
||||
// +----------------+------------------+-------------------+
|
||||
// | hours (1 byte) | minutes (1 btye) | secounds (1 byte) |
|
||||
// | hours (1 byte) | minutes (1 btye) | seconds (1 byte) |
|
||||
// +----------------+------------------+-------------------+
|
||||
GsmPDUHelper.writeSwappedNibbleBCDNum(Math.floor(seconds / 60 / 60));
|
||||
GsmPDUHelper.writeSwappedNibbleBCDNum(Math.floor(seconds / 60) % 60);
|
||||
GsmPDUHelper.writeSwappedNibbleBCDNum(seconds % 60);
|
||||
GsmPDUHelper.writeSwappedNibbleBCDNum(Math.floor(seconds) % 60);
|
||||
},
|
||||
|
||||
writeTextStringTlv: function(text, coding) {
|
||||
|
@ -625,7 +625,7 @@ add_test(function test_write_disconnecting_cause() {
|
||||
let pduHelper = context.GsmPDUHelper;
|
||||
let tlvHelper = context.ComprehensionTlvHelper;
|
||||
|
||||
tlvHelper.writeCauseTlv(RIL_ERROR_TO_GECKO_ERROR[ERROR_GENERIC_FAILURE]);
|
||||
tlvHelper.writeCauseTlv(RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR[CALL_FAIL_BUSY]);
|
||||
let tag = pduHelper.readHexOctet();
|
||||
equal(tag, COMPREHENSIONTLV_TAG_CAUSE | COMPREHENSIONTLV_FLAG_CR);
|
||||
let len = pduHelper.readHexOctet();
|
||||
@ -633,7 +633,7 @@ add_test(function test_write_disconnecting_cause() {
|
||||
let standard = pduHelper.readHexOctet();
|
||||
equal(standard, 0x60);
|
||||
let cause = pduHelper.readHexOctet();
|
||||
equal(cause, 0x80 | ERROR_GENERIC_FAILURE);
|
||||
equal(cause, 0x80 | CALL_FAIL_BUSY);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -56,6 +56,9 @@ interface MozMobileConnection : EventTarget
|
||||
const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2;
|
||||
const long CALL_BARRING_PROGRAM_ALL_INCOMING = 3;
|
||||
const long CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4;
|
||||
const long CALL_BARRING_PROGRAM_ALL_SERVICE = 5;
|
||||
const long CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6;
|
||||
const long CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7;
|
||||
|
||||
/**
|
||||
* Calling line identification restriction constants.
|
||||
|
@ -1 +1 @@
|
||||
0.0.14
|
||||
0.0.15
|
||||
|
@ -53,13 +53,15 @@ def main():
|
||||
task = get_task(taskid)
|
||||
ret = check_task(task)
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
return ret
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
try:
|
||||
subprocess.call(sys.argv[1:], shell=True)
|
||||
return subprocess.call(sys.argv[1:], shell=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
return e.returncode
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
sys.exit(main())
|
||||
|
Loading…
Reference in New Issue
Block a user