Merge b2g-inbound to m-c a=merge

This commit is contained in:
Wes Kocher 2014-10-08 16:49:26 -07:00
commit 26c0b8d5e5
29 changed files with 400 additions and 158 deletions

View File

@ -15,9 +15,9 @@
<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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>

View File

@ -19,8 +19,8 @@
<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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>

View File

@ -17,8 +17,8 @@
</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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6ca2008ac50b163d31244ef9f036cb224f4f229b"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

View File

@ -15,9 +15,9 @@
<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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>

View File

@ -19,8 +19,8 @@
<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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>

View File

@ -15,9 +15,9 @@
<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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>

View File

@ -17,8 +17,8 @@
</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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6ca2008ac50b163d31244ef9f036cb224f4f229b"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "3adc8626bd88ae4a8782d2f478656e8d52d805c2",
"revision": "9d8c254abad2ceaad8f1ae22a18e0f36af5860c4",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,8 +17,8 @@
<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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

View File

@ -15,8 +15,8 @@
<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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

View File

@ -17,8 +17,8 @@
</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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6ca2008ac50b163d31244ef9f036cb224f4f229b"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

View File

@ -17,8 +17,8 @@
<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="2665e714beea5dc433862ca6bb8d2b47ffe2f2d1"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7b92615bdc97e5c675cd385ec68bc5e47e0c5288"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="a42f56ffac1c52e5bbc82143a949feeed359d528"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

View File

