Merge b2g-inbound to m-c a=merge

This commit is contained in:
Wes Kocher 2014-10-13 18:06:32 -07:00
commit 834c806456
24 changed files with 715 additions and 258 deletions

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -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="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6ca2008ac50b163d31244ef9f036cb224f4f229b"/>
@ -134,7 +134,7 @@
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="d259117b4976decbe2f76eeed85218bf0109190f"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="cf9376f0f59ca72333dd24a54efe887d527da612"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="85e864c4abc80e08bc82f0ac53c042e0d27839b0"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>
</manifest>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -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="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -151,7 +151,7 @@
<project name="platform/hardware/ril" path="hardware/ril" revision="12b1977cc704b35f2e9db2bb423fa405348bc2f3"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="985bf15264d865fe7b9c5b45f61c451cbaafa43d"/>
<project name="platform/system/core" path="system/core" revision="350eac5403124dacb2a5fd9e28ac290a59fc3b8e"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="cf9376f0f59ca72333dd24a54efe887d527da612"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="85e864c4abc80e08bc82f0ac53c042e0d27839b0"/>
<project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/>
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="d8952a42771045fca73ec600e2b42a4c7129d723"/>
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="7704e16da545f4207812e593743d6743e1afb9c5"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6ca2008ac50b163d31244ef9f036cb224f4f229b"/>
@ -145,7 +145,7 @@
<project name="platform/hardware/ril" path="hardware/ril" revision="c4e2ac95907a5519a0e09f01a0d8e27fec101af0"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="e1eb226fa3ad3874ea7b63c56a9dc7012d7ff3c2"/>
<project name="platform/system/core" path="system/core" revision="adc485d8755af6a61641d197de7cfef667722580"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="cf9376f0f59ca72333dd24a54efe887d527da612"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="85e864c4abc80e08bc82f0ac53c042e0d27839b0"/>
<project name="platform/system/qcom" path="system/qcom" revision="1cdab258b15258b7f9657da70e6f06ebd5a2fc25"/>
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4ae5df252123591d5b941191790e7abed1bce5a4"/>
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="ce18b47b4a4f93a581d672bbd5cb6d12fe796ca9"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "69b4d72a6b80008de044e535d9ff785631bd7f2b",
"revision": "291b607f32e6173d8fe225c644cc7397cdf82fa5",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,7 +17,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="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -15,7 +15,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="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6ca2008ac50b163d31244ef9f036cb224f4f229b"/>
@ -129,7 +129,7 @@
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="cf9376f0f59ca72333dd24a54efe887d527da612"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="85e864c4abc80e08bc82f0ac53c042e0d27839b0"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>

View File

@ -17,7 +17,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="2a536e4df82410178d8440cc710d8f838a95a0b9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f86c631e0465c0e56ccebeb1324fd28be9ea32f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="cc1f362ce43dce92ac786187ff4abf39060094bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -950,6 +950,11 @@ MobileConnectionService.prototype = {
} catch (e) {}
},
_broadcastCdmaInfoRecordSystemMessage: function(aMessage) {
// TODO: Bug 1072808, Broadcast System Message with proxy.
gSystemMessenger.broadcastMessage("cdma-info-rec-received", aMessage);
},
/**
* nsIMobileConnectionService interface.
*/
@ -1167,6 +1172,111 @@ MobileConnectionService.prototype = {
aServiceClass);
},
notifyCdmaInfoRecDisplay: function(aClientId, aDisplay) {
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
display: aDisplay
});
},
notifyCdmaInfoRecCalledPartyNumber: function(aClientId, aType, aPlan, aNumber,
aPi, aSi) {
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
calledNumber: {
type: aType,
plan: aPlan,
number: aNumber,
pi: aPi,
si: aSi
}
});
},
notifyCdmaInfoRecCallingPartyNumber: function(aClientId, aType, aPlan, aNumber,
aPi, aSi) {
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
callingNumber: {
type: aType,
plan: aPlan,
number: aNumber,
pi: aPi,
si: aSi
}
});
},
notifyCdmaInfoRecConnectedPartyNumber: function(aClientId, aType, aPlan, aNumber,
aPi, aSi) {
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
connectedNumber: {
type: aType,
plan: aPlan,
number: aNumber,
pi: aPi,
si: aSi
}
});
},
notifyCdmaInfoRecSignal: function(aClientId, aType, aAlertPitch, aSignal){
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
signal: {
type: aType,
alertPitch: aAlertPitch,
signal: aSignal
}
});
},
notifyCdmaInfoRecRedirectingNumber: function(aClientId, aType, aPlan, aNumber,
aPi, aSi, aReason) {
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
redirect: {
type: aType,
plan: aPlan,
number: aNumber,
pi: aPi,
si: aSi,
reason: aReason
}
});
},
notifyCdmaInfoRecLineControl: function(aClientId, aPolarityIncluded, aToggle,
aReverse, aPowerDenial) {
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
lineControl: {
polarityIncluded: aPolarityIncluded,
toggle: aToggle,
reverse: aReverse,
powerDenial: aPowerDenial
}
});
},
notifyCdmaInfoRecClir: function(aClientId, aCause) {
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
clirCause: aCause
});
},
notifyCdmaInfoRecAudioControl: function(aClientId, aUplink, aDownLink) {
this._broadcastCdmaInfoRecordSystemMessage({
clientId: aClientId,
audioControl: {
upLink: aUplink,
downLink: aDownLink
}
});
},
/**
* nsIObserver interface.
*/

View File

@ -9,7 +9,7 @@
"@mozilla.org/mobileconnection/gonkmobileconnectionservice;1"
%}
[scriptable, uuid(b0310517-e7f6-4fa5-a52e-fa6ff35c8fc1)]
[scriptable, uuid(2d574f0e-4a02-11e4-b1b3-cbc14b7608ce)]
interface nsIGonkMobileConnectionService : nsIMobileConnectionService
{
void notifyNetworkInfoChanged(in unsigned long clientId, in jsval networkInfo);
@ -53,4 +53,205 @@ interface nsIGonkMobileConnectionService : nsIMobileConnectionService
in DOMString number,
in unsigned short timeSeconds,
in unsigned short serviceClass);
/**
* Notify Display Info from received Cdma-Info-Record.
* See 3.7.4.1 Display in 3GPP2 C.S0005-F.
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param display
The string to be displayed.
*/
void notifyCdmaInfoRecDisplay(in unsigned long clientId,
in DOMString display);
/**
* Notify Called Party Number from received Cdma-Info-Record.
* See 3.7.4.2 Called Party Number in 3GPP2 C.S0005-F.
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param type
* The type of number. (3-bit binary)
* See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
* @param plan
* The numbering plan. (4-bit binary)
* See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
* @param number
* The string presentation of the number.
* @param pi (2-bit binary)
* The Presentation indicator of the number.
* See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
* @param si (2-bit binary)
* The Screening Indicator of the number.
* See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
*/
void notifyCdmaInfoRecCalledPartyNumber(in unsigned long clientId,
in unsigned short type,
in unsigned short plan,
in DOMString number,
in unsigned short pi,
in unsigned short si);
/**
* Notify Calling Party Number from received Cdma-Info-Record.
* See 3.7.4.3 Calling Party Number in 3GPP2 C.S0005-F.
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param type
* The type of number. (3-bit binary)
* See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
* @param plan
* The numbering plan. (4-bit binary)
* See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
* @param number
* The string presentation of the number.
* @param pi (2-bit binary)
* The Presentation indicator of the number.
* See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
* @param si (2-bit binary)
* The Screening Indicator of the number.
* See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
*/
void notifyCdmaInfoRecCallingPartyNumber(in unsigned long clientId,
in unsigned short type,
in unsigned short plan,
in DOMString number,
in unsigned short pi,
in unsigned short si);
/**
* Notify Connected Party Number from received Cdma-Info-Record.
* See 3.7.4.4 Connected Party Number in 3GPP2 C.S0005-F.
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param type
* The type of number. (3-bit binary)
* See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
* @param plan
* The numbering plan. (4-bit binary)
* See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
* @param number
* The string presentation of the number.
* @param pi (2-bit binary)
* The Presentation indicator of the number.
* See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
* @param si (2-bit binary)
* The Screening Indicator of the number.
* See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
*/
void notifyCdmaInfoRecConnectedPartyNumber(in unsigned long clientId,
in unsigned short type,
in unsigned short plan,
in DOMString number,
in unsigned short pi,
in unsigned short si);
/**
* Notify Signal Info from received Cdma-Info-Record.
* See 3.7.4.5 Signal in 3GPP2 C.S0005-F.
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param type
* The signal type. (2-bit binary)
* See Table 3.7.5.5-1 in 3GPP2 C.S0005-F.
* @param alertPitch
* The pitch of the alerting signal. (2-bit binary)
* See Table 3.7.5.5-2 in 3GPP2 C.S0005-F.
* @param signal
* The signal code. (6-bit binary)
* See Table 3.7.5.5-3, 3.7.5.5-4, 3.7.5.5-5 in 3GPP2 C.S0005-F.
*/
void notifyCdmaInfoRecSignal(in unsigned long clientId,
in unsigned short type,
in unsigned short alertPitch,
in unsigned short signal);
/**
* Notify Redirecting Number from received Cdma-Info-Record.
* See 3.7.4.11 Redirecting Number in 3GPP2 C.S0005-F.
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param type
* The type of number. (3-bit binary)
* See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
* @param plan
* The numbering plan. (4-bit binary)
* See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
* @param number
* The string presentation of the number.
* @param pi (2-bit binary)
* The Presentation indicator of the number.
* See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
* @param si (2-bit binary)
* The Screening Indicator of the number.
* See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
* @param reason (4-bit binary)
* The redirection reason.
* See Table 3.7.5.11-1 in 3GPP2 C.S0005-F.
*/
void notifyCdmaInfoRecRedirectingNumber(in unsigned long clientId,
in unsigned short type,
in unsigned short plan,
in DOMString number,
in unsigned short pi,
in unsigned short si,
in unsigned short reason);
/**
* Notify Line Control from received Cdma-Info-Record.
* See 3.7.4.15 Line Control in 3GPP2 C.S0005-F.
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param polarityIncluded (1-bit)
* Polarity parameter included.
* @param toggle (1-bit)
* Toggle mode.
* @param reverse (1-bit)
* Reverse polarity.
* @param powerDenial (8-bit)
* Power denial timeout.
*/
void notifyCdmaInfoRecLineControl(in unsigned long clientId,
in unsigned short polarityIncluded,
in unsigned short toggle,
in unsigned short reverse,
in unsigned short powerDenial);
/**
* Notify CLIR from received Cdma-Info-Record.
* See 'ANNEX 1 Country-Specific Record Type for Japan' in T53.
* http://www.arib.or.jp/english/html/overview/doc/T53v6_5_pdf/5_ANNEX_v6_5.pdf
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param cause
* Reason code. (8-bit binary)
* See Table A 1.1-1 in T53.
*/
void notifyCdmaInfoRecClir(in unsigned long clientId,
in unsigned short cause);
/**
* Notify Audio Control from received Cdma-Info-Record.
*
* Note: No information from ARIB about Audio Control.
* It seems obsolete according to ANNEX 1 in T53.
* upLink/downLink are 'byte' value according to ril.h.
* Treat them as 'signed short' to preserve the flexibility when needed.
*
* @param clientId
* The ID of radioInterface where this info is notified from.
* @param upLink
* @param downLink
*/
void notifyCdmaInfoRecAudioControl(in unsigned long clientId,
in short upLink,
in short downLink);
};