@ -1828,6 +1828,10 @@ this.DOMApplicationRegistry = {
aApp.redirects = this.sanitizeRedirects(aNewManifest.redirects);
}
let manifest =
new ManifestHelper(aNewManifest, aApp.origin, aApp.manifestURL);
this._saveWidgetsFullPath(manifest, aApp);
if (supportSystemMessages()) {
if (aOldManifest) {
this._unregisterActivities(aOldManifest, aApp);
@ -2171,7 +2175,6 @@ this.DOMApplicationRegistry = {
aApp.name = aNewManifest.name;
aApp.csp = manifest.csp || "";
this._saveWidgetsFullPath(manifest, aApp);
aApp.updateTime = Date.now();
}

49
dom/icc/Assertions.cpp Normal file
View File

@ -0,0 +1,49 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/MozIccBinding.h"
#include "nsIIccProvider.h"
namespace mozilla {
namespace dom {
#define ASSERT_ICC_CARD_STATE_EQUALITY(webidlState, xpidlState) \
static_assert(static_cast<uint32_t>(IccCardState::webidlState) == nsIIccProvider::xpidlState, \
"IccCardState::" #webidlState " should equal to nsIIccProvider::" #xpidlState)
ASSERT_ICC_CARD_STATE_EQUALITY(Unknown, CARD_STATE_UNKNOWN);
ASSERT_ICC_CARD_STATE_EQUALITY(Ready, CARD_STATE_READY);
ASSERT_ICC_CARD_STATE_EQUALITY(PinRequired, CARD_STATE_PIN_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(PukRequired, CARD_STATE_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(PermanentBlocked, CARD_STATE_PERMANENT_BLOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(PersonalizationInProgress, CARD_STATE_PERSONALIZATION_IN_PROGRESS);
ASSERT_ICC_CARD_STATE_EQUALITY(PersonalizationReady, CARD_STATE_PERSONALIZATION_READY);
ASSERT_ICC_CARD_STATE_EQUALITY(NetworkLocked, CARD_STATE_NETWORK_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(NetworkSubsetLocked, CARD_STATE_NETWORK_SUBSET_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(CorporateLocked, CARD_STATE_CORPORATE_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(ServiceProviderLocked, CARD_STATE_SERVICE_PROVIDER_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(SimPersonalizationLocked, CARD_STATE_SIM_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(NetworkPukRequired, CARD_STATE_NETWORK_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(NetworkSubsetPukRequired, CARD_STATE_NETWORK_SUBSET_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(CorporatePukRequired, CARD_STATE_CORPORATE_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(ServiceProviderPukRequired, CARD_STATE_SERVICE_PROVIDER_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(SimPersonalizationPukRequired, CARD_STATE_SIM_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(Network1Locked, CARD_STATE_NETWORK1_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(Network2Locked, CARD_STATE_NETWORK2_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(HrpdNetworkLocked, CARD_STATE_HRPD_NETWORK_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(RuimCorporateLocked, CARD_STATE_RUIM_CORPORATE_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(RuimServiceProviderLocked, CARD_STATE_RUIM_SERVICE_PROVIDER_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(RuimPersonalizationLocked, CARD_STATE_RUIM_LOCKED);
ASSERT_ICC_CARD_STATE_EQUALITY(Network1PukRequired, CARD_STATE_NETWORK1_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(Network2PukRequired, CARD_STATE_NETWORK2_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(HrpdNetworkPukRequired, CARD_STATE_HRPD_NETWORK_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(RuimCorporatePukRequired, CARD_STATE_RUIM_CORPORATE_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(RuimServiceProviderPukRequired, CARD_STATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(RuimPersonalizationPukRequired, CARD_STATE_RUIM_PUK_REQUIRED);
ASSERT_ICC_CARD_STATE_EQUALITY(Illegal, CARD_STATE_ILLEGAL);
#undef ASSERT_ICC_CARD_STATE_EQUALITY
} // namespace dom
} // namespace mozilla

View File

@ -6,7 +6,6 @@
#include "mozilla/dom/DOMRequest.h"
#include "mozilla/dom/IccInfo.h"
#include "mozilla/dom/MozIccBinding.h"
#include "mozilla/dom/MozStkCommandEvent.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsIIccInfo.h"
@ -136,19 +135,20 @@ Icc::GetIccInfo(Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo>& aIccI
aIccInfo = mIccInfo;
}
void
Icc::GetCardState(nsString& aCardState) const
Nullable<IccCardState>
Icc::GetCardState() const
{
aCardState.SetIsVoid(true);
Nullable<IccCardState> result;
if (!mProvider) {
return;
uint32_t cardState = nsIIccProvider::CARD_STATE_UNDETECTED;
if (mProvider &&
NS_SUCCEEDED(mProvider->GetCardState(mClientId, &cardState)) &&
cardState != nsIIccProvider::CARD_STATE_UNDETECTED) {
MOZ_ASSERT(cardState < static_cast<uint32_t>(IccCardState::EndGuard_));
result.SetValue(static_cast<IccCardState>(cardState));
}
nsresult rv = mProvider->GetCardState(mClientId, aCardState);
if (NS_FAILED(rv)) {
aCardState.SetIsVoid(true);
}
return result;
}
void

View File

@ -5,6 +5,7 @@
#ifndef mozilla_dom_Icc_h
#define mozilla_dom_Icc_h
#include "mozilla/dom/MozIccBinding.h" // For IccCardState
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/DOMEventTargetHelper.h"
@ -57,8 +58,8 @@ public:
void
GetIccInfo(Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo>& aIccInfo) const;
void
GetCardState(nsString& aCardState) const;
Nullable<IccCardState>
GetCardState() const;
void
SendStkResponse(const JSContext* aCx, JS::Handle<JS::Value> aCommand,

View File

@ -20,9 +20,43 @@ interface nsIIccListener : nsISupports
/**
* XPCOM component (in the content process) that provides the ICC information.
*/
[scriptable, uuid(1afa72d0-3d70-11e4-916c-0800200c9a66)]
[scriptable, uuid(bf802bf0-4df2-11e4-916c-0800200c9a66)]
interface nsIIccProvider : nsISupports
{
// MUST match enum IccCardState in MozIcc.webidl!
const unsigned long CARD_STATE_UNKNOWN = 0;
const unsigned long CARD_STATE_READY = 1;
const unsigned long CARD_STATE_PIN_REQUIRED = 2;
const unsigned long CARD_STATE_PUK_REQUIRED = 3;
const unsigned long CARD_STATE_PERMANENT_BLOCKED = 4;
const unsigned long CARD_STATE_PERSONALIZATION_IN_PROGRESS = 5;
const unsigned long CARD_STATE_PERSONALIZATION_READY = 6;
const unsigned long CARD_STATE_NETWORK_LOCKED = 7;
const unsigned long CARD_STATE_NETWORK_SUBSET_LOCKED = 8;
const unsigned long CARD_STATE_CORPORATE_LOCKED = 9;
const unsigned long CARD_STATE_SERVICE_PROVIDER_LOCKED = 10;
const unsigned long CARD_STATE_SIM_LOCKED = 11;
const unsigned long CARD_STATE_NETWORK_PUK_REQUIRED = 12;
const unsigned long CARD_STATE_NETWORK_SUBSET_PUK_REQUIRED = 13;
const unsigned long CARD_STATE_CORPORATE_PUK_REQUIRED = 14;
const unsigned long CARD_STATE_SERVICE_PROVIDER_PUK_REQUIRED = 15;
const unsigned long CARD_STATE_SIM_PUK_REQUIRED = 16;
const unsigned long CARD_STATE_NETWORK1_LOCKED = 17;
const unsigned long CARD_STATE_NETWORK2_LOCKED = 18;
const unsigned long CARD_STATE_HRPD_NETWORK_LOCKED = 19;
const unsigned long CARD_STATE_RUIM_CORPORATE_LOCKED = 20;
const unsigned long CARD_STATE_RUIM_SERVICE_PROVIDER_LOCKED = 21;
const unsigned long CARD_STATE_RUIM_LOCKED = 22;
const unsigned long CARD_STATE_NETWORK1_PUK_REQUIRED = 23;
const unsigned long CARD_STATE_NETWORK2_PUK_REQUIRED = 24;
const unsigned long CARD_STATE_HRPD_NETWORK_PUK_REQUIRED = 25;
const unsigned long CARD_STATE_RUIM_CORPORATE_PUK_REQUIRED = 26;
const unsigned long CARD_STATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED = 27;
const unsigned long CARD_STATE_RUIM_PUK_REQUIRED = 28;
const unsigned long CARD_STATE_ILLEGAL = 29;
const unsigned long CARD_STATE_UNDETECTED = 4294967295; // UINT32_MAX
/**
* Called when a content process registers receiving unsolicited messages from
* RadioInterfaceLayer in the chrome process. Only a content process that has
@ -38,8 +72,10 @@ interface nsIIccProvider : nsISupports
/**
* Card State
*
* One of the nsIIccProvider.CARD_STATE_* values.
*/
DOMString getCardState(in unsigned long clientId);
unsigned long getCardState(in unsigned long clientId);
/**
* STK interfaces.

View File

@ -13,6 +13,7 @@ EXPORTS.mozilla.dom += [
]
UNIFIED_SOURCES += [
'Assertions.cpp',
'Icc.cpp',
"IccInfo.cpp",
'IccListener.cpp',

View File

@ -420,7 +420,8 @@ MmsConnection.prototype = {
if (getRadioDisabledState()) {
if (DEBUG) debug("Error! Radio is disabled when sending MMS.");
errorStatus = _HTTP_STATUS_RADIO_DISABLED;
} else if (this.radioInterface.rilContext.cardState != "ready") {
} else if (this.radioInterface.rilContext.cardState !=
Ci.nsIIccProvider.CARD_STATE_READY) {
if (DEBUG) debug("Error! SIM card is not ready when sending MMS.");
errorStatus = _HTTP_STATUS_NO_SIM_CARD;
}

View File

@ -267,16 +267,17 @@ MozMtpDatabase::FileWatcherUpdate(RefCountedMtpServer* aMtpServer,
MtpObjectHandle entryHandle = FindEntryByPath(filePath);
if (aEventType.EqualsLiteral("created")) {
if (aEventType.EqualsLiteral("modified")) {
// To update the file information to the newest, we remove the entry for
// the existing file, then re-add the entry for the file.
if (entryHandle != 0) {
// The entry already exists. This means that we're being notified
// about a file added by MTP. So we can ignore it.
return;
MTP_LOG("About to call sendObjectRemoved Handle 0x%08x file %s", entryHandle, filePath.get());
aMtpServer->sendObjectRemoved(entryHandle);
RemoveEntry(entryHandle);
}
entryHandle = CreateEntryForFile(filePath, aFile);
if (entryHandle == 0) {
// CreateEntryForFile didn't create a new entry. We can't tell MTP.
// creating entry for the file failed, don't tell MTP
return;
}
MTP_LOG("About to call sendObjectAdded Handle 0x%08x file %s", entryHandle, filePath.get());
@ -289,10 +290,8 @@ MozMtpDatabase::FileWatcherUpdate(RefCountedMtpServer* aMtpServer,
// The entry has already been removed. We can't tell MTP.
return;
}
MTP_LOG("About to call sendObjectRemoved Handle 0x%08x file %s", entryHandle, filePath.get());
aMtpServer->sendObjectRemoved(entryHandle);
RemoveEntry(entryHandle);
return;
}
@ -616,11 +615,7 @@ MozMtpDatabase::endSendObject(const char* aPath,
if (aSucceeded) {
RefPtr<DbEntry> entry = GetEntry(aHandle);
if (entry) {
if (mBeginSendObjectCalled) {
FileWatcherNotify(entry, "created");
} else {
FileWatcherNotify(entry, "modified");
}
FileWatcherNotify(entry, "modified");
}
} else {
RemoveEntry(aHandle);

View File

@ -108,8 +108,9 @@ public:
}
NS_ConvertUTF16toUTF8 eventType(aData);
if (!eventType.EqualsLiteral("created") && !eventType.EqualsLiteral("deleted")) {
// MTP doesn't have a modified notification.
if (!eventType.EqualsLiteral("modified") && !eventType.EqualsLiteral("deleted")) {
// Bug 1074604: Needn't handle "created" event, once file operation
// finished, it would trigger "modified" event.
return NS_OK;
}

View File

@ -159,8 +159,8 @@ function RILContentHelper() {
this.rilContexts = [];
for (let clientId = 0; clientId < this.numClients; clientId++) {
this.rilContexts[clientId] = {
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
iccInfo: null
cardState: Ci.nsIIccProvider.CARD_STATE_UNKNOWN,
iccInfo: null
};
}

View File

@ -500,8 +500,8 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
_isCardPresentAtClient: function(clientId) {
let cardState = _ril.getRadioInterface(clientId).rilContext.cardState;
return cardState !== RIL.GECKO_CARDSTATE_UNDETECTED &&
cardState !== RIL.GECKO_CARDSTATE_UNKNOWN;
return cardState !== Ci.nsIIccProvider.CARD_STATE_UNDETECTED &&
cardState !== Ci.nsIIccProvider.CARD_STATE_UNKNOWN;
},
_isRadioAbleToEnableAtClient: function(clientId, numCards) {
@ -1800,7 +1800,7 @@ function RadioInterface(aClientId, aWorkerMessenger) {
aWorkerMessenger.registerClient(aClientId, this);
this.rilContext = {
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
cardState: Ci.nsIIccProvider.CARD_STATE_UNKNOWN,
iccInfo: null,
imsi: null
};
@ -3636,7 +3636,7 @@ RadioInterface.prototype = {
radioState == RIL.GECKO_RADIOSTATE_DISABLED) {
if (DEBUG) this.debug("Error! Radio is disabled when sending SMS.");
errorCode = Ci.nsIMobileMessageCallback.RADIO_DISABLED_ERROR;
} else if (this.rilContext.cardState != "ready") {
} else if (this.rilContext.cardState != Ci.nsIIccProvider.CARD_STATE_READY) {
if (DEBUG) this.debug("Error! SIM card is not ready when sending SMS.");
errorCode = Ci.nsIMobileMessageCallback.NO_SIM_CARD_ERROR;
}

View File

@ -23,10 +23,13 @@ interface nsIRilNetworkInterface : nsINetworkInterface
readonly attribute long mmsPort; // -1 if not set.
};
[scriptable, uuid(08a69c70-34b1-11e4-8c21-0800200c9a66)]
[scriptable, uuid(4441e660-4ad0-11e4-916c-0800200c9a66)]
interface nsIRilContext : nsISupports
{
readonly attribute DOMString cardState;
/**
* One of the nsIIccProvider.CARD_STATE_* values.
*/
readonly attribute unsigned long cardState;
readonly attribute DOMString imsi;

View File

@ -2492,38 +2492,40 @@ this.GECKO_RADIOSTATE_ENABLED = "enabled";
this.GECKO_RADIOSTATE_DISABLING = "disabling";
this.GECKO_RADIOSTATE_DISABLED = "disabled";
this.GECKO_CARDSTATE_UNINITIALIZED = "uninitialized";
this.GECKO_CARDSTATE_UNDETECTED = null;
this.GECKO_CARDSTATE_ILLEGAL = "illegal";
this.GECKO_CARDSTATE_UNKNOWN = "unknown";
this.GECKO_CARDSTATE_PIN_REQUIRED = "pinRequired";
this.GECKO_CARDSTATE_PUK_REQUIRED = "pukRequired";
this.GECKO_CARDSTATE_PERSONALIZATION_IN_PROGRESS = "personalizationInProgress";
this.GECKO_CARDSTATE_PERSONALIZATION_READY = "personalizationReady";
this.GECKO_CARDSTATE_NETWORK_LOCKED = "networkLocked";
this.GECKO_CARDSTATE_NETWORK_SUBSET_LOCKED = "networkSubsetLocked";
this.GECKO_CARDSTATE_NETWORK1_LOCKED = "network1Locked";
this.GECKO_CARDSTATE_NETWORK2_LOCKED = "network2Locked";
this.GECKO_CARDSTATE_HRPD_NETWORK_LOCKED = "hrpdNetworkLocked";
this.GECKO_CARDSTATE_CORPORATE_LOCKED = "corporateLocked";
this.GECKO_CARDSTATE_SERVICE_PROVIDER_LOCKED = "serviceProviderLocked";
this.GECKO_CARDSTATE_SIM_LOCKED = "simPersonalizationLock";
this.GECKO_CARDSTATE_RUIM_CORPORATE_LOCKED = "ruimCorporateLocked";
this.GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_LOCKED = "ruimServiceProviderLocked";
this.GECKO_CARDSTATE_RUIM_LOCKED = "ruimPersonalizationLock";
this.GECKO_CARDSTATE_NETWORK_PUK_REQUIRED = "networkPukRequired";
this.GECKO_CARDSTATE_NETWORK_SUBSET_PUK_REQUIRED = "networkSubsetPukRequired";
this.GECKO_CARDSTATE_NETWORK1_PUK_REQUIRED = "network1PukRequired";
this.GECKO_CARDSTATE_NETWORK2_PUK_REQUIRED = "network2PukRequired";
this.GECKO_CARDSTATE_HRPD_NETWORK_PUK_REQUIRED = "hrpdNetworkPukRequired";
this.GECKO_CARDSTATE_CORPORATE_PUK_REQUIRED = "corporatePukRequired";
this.GECKO_CARDSTATE_SERVICE_PROVIDER_PUK_REQUIRED = "serviceProviderPukRequired";
this.GECKO_CARDSTATE_SIM_PUK_REQUIRED = "simPersonalizationPukRequired";
this.GECKO_CARDSTATE_RUIM_CORPORATE_PUK_REQUIRED = "ruimCorporatePukRequired";
this.GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED = "ruimServiceProviderPukRequired";
this.GECKO_CARDSTATE_RUIM_PUK_REQUIRED = "ruimPersonalizationPukRequired";
this.GECKO_CARDSTATE_READY = "ready";
this.GECKO_CARDSTATE_PERMANENT_BLOCKED = "permanentBlocked";
// Only used in ril_worker.js
this.GECKO_CARDSTATE_UNINITIALIZED = 4294967294; // UINT32_MAX - 1
// See nsIIccProvider::CARD_STATE_*
this.GECKO_CARDSTATE_UNDETECTED = 4294967295; // UINT32_MAX
this.GECKO_CARDSTATE_UNKNOWN = 0;
this.GECKO_CARDSTATE_READY = 1;
this.GECKO_CARDSTATE_PIN_REQUIRED = 2;
this.GECKO_CARDSTATE_PUK_REQUIRED = 3;
this.GECKO_CARDSTATE_PERMANENT_BLOCKED = 4;
this.GECKO_CARDSTATE_PERSONALIZATION_IN_PROGRESS = 5;
this.GECKO_CARDSTATE_PERSONALIZATION_READY = 6;
this.GECKO_CARDSTATE_NETWORK_LOCKED = 7;
this.GECKO_CARDSTATE_NETWORK_SUBSET_LOCKED = 8;
this.GECKO_CARDSTATE_CORPORATE_LOCKED = 9;
this.GECKO_CARDSTATE_SERVICE_PROVIDER_LOCKED = 10;
this.GECKO_CARDSTATE_SIM_LOCKED = 11;
this.GECKO_CARDSTATE_NETWORK_PUK_REQUIRED = 12;
this.GECKO_CARDSTATE_NETWORK_SUBSET_PUK_REQUIRED = 13;
this.GECKO_CARDSTATE_CORPORATE_PUK_REQUIRED = 14;
this.GECKO_CARDSTATE_SERVICE_PROVIDER_PUK_REQUIRED = 15;
this.GECKO_CARDSTATE_SIM_PUK_REQUIRED = 16;
this.GECKO_CARDSTATE_NETWORK1_LOCKED = 17;
this.GECKO_CARDSTATE_NETWORK2_LOCKED = 18;
this.GECKO_CARDSTATE_HRPD_NETWORK_LOCKED = 19;
this.GECKO_CARDSTATE_RUIM_CORPORATE_LOCKED = 20;
this.GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_LOCKED = 21;
this.GECKO_CARDSTATE_RUIM_LOCKED = 22;
this.GECKO_CARDSTATE_NETWORK1_PUK_REQUIRED = 23;
this.GECKO_CARDSTATE_NETWORK2_PUK_REQUIRED = 24;
this.GECKO_CARDSTATE_HRPD_NETWORK_PUK_REQUIRED = 25;
this.GECKO_CARDSTATE_RUIM_CORPORATE_PUK_REQUIRED = 26;
this.GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED = 27;
this.GECKO_CARDSTATE_RUIM_PUK_REQUIRED = 28;
this.GECKO_CARDSTATE_ILLEGAL = 29;
this.GECKO_CARDLOCK_PIN = "pin";
this.GECKO_CARDLOCK_PIN2 = "pin2";
@ -2561,6 +2563,7 @@ PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_NETWORK_PUK] = GECKO_CARDSTATE_NETWORK_PUK
PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK] = GECKO_CARDSTATE_NETWORK_SUBSET_PUK_REQUIRED;
PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_CORPORATE_PUK] = GECKO_CARDSTATE_CORPORATE_PUK_REQUIRED;
PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK] = GECKO_CARDSTATE_SERVICE_PROVIDER_PUK_REQUIRED;
PERSONSUBSTATE[CARD_PERSOSUBSTATE_SIM_SIM_PUK] = GECKO_CARDSTATE_SIM_PUK_REQUIRED;
PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_NETWORK1] = GECKO_CARDSTATE_NETWORK1_LOCKED;
PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_NETWORK2] = GECKO_CARDSTATE_NETWORK2_LOCKED;
PERSONSUBSTATE[CARD_PERSOSUBSTATE_RUIM_HRPD] = GECKO_CARDSTATE_HRPD_NETWORK_LOCKED;

View File

@ -33,45 +33,65 @@ add_test(function test_personalization_state() {
// Test GSM personalization state.
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_NETWORK,
GECKO_CARDSTATE_NETWORK_LOCKED);
Ci.nsIIccProvider.CARD_STATE_NETWORK_LOCKED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_NETWORK_SUBSET,
Ci.nsIIccProvider.CARD_STATE_NETWORK_SUBSET_LOCKED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_CORPORATE,
GECKO_CARDSTATE_CORPORATE_LOCKED);
Ci.nsIIccProvider.CARD_STATE_CORPORATE_LOCKED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER,
GECKO_CARDSTATE_SERVICE_PROVIDER_LOCKED);
Ci.nsIIccProvider.CARD_STATE_SERVICE_PROVIDER_LOCKED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_SIM,
Ci.nsIIccProvider.CARD_STATE_SIM_LOCKED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_NETWORK_PUK,
GECKO_CARDSTATE_NETWORK_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_NETWORK_PUK_REQUIRED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK,
Ci.nsIIccProvider.CARD_STATE_NETWORK_SUBSET_PUK_REQUIRED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_CORPORATE_PUK,
GECKO_CARDSTATE_CORPORATE_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_CORPORATE_PUK_REQUIRED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK,
GECKO_CARDSTATE_SERVICE_PROVIDER_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_SERVICE_PROVIDER_PUK_REQUIRED);
testPersonalization(false, CARD_PERSOSUBSTATE_SIM_SIM_PUK,
Ci.nsIIccProvider.CARD_STATE_SIM_PUK_REQUIRED);
testPersonalization(false, CARD_PERSOSUBSTATE_UNKNOWN,
Ci.nsIIccProvider.CARD_STATE_UNKNOWN);
testPersonalization(false, CARD_PERSOSUBSTATE_IN_PROGRESS,
Ci.nsIIccProvider.CARD_STATE_PERSONALIZATION_IN_PROGRESS);
testPersonalization(false, CARD_PERSOSUBSTATE_READY,
GECKO_CARDSTATE_PERSONALIZATION_READY);
Ci.nsIIccProvider.CARD_STATE_PERSONALIZATION_READY);
// Test CDMA personalization state.
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_NETWORK1,
GECKO_CARDSTATE_NETWORK1_LOCKED);
Ci.nsIIccProvider.CARD_STATE_NETWORK1_LOCKED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_NETWORK2,
GECKO_CARDSTATE_NETWORK2_LOCKED);
Ci.nsIIccProvider.CARD_STATE_NETWORK2_LOCKED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_HRPD,
GECKO_CARDSTATE_HRPD_NETWORK_LOCKED);
Ci.nsIIccProvider.CARD_STATE_HRPD_NETWORK_LOCKED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_CORPORATE,
GECKO_CARDSTATE_RUIM_CORPORATE_LOCKED);
Ci.nsIIccProvider.CARD_STATE_RUIM_CORPORATE_LOCKED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER,
GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_LOCKED);
Ci.nsIIccProvider.CARD_STATE_RUIM_SERVICE_PROVIDER_LOCKED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_RUIM,
GECKO_CARDSTATE_RUIM_LOCKED);
Ci.nsIIccProvider.CARD_STATE_RUIM_LOCKED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_NETWORK1_PUK,
GECKO_CARDSTATE_NETWORK1_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_NETWORK1_PUK_REQUIRED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_NETWORK2_PUK,
GECKO_CARDSTATE_NETWORK2_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_NETWORK2_PUK_REQUIRED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_HRPD_PUK,
GECKO_CARDSTATE_HRPD_NETWORK_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_HRPD_NETWORK_PUK_REQUIRED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_CORPORATE_PUK,
GECKO_CARDSTATE_RUIM_CORPORATE_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_RUIM_CORPORATE_PUK_REQUIRED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK,
GECKO_CARDSTATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED);
testPersonalization(true, CARD_PERSOSUBSTATE_RUIM_RUIM_PUK,
GECKO_CARDSTATE_RUIM_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_RUIM_PUK_REQUIRED);
testPersonalization(true, CARD_PERSOSUBSTATE_UNKNOWN,
Ci.nsIIccProvider.CARD_STATE_UNKNOWN);
testPersonalization(true, CARD_PERSOSUBSTATE_IN_PROGRESS,
Ci.nsIIccProvider.CARD_STATE_PERSONALIZATION_IN_PROGRESS);
testPersonalization(true, CARD_PERSOSUBSTATE_READY,
Ci.nsIIccProvider.CARD_STATE_PERSONALIZATION_READY);
run_next_test();
});
@ -101,17 +121,17 @@ add_test(function test_card_app_state() {
}
testCardAppState(CARD_APPSTATE_ILLEGAL,
GECKO_CARDSTATE_ILLEGAL);
Ci.nsIIccProvider.CARD_STATE_ILLEGAL);
testCardAppState(CARD_APPSTATE_PIN,
GECKO_CARDSTATE_PIN_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_PIN_REQUIRED);
testCardAppState(CARD_APPSTATE_PUK,
GECKO_CARDSTATE_PUK_REQUIRED);
Ci.nsIIccProvider.CARD_STATE_PUK_REQUIRED);
testCardAppState(CARD_APPSTATE_READY,
GECKO_CARDSTATE_READY);
Ci.nsIIccProvider.CARD_STATE_READY);
testCardAppState(CARD_APPSTATE_UNKNOWN,
GECKO_CARDSTATE_UNKNOWN);
Ci.nsIIccProvider.CARD_STATE_UNKNOWN);
testCardAppState(CARD_APPSTATE_DETECTED,
GECKO_CARDSTATE_UNKNOWN);
Ci.nsIIccProvider.CARD_STATE_UNKNOWN);
run_next_test();
});
@ -139,7 +159,7 @@ add_test(function test_icc_permanent_blocked() {
};
ril._processICCStatus(iccStatus);
do_check_eq(ril.cardState, GECKO_CARDSTATE_PERMANENT_BLOCKED);
do_check_eq(ril.cardState, Ci.nsIIccProvider.CARD_STATE_PERMANENT_BLOCKED);
}
testPermanentBlocked(1,

View File

@ -2,6 +2,53 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
enum IccCardState {
"unknown", // ICC card state is either not yet reported from modem or in an
// unknown state.
"ready",
"pinRequired",
"pukRequired",
"permanentBlocked",
/**
* Personalization States
*/
"personalizationInProgress",
"personalizationReady",
// SIM Personalization States.
"networkLocked",
"networkSubsetLocked",
"corporateLocked",
"serviceProviderLocked",
"simPersonalizationLocked",
"networkPukRequired",
"networkSubsetPukRequired",
"corporatePukRequired",
"serviceProviderPukRequired",
"simPersonalizationPukRequired",
// RUIM Personalization States.
"network1Locked",
"network2Locked",
"hrpdNetworkLocked",
"ruimCorporateLocked",
"ruimServiceProviderLocked",
"ruimPersonalizationLocked",
"network1PukRequired",
"network2PukRequired",
"hrpdNetworkPukRequired",
"ruimCorporatePukRequired",
"ruimServiceProviderPukRequired",
"ruimPersonalizationPukRequired",
/**
* Additional States.
*/
"illegal" // See Bug 916000. An owed pay card will be rejected by the network
// and fall in this state.
};
[Pref="dom.icc.enabled"]
interface MozIcc : EventTarget
{
@ -27,21 +74,11 @@ interface MozIcc : EventTarget
/**
* Indicates the state of the device's ICC.
*
* Possible values: 'illegal', 'unknown', 'pinRequired', 'pukRequired',
* 'personalizationInProgress', 'networkLocked', 'network1Locked',
* 'network2Locked', 'hrpdNetworkLocked', 'corporateLocked',
* 'serviceProviderLocked', 'ruimCorporateLocked', 'ruimServiceProviderLocked',
* 'networkPukRequired', 'network1PukRequired', 'network2PukRequired',
* 'hrpdNetworkPukRequired', 'corporatePukRequired',
* 'serviceProviderPukRequired', 'ruimCorporatePukRequired',
* 'ruimServiceProviderPukRequired', 'personalizationReady', 'ready',
* 'permanentBlocked'.
*
* Once the ICC becomes undetectable, cardstatechange event will be notified.
* Also, the attribute is set to null and this MozIcc object becomes invalid.
* Calling asynchronous functions raises exception then.
*/
readonly attribute DOMString? cardState;
readonly attribute IccCardState? cardState;
/**
* The 'cardstatechange' event is notified when the 'cardState' attribute

View File

@ -47,14 +47,22 @@ extern PRLogModuleInfo* gRtspLog;
#undef LOG
#define LOG(args) PR_LOG(gRtspLog, PR_LOG_DEBUG, args)
const unsigned long kCommandDelayMs = 200;
namespace mozilla {
namespace net {
//-----------------------------------------------------------------------------
// RtspController
//-----------------------------------------------------------------------------
NS_IMPL_ISUPPORTS(RtspController,
nsIStreamingProtocolController)
RtspController::RtspController(nsIChannel *channel)
: mState(INIT)
: mState(INIT),
mTimerLock("RtspController.mTimerLock"),
mPlayTimer(nullptr),
mPauseTimer(nullptr)
{
LOG(("RtspController::RtspController()"));
}
@ -67,6 +75,9 @@ RtspController::~RtspController()
}
}
//-----------------------------------------------------------------------------
// nsIStreamingProtocolController
//-----------------------------------------------------------------------------
NS_IMETHODIMP
RtspController::GetTrackMetaData(uint8_t index,
nsIStreamingProtocolMetaData * *_retval)
@ -88,7 +99,26 @@ RtspController::Play(void)
return NS_ERROR_NOT_CONNECTED;
}
mRtspSource->play();
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);
}
return NS_OK;
}
@ -105,42 +135,39 @@ RtspController::Pause(void)
return NS_ERROR_NOT_CONNECTED;
}
mRtspSource->pause();
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);
}
return NS_OK;
}
NS_IMETHODIMP
RtspController::Resume(void)
{
LOG(("RtspController::Resume()"));
if (!mRtspSource.get()) {
MOZ_ASSERT(mRtspSource.get(), "mRtspSource should not be null!");
return NS_ERROR_NOT_INITIALIZED;
}
if (mState != CONNECTED) {
return NS_ERROR_NOT_CONNECTED;
}
mRtspSource->play();
return NS_OK;
return Play();
}
NS_IMETHODIMP
RtspController::Suspend(void)
{
LOG(("RtspController::Suspend()"));
if (!mRtspSource.get()) {
MOZ_ASSERT(mRtspSource.get(), "mRtspSource should not be null!");
return NS_ERROR_NOT_INITIALIZED;
}
if (mState != CONNECTED) {
return NS_ERROR_NOT_CONNECTED;
}
mRtspSource->pause();
return NS_OK;
return Pause();
}
NS_IMETHODIMP
@ -210,6 +237,9 @@ RtspController::AsyncOpen(nsIStreamingProtocolListener *aListener)
return NS_OK;
}
//-----------------------------------------------------------------------------
// nsIStreamingProtocolListener
//-----------------------------------------------------------------------------
class SendMediaDataTask : public nsRunnable
{
public:
@ -329,6 +359,20 @@ 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);
@ -392,5 +436,40 @@ 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,10 +7,12 @@
#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 {
@ -27,6 +29,10 @@ 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,
@ -47,6 +53,13 @@ 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;
};
}