View File

@ -396,13 +396,6 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
}
},
sendMobileConnectionMessage: function(message, clientId, data) {
this._sendTargetMessage("mobileconnection", message, {
clientId: clientId,
data: data
});
},
sendIccMessage: function(message, clientId, data) {
this._sendTargetMessage("icc", message, {
clientId: clientId,
@ -1163,7 +1156,7 @@ DataConnectionHandler.prototype = {
_compareDataCallOptions: function(dataCall, newDataCall) {
return dataCall.apnProfile.apn == newDataCall.apn &&
dataCall.apnProfile.user == newDataCall.user &&
dataCall.apnProfile.password == newDataCall.password &&
dataCall.apnProfile.password == newDataCall.passwd &&
dataCall.chappap == newDataCall.chappap &&
dataCall.pdptype == newDataCall.pdptype;
},
@ -2091,8 +2084,7 @@ RadioInterface.prototype = {
gMessageManager.sendIccMessage("RIL:StkSessionEnd", this.clientId, null);
break;
case "cdma-info-rec-received":
if (DEBUG) this.debug("cdma-info-rec-received: " + JSON.stringify(message));
gSystemMessenger.broadcastMessage("cdma-info-rec-received", message);
this.handleCdmaInformationRecords(message.records);
break;
default:
throw new Error("Don't know about this message type: " +
@ -2920,6 +2912,99 @@ RadioInterface.prototype = {
hasEtwsInfo ? etwsInfo.popup : false);
},
handleCdmaInformationRecords: function(aRecords) {
if (DEBUG) this.debug("cdma-info-rec-received: " + JSON.stringify(aRecords));
let clientId = this.clientId;
aRecords.forEach(function(aRecord) {
if (aRecord.display) {
gMobileConnectionService
.notifyCdmaInfoRecDisplay(clientId, aRecord.display);
return;
}
if (aRecord.calledNumber) {
gMobileConnectionService
.notifyCdmaInfoRecCalledPartyNumber(clientId,
aRecord.calledNumber.type,
aRecord.calledNumber.plan,
aRecord.calledNumber.number,
aRecord.calledNumber.pi,
aRecord.calledNumber.si);
return;
}
if (aRecord.callingNumber) {
gMobileConnectionService
.notifyCdmaInfoRecCallingPartyNumber(clientId,
aRecord.callingNumber.type,
aRecord.callingNumber.plan,
aRecord.callingNumber.number,
aRecord.callingNumber.pi,
aRecord.callingNumber.si);
return;
}
if (aRecord.connectedNumber) {
gMobileConnectionService
.notifyCdmaInfoRecConnectedPartyNumber(clientId,
aRecord.connectedNumber.type,
aRecord.connectedNumber.plan,
aRecord.connectedNumber.number,
aRecord.connectedNumber.pi,
aRecord.connectedNumber.si);
return;
}
if (aRecord.signal) {
gMobileConnectionService
.notifyCdmaInfoRecSignal(clientId,
aRecord.signal.type,
aRecord.signal.alertPitch,
aRecord.signal.signal);
return;
}
if (aRecord.redirect) {
gMobileConnectionService
.notifyCdmaInfoRecRedirectingNumber(clientId,
aRecord.redirect.type,
aRecord.redirect.plan,
aRecord.redirect.number,
aRecord.redirect.pi,
aRecord.redirect.si,
aRecord.redirect.reason);
return;
}
if (aRecord.lineControl) {
gMobileConnectionService
.notifyCdmaInfoRecLineControl(clientId,
aRecord.lineControl.polarityIncluded,
aRecord.lineControl.toggle,
aRecord.lineControl.reverse,
aRecord.lineControl.powerDenial);
return;
}
if (aRecord.clirCause) {
gMobileConnectionService
.notifyCdmaInfoRecClir(clientId,
aRecord.clirCause);
return;
}
if (aRecord.audioControl) {
gMobileConnectionService
.notifyCdmaInfoRecAudioControl(clientId,
aRecord.audioControl.upLink,
aRecord.audioControl.downLink);
return;
}
});
},
// nsIObserver
observe: function(subject, topic, data) {

View File

@ -6920,9 +6920,10 @@ RilObject.prototype[UNSOLICITED_CDMA_OTA_PROVISION_STATUS] = function UNSOLICITE
status: status});
};
RilObject.prototype[UNSOLICITED_CDMA_INFO_REC] = function UNSOLICITED_CDMA_INFO_REC(length) {
let record = this.context.CdmaPDUHelper.decodeInformationRecord();
record.rilMessageType = "cdma-info-rec-received";
this.sendChromeMessage(record);
this.sendChromeMessage({
rilMessageType: "cdma-info-rec-received",
records: this.context.CdmaPDUHelper.decodeInformationRecord()
});
};
RilObject.prototype[UNSOLICITED_OEM_HOOK_RAW] = null;
RilObject.prototype[UNSOLICITED_RINGBACK_TONE] = null;
@ -9987,11 +9988,13 @@ CdmaPDUHelperObject.prototype = {
*/
decodeInformationRecord: function() {
let Buf = this.context.Buf;
let record = {};
let records = [];
let numOfRecords = Buf.readInt32();
let type;
let record;
for (let i = 0; i < numOfRecords; i++) {
record = {};
type = Buf.readInt32();
switch (type) {
@ -9999,6 +10002,7 @@ CdmaPDUHelperObject.prototype = {
* Every type is encaped by ril, except extended display
*/
case PDU_CDMA_INFO_REC_TYPE_DISPLAY:
case PDU_CDMA_INFO_REC_TYPE_EXTENDED_DISPLAY:
record.display = Buf.readString();
break;
case PDU_CDMA_INFO_REC_TYPE_CALLED_PARTY_NUMBER:
@ -10027,7 +10031,10 @@ CdmaPDUHelperObject.prototype = {
break;
case PDU_CDMA_INFO_REC_TYPE_SIGNAL:
record.signal = {};
record.signal.present = Buf.readInt32();
if (!Buf.readInt32()) { // Non-zero if signal is present.
Buf.seekIncoming(3 * Buf.UINT32_SIZE);
continue;
}
record.signal.type = Buf.readInt32();
record.signal.alertPitch = Buf.readInt32();
record.signal.signal = Buf.readInt32();
@ -10045,40 +10052,11 @@ CdmaPDUHelperObject.prototype = {
record.lineControl = {};
record.lineControl.polarityIncluded = Buf.readInt32();
record.lineControl.toggle = Buf.readInt32();
record.lineControl.recerse = Buf.readInt32();
record.lineControl.reverse = Buf.readInt32();
record.lineControl.powerDenial = Buf.readInt32();
break;
case PDU_CDMA_INFO_REC_TYPE_EXTENDED_DISPLAY:
let length = Buf.readInt32();
/*
* Extended display is still in format defined in
* C.S0005-F v1.0, 3.7.5.16
*/
record.extendedDisplay = {};
let headerByte = Buf.readInt32();
length--;
// Based on spec, headerByte must be 0x80 now
record.extendedDisplay.indicator = (headerByte >> 7);
record.extendedDisplay.type = (headerByte & 0x7F);
record.extendedDisplay.records = [];
while (length > 0) {
let display = {};
display.tag = Buf.readInt32();
length--;
if (display.tag !== INFO_REC_EXTENDED_DISPLAY_BLANK &&
display.tag !== INFO_REC_EXTENDED_DISPLAY_SKIP) {
display.content = Buf.readString();
length -= (display.content.length + 1);
}
record.extendedDisplay.records.push(display);
}
break;
case PDU_CDMA_INFO_REC_TYPE_T53_CLIR:
record.cause = Buf.readInt32();
record.clirCause = Buf.readInt32();
break;
case PDU_CDMA_INFO_REC_TYPE_T53_AUDIO_CONTROL:
record.audioControl = {};
@ -10088,11 +10066,13 @@ CdmaPDUHelperObject.prototype = {
case PDU_CDMA_INFO_REC_TYPE_T53_RELEASE:
// Fall through
default:
throw new Error("UNSOLICITED_CDMA_INFO_REC(), Unsupported information record type " + record.type + "\n");
throw new Error("UNSOLICITED_CDMA_INFO_REC(), Unsupported information record type " + type + "\n");
}
records.push(record);
}
return record;
return records;
}
};

View File

@ -36,6 +36,10 @@ function newWorkerWithParcel(parcelBuf) {
return buf[index++];
};
context.Buf.seekIncoming = function(offset) {
index += offset / context.Buf.UINT32_SIZE;
};
return worker;
}
@ -53,9 +57,9 @@ add_test(function test_display() {
0x6F, 0x00]);
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let record = helper.decodeInformationRecord();
let records = helper.decodeInformationRecord();
do_check_eq(record.display, "Test Info");
do_check_eq(records[0].display, "Test Info");
run_next_test();
});
@ -67,27 +71,19 @@ add_test(function test_extended_display() {
let worker = newWorkerWithParcel([
0x01, // one inforemation record
0x07, // type: extended display
0x0E, // length: 14
0x80, // header byte
0x80, // Blank
0x81, // Skip
0x9B, // Text
0x09, 0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E,
0x66, 0x6F, 0x00]);
0x12, // length: 18
0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x78, 0x74,
0x65, 0x6E, 0x64, 0x65, 0x64, 0x20, 0x49, 0x6E,
0x66, 0x6F, 0x00, 0x00]);
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let record = helper.decodeInformationRecord();
let records = helper.decodeInformationRecord();
do_check_eq(record.extendedDisplay.indicator, 1);
do_check_eq(record.extendedDisplay.type, 0);
do_check_eq(record.extendedDisplay.records.length, 3);
do_check_eq(record.extendedDisplay.records[0].tag, 0x80);
do_check_eq(record.extendedDisplay.records[1].tag, 0x81);
do_check_eq(record.extendedDisplay.records[2].tag, 0x9B);
do_check_eq(record.extendedDisplay.records[2].content, "Test Info");
do_check_eq(records[0].display, "Test Extended Info");
run_next_test();
});
/**
* Verify decoder for mixed type
*/
@ -95,29 +91,144 @@ add_test(function test_mixed() {
let worker = newWorkerWithParcel([
0x02, // two inforemation record
0x00, // type: display
0x09, // length: 9
0x0B, // length: 11
0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E, 0x66,
0x6F, 0x00,
0x6F, 0x20, 0x31, 0x00,
0x07, // type: extended display
0x0E, // length: 14
0x80, // header byte
0x80, // Blank
0x81, // Skip
0x9B, // Text
0x09, 0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E,
0x66, 0x6F, 0x00]);
0x0B, // length: 11
0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E, 0x66,
0x6F, 0x20, 0x32, 0x00]);
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let record = helper.decodeInformationRecord();
let records = helper.decodeInformationRecord();
do_check_eq(record.display, "Test Info");
do_check_eq(record.extendedDisplay.indicator, 1);
do_check_eq(record.extendedDisplay.type, 0);
do_check_eq(record.extendedDisplay.records.length, 3);
do_check_eq(record.extendedDisplay.records[0].tag, 0x80);
do_check_eq(record.extendedDisplay.records[1].tag, 0x81);
do_check_eq(record.extendedDisplay.records[2].tag, 0x9B);
do_check_eq(record.extendedDisplay.records[2].content, "Test Info");
do_check_eq(records[0].display, "Test Info 1");
do_check_eq(records[1].display, "Test Info 2");
run_next_test();
});
/**
* Verify decoder for multiple types
*/
add_test(function test_multiple() {
let worker = newWorkerWithParcel([
0x02, // two inforemation record
0x00, // type: display
0x0B, // length: 11
0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E, 0x66,
0x6F, 0x20, 0x31, 0x00,
0x00, // type: display
0x0B, // length: 11
0x54, 0x65, 0x73, 0x74, 0x20, 0x49, 0x6E, 0x66,
0x6F, 0x20, 0x32, 0x00]);
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].display, "Test Info 1");
do_check_eq(records[1].display, "Test Info 2");
run_next_test();
});
/**
* Verify decoder for Signal Type
*/
add_test(function test_signal() {
let worker = newWorkerWithParcel([
0x01, // one inforemation record
0x04, // type: signal
0x01, // isPresent: non-zero
0x00, // signalType: Tone signal (00)
0x01, // alertPitch: High pitch
0x03]); // signal: Abbreviated intercept (000011)
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].signal.type, 0x00);
do_check_eq(records[0].signal.alertPitch, 0x01);
do_check_eq(records[0].signal.signal, 0x03);
run_next_test();
});
/**
* Verify decoder for Signal Type for Not Presented
*/
add_test(function test_signal_not_present() {
let worker = newWorkerWithParcel([
0x01, // one inforemation record
0x04, // type: signal
0x00, // isPresent: zero
0x00, // signalType: Tone signal (00)
0x01, // alertPitch: High pitch
0x03]); // signal: Abbreviated intercept (000011)
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records.length, 0);
run_next_test();
});
/**
* Verify decoder for Line Control
*/
add_test(function test_line_control() {
let worker = newWorkerWithParcel([
0x01, // one inforemation record
0x06, // type: line control
0x01, // polarity included
0x00, // not toggled
0x01, // reversed
0xFF]); // Power denial timeout: 255 * 5 ms
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].lineControl.polarityIncluded, 1);
do_check_eq(records[0].lineControl.toggle, 0);
do_check_eq(records[0].lineControl.reverse, 1);
do_check_eq(records[0].lineControl.powerDenial, 255);
run_next_test();
});
/**
* Verify decoder for CLIR Cause
*/
add_test(function test_clir() {
let worker = newWorkerWithParcel([
0x01, // one inforemation record
0x08, // type: clir
0x01]); // cause: Rejected by user
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].clirCause, 1);
run_next_test();
});
/**
* Verify decoder for Audio Control
*/
add_test(function test_clir() {
let worker = newWorkerWithParcel([
0x01, // one inforemation record
0x0A, // type: audio control
0x01, // uplink
0xFF]); // downlink
let context = worker.ContextPool._contexts[0];
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].audioControl.upLink, 1);
do_check_eq(records[0].audioControl.downLink, 255);
run_next_test();
});

View File

@ -227,13 +227,6 @@ WifiCertService::Start(nsIWifiEventListener* aListener)
{
MOZ_ASSERT(aListener);
nsresult rv = NS_NewThread(getter_AddRefs(mRequestThread));
if (NS_FAILED(rv)) {
NS_WARNING("Certn't create wifi control thread");
Shutdown();
return NS_ERROR_FAILURE;
}
mListener = aListener;
return NS_OK;
@ -243,10 +236,6 @@ NS_IMETHODIMP
WifiCertService::Shutdown()
{
MOZ_ASSERT(NS_IsMainThread());
if (mRequestThread) {
mRequestThread->Shutdown();
mRequestThread = nullptr;
}
mListener = nullptr;

View File

@ -27,7 +27,6 @@ public:
private:
WifiCertService();
~WifiCertService();
nsCOMPtr<nsIThread> mRequestThread;
nsCOMPtr<nsIWifiEventListener> mListener;
};

View File

@ -1859,7 +1859,7 @@ function WifiWorker() {
var pub = new Network(ssid, security, password);
if (net.identity)
pub.identity = dequote(net.identity);
if (net.netId)
if ("netId" in net)
pub.known = true;
if (net.scan_ssid === 1)
pub.hidden = true;

View File

@ -47,8 +47,6 @@ extern PRLogModuleInfo* gRtspLog;
#undef LOG
#define LOG(args) PR_LOG(gRtspLog, PR_LOG_DEBUG, args)
const unsigned long kCommandDelayMs = 200;
namespace mozilla {
namespace net {
@ -59,10 +57,7 @@ NS_IMPL_ISUPPORTS(RtspController,
nsIStreamingProtocolController)
RtspController::RtspController(nsIChannel *channel)
: mState(INIT),
mTimerLock("RtspController.mTimerLock"),
mPlayTimer(nullptr),
mPauseTimer(nullptr)
: mState(INIT)
{
LOG(("RtspController::RtspController()"));
}
@ -99,26 +94,7 @@ RtspController::Play(void)
return NS_ERROR_NOT_CONNECTED;
}
MutexAutoLock lock(mTimerLock);
// Cancel the pause timer if it is active because successive pause-play in a
// short duration is unnecessary but could impair playback smoothing.
if (mPauseTimer) {
mPauseTimer->Cancel();
mPauseTimer = nullptr;
}
// Start a timer to delay the play operation for a short duration.
if (!mPlayTimer) {
mPlayTimer = do_CreateInstance("@mozilla.org/timer;1");
if (!mPlayTimer) {
return NS_ERROR_NOT_INITIALIZED;
}
mPlayTimer->InitWithFuncCallback(
RtspController::PlayTimerCallback,
this, kCommandDelayMs,
nsITimer::TYPE_ONE_SHOT);
}
mRtspSource->play();
return NS_OK;
}
@ -135,26 +111,7 @@ RtspController::Pause(void)
return NS_ERROR_NOT_CONNECTED;
}
MutexAutoLock lock(mTimerLock);
// Cancel the play timer if it is active because successive play-pause in a
// short duration is unnecessary but could impair playback smoothing.
if (mPlayTimer) {
mPlayTimer->Cancel();
mPlayTimer = nullptr;
}
// Start a timer to delay the pause operation for a short duration.
if (!mPauseTimer) {
mPauseTimer = do_CreateInstance("@mozilla.org/timer;1");
if (!mPauseTimer) {
return NS_ERROR_NOT_INITIALIZED;
}
mPauseTimer->InitWithFuncCallback(
RtspController::PauseTimerCallback,
this, kCommandDelayMs,
nsITimer::TYPE_ONE_SHOT);
}
mRtspSource->pause();
return NS_OK;
}
@ -360,19 +317,6 @@ RtspController::OnDisconnected(uint8_t index,
LOG(("RtspController::OnDisconnected() for track %d reason = 0x%x", index, reason));
mState = DISCONNECTED;
// Ensure play and pause timer are stopped.
{
MutexAutoLock lock(mTimerLock);
if (mPlayTimer) {
mPlayTimer->Cancel();
mPlayTimer = nullptr;
}
if (mPauseTimer) {
mPauseTimer->Cancel();
mPauseTimer = nullptr;
}
}
if (mListener) {
nsRefPtr<SendOnDisconnectedTask> task =
new SendOnDisconnectedTask(mListener, index, reason);
@ -436,40 +380,5 @@ RtspController::PlaybackEnded()
return NS_OK;
}
//-----------------------------------------------------------------------------
// RtspController static member methods
//-----------------------------------------------------------------------------
//static
void RtspController::PlayTimerCallback(nsITimer *aTimer, void *aClosure)
{
MOZ_ASSERT(aTimer);
MOZ_ASSERT(aClosure);
RtspController *self = static_cast<RtspController*>(aClosure);
MOZ_ASSERT(self->mRtspSource.get());
MutexAutoLock lock(self->mTimerLock);
if (self->mPlayTimer) {
self->mRtspSource->play();
self->mPlayTimer = nullptr;
}
}
//static
void RtspController::PauseTimerCallback(nsITimer *aTimer, void *aClosure)
{
MOZ_ASSERT(aTimer);
MOZ_ASSERT(aClosure);
RtspController *self = static_cast<RtspController*>(aClosure);
MOZ_ASSERT(self->mRtspSource.get());
MutexAutoLock lock(self->mTimerLock);
if (self->mPauseTimer) {
self->mRtspSource->pause();
self->mPauseTimer = nullptr;
}
}
} // namespace mozilla::net
} // namespace mozilla

View File

@ -7,12 +7,10 @@
#ifndef RtspController_h
#define RtspController_h
#include "mozilla/Mutex.h"
#include "nsIStreamingProtocolController.h"
#include "nsIChannel.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsITimer.h"
#include "RTSPSource.h"
namespace mozilla {
@ -29,10 +27,6 @@ public:
RtspController(nsIChannel *channel);
~RtspController();
// These callbacks will be called when mPlayTimer/mPauseTimer fires.
static void PlayTimerCallback(nsITimer *aTimer, void *aClosure);
static void PauseTimerCallback(nsITimer *aTimer, void *aClosure);
private:
enum State {
INIT,
@ -53,13 +47,6 @@ private:
State mState;
// Rtsp Streaming source.
android::sp<android::RTSPSource> mRtspSource;
// This lock protects mPlayTimer and mPauseTimer.
Mutex mTimerLock;
// Timers to delay the play and pause operations.
// They are used for optimization and avoid sending unnecessary requests to
// the server.
nsCOMPtr<nsITimer> mPlayTimer;
nsCOMPtr<nsITimer> mPauseTimer;
};
}

View File

@ -21,6 +21,8 @@ PRLogModuleInfo* gRtspChildLog = nullptr;
#define LOG(args) PR_LOG(gRtspChildLog, PR_LOG_DEBUG, args)
const uint32_t kRtspTotalTracks = 2;
const unsigned long kRtspCommandDelayMs = 200;
using namespace mozilla::ipc;
namespace mozilla {
@ -64,6 +66,9 @@ RtspControllerChild::RtspControllerChild(nsIChannel *channel)
, mChannel(channel)
, mTotalTracks(0)
, mSuspendCount(0)
, mTimerLock("RtspControllerChild.mTimerLock")
, mPlayTimer(nullptr)
, mPauseTimer(nullptr)
{
#if defined(PR_LOGGING)
if (!gRtspChildLog)
@ -108,6 +113,20 @@ RtspControllerChild::DisallowIPC()
mIPCAllowed = false;
}
void
RtspControllerChild::StopPlayAndPauseTimer()
{
MutexAutoLock lock(mTimerLock);
if (mPlayTimer) {
mPlayTimer->Cancel();
mPlayTimer = nullptr;
}
if (mPauseTimer) {
mPauseTimer->Cancel();
mPauseTimer = nullptr;
}
}
//-----------------------------------------------------------------------------
// RtspControllerChild::PRtspControllerChild
//-----------------------------------------------------------------------------
@ -174,6 +193,7 @@ RtspControllerChild::RecvOnDisconnected(
const uint8_t& index,
const nsresult& reason)
{
StopPlayAndPauseTimer();
DisallowIPC();
LOG(("RtspControllerChild::RecvOnDisconnected for track %d reason = 0x%x", index, reason));
if (mListener) {
@ -186,6 +206,7 @@ RtspControllerChild::RecvOnDisconnected(
bool
RtspControllerChild::RecvAsyncOpenFailed(const nsresult& reason)
{
StopPlayAndPauseTimer();
DisallowIPC();
LOG(("RtspControllerChild::RecvAsyncOpenFailed reason = 0x%x", reason));
if (mListener) {
@ -234,8 +255,6 @@ enum IPCEvent
SendPlayEvent,
SendPauseEvent,
SendSeekEvent,
SendResumeEvent,
SendSuspendEvent,
SendStopEvent,
SendPlaybackEndedEvent
};
@ -275,10 +294,6 @@ public:
rv = mController->SendPause();
} else if (mEvent == SendSeekEvent) {
rv = mController->SendSeek(mSeekTime);
} else if (mEvent == SendResumeEvent) {
rv = mController->SendResume();
} else if (mEvent == SendSuspendEvent) {
rv = mController->SendSuspend();
} else if (mEvent == SendStopEvent) {
rv = mController->SendStop();
} else if (mEvent == SendPlaybackEndedEvent) {
@ -305,14 +320,30 @@ RtspControllerChild::Play(void)
{
LOG(("RtspControllerChild::Play()"));
if (NS_IsMainThread()) {
if (!OKToSendIPC() || !SendPlay()) {
return NS_ERROR_FAILURE;
MutexAutoLock lock(mTimerLock);
// Cancel the pause timer if it is active because successive pause-play in a
// short duration is unncessary but could impair playback smoothing.
if (mPauseTimer) {
mPauseTimer->Cancel();
mPauseTimer = nullptr;
}
// Start a timer to delay the play operation for a short duration.
if (!mPlayTimer) {
mPlayTimer = do_CreateInstance("@mozilla.org/timer;1");
if (!mPlayTimer) {
return NS_ERROR_NOT_INITIALIZED;
}
} else {
nsresult rv = NS_DispatchToMainThread(
new SendIPCEvent(this, SendPlayEvent));
NS_ENSURE_SUCCESS(rv, rv);
// We have to dispatch the timer callback to the main thread because the
// decoder thread is a thread from nsIThreadPool and cannot be the timer
// target. Furthermore, IPC send functions should only be called from the
// main thread.
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
mPlayTimer->SetTarget(mainThread);
mPlayTimer->InitWithFuncCallback(
RtspControllerChild::PlayTimerCallback,
this, kRtspCommandDelayMs,
nsITimer::TYPE_ONE_SHOT);
}
return NS_OK;
@ -323,14 +354,29 @@ RtspControllerChild::Pause(void)
{
LOG(("RtspControllerChild::Pause()"));
if (NS_IsMainThread()) {
if (!OKToSendIPC() || !SendPause()) {
return NS_ERROR_FAILURE;
MutexAutoLock lock(mTimerLock);
// Cancel the play timer if it is active because successive play-pause in a
// shrot duration is unnecessary but could impair playback smoothing.
if (mPlayTimer) {
mPlayTimer->Cancel();
mPlayTimer = nullptr;
}
// Start a timer to delay the pause operation for a short duration.
if (!mPauseTimer) {
mPauseTimer = do_CreateInstance("@mozilla.org/timer;1");
if (!mPauseTimer) {
return NS_ERROR_NOT_INITIALIZED;
}
} else {
nsresult rv = NS_DispatchToMainThread(
new SendIPCEvent(this, SendPauseEvent));
NS_ENSURE_SUCCESS(rv, rv);
// We have to dispatch the timer callback to the main thread because the
// decoder thread is a thread from nsIThreadPool and cannot be the timer
// target.
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
mPauseTimer->SetTarget(mainThread);
mPauseTimer->InitWithFuncCallback(
RtspControllerChild::PauseTimerCallback,
this, kRtspCommandDelayMs,
nsITimer::TYPE_ONE_SHOT);
}
return NS_OK;
@ -343,15 +389,7 @@ RtspControllerChild::Resume(void)
NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED);
if (!--mSuspendCount) {
if (NS_IsMainThread()) {
if (!OKToSendIPC() || !SendResume()) {
return NS_ERROR_FAILURE;
}
} else {
nsresult rv = NS_DispatchToMainThread(
new SendIPCEvent(this, SendResumeEvent));
NS_ENSURE_SUCCESS(rv, rv);
}
return Play();
}
return NS_OK;
@ -363,15 +401,7 @@ RtspControllerChild::Suspend(void)
LOG(("RtspControllerChild::Suspend()"));
if (!mSuspendCount++) {
if (NS_IsMainThread()) {
if (!OKToSendIPC() || !SendSuspend()) {
return NS_ERROR_FAILURE;
}
} else {
nsresult rv = NS_DispatchToMainThread(
new SendIPCEvent(this, SendSuspendEvent));
NS_ENSURE_SUCCESS(rv, rv);
}
return Pause();
}
return NS_OK;
@ -399,6 +429,7 @@ NS_IMETHODIMP
RtspControllerChild::Stop()
{
LOG(("RtspControllerChild::Stop()"));
StopPlayAndPauseTimer();
if (NS_IsMainThread()) {
if (!OKToSendIPC() || !SendStop()) {
@ -542,5 +573,44 @@ RtspControllerChild::AsyncOpen(nsIStreamingProtocolListener *aListener)
return NS_OK;
}
//-----------------------------------------------------------------------------
// RtspControllerChild static member methods
//-----------------------------------------------------------------------------
//static
void
RtspControllerChild::PlayTimerCallback(nsITimer *aTimer, void *aClosure)
{
MOZ_ASSERT(aTimer);
MOZ_ASSERT(aClosure);
MOZ_ASSERT(NS_IsMainThread());
RtspControllerChild *self = static_cast<RtspControllerChild*>(aClosure);
MutexAutoLock lock(self->mTimerLock);
if (!self->mPlayTimer || !self->OKToSendIPC()) {
return;
}
self->SendPlay();
self->mPlayTimer = nullptr;
}
//static
void
RtspControllerChild::PauseTimerCallback(nsITimer *aTimer, void *aClosure)
{
MOZ_ASSERT(aTimer);
MOZ_ASSERT(aClosure);
MOZ_ASSERT(NS_IsMainThread());
RtspControllerChild *self = static_cast<RtspControllerChild*>(aClosure);
MutexAutoLock lock(self->mTimerLock);
if (!self->mPauseTimer || !self->OKToSendIPC()) {
return;
}
self->SendPause();
self->mPauseTimer = nullptr;
}
} // namespace net
} // namespace mozilla

View File

@ -14,6 +14,8 @@
#include "nsString.h"
#include "nsTArray.h"
#include "mozilla/net/RtspChannelChild.h"
#include "mozilla/Mutex.h"
#include "nsITimer.h"
namespace mozilla {
namespace net {
@ -52,6 +54,10 @@ class RtspControllerChild : public nsIStreamingProtocolController
void AllowIPC();
void DisallowIPC();
// These callbacks will be called when mPlayTimer/mPauseTimer fires.
static void PlayTimerCallback(nsITimer *aTimer, void *aClosure);
static void PauseTimerCallback(nsITimer *aTimer, void *aClosure);
private:
bool mIPCOpen;
// The intention of this variable is just to avoid any IPC message to be sent
@ -73,6 +79,16 @@ class RtspControllerChild : public nsIStreamingProtocolController
uint32_t mSuspendCount;
// Detach channel-controller relationship.
void ReleaseChannel();
// This lock protects mPlayTimer and mPauseTimer.
Mutex mTimerLock;
// Timers to delay the play and pause operations.
// They are used for optimization and to avoid sending unnecessary requests to
// the server.
nsCOMPtr<nsITimer> mPlayTimer;
nsCOMPtr<nsITimer> mPauseTimer;
// Timers should be stopped if we are going to terminate, such as when
// receiving Stop command or OnDisconnected event.
void StopPlayAndPauseTimer();
};
} // namespace net
} // namespace mozilla