Merge b2g-inbound to m-c. a=merge

This commit is contained in:
Ryan VanderMeulen 2014-10-06 16:45:26 -04:00
commit 83ddc7c9de
43 changed files with 680 additions and 204 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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9eec93462df6d01fe33a737bb4a185e9ad6cee15"/>

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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9eec93462df6d01fe33a737bb4a185e9ad6cee15"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "842fd7448790cfaeaf0bf22164e599c74e9be0e9",
"revision": "1e5360b21cca807b2ea63ea8fb878b451131c9bd",
"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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="9eec93462df6d01fe33a737bb4a185e9ad6cee15"/>

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="470826d13ae130a5c3d572d1029e595105485fb0"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="83de447d9ae9a59459d7a445f9348a254c661850"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -698,6 +698,11 @@ DOMInterfaces = {
'notflattened': True
},
'MozCdmaIccInfo': {
'headerFile': 'mozilla/dom/IccInfo.h',
'nativeType': 'mozilla::dom::CdmaIccInfo',
},
'MozCellBroadcast': {
'nativeType': 'mozilla::dom::CellBroadcast',
},
@ -711,10 +716,19 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::CellBroadcastMessage',
},
'MozGsmIccInfo': {
'headerFile': 'mozilla/dom/IccInfo.h',
'nativeType': 'mozilla::dom::GsmIccInfo',
},
'MozIcc': {
'nativeType': 'mozilla::dom::Icc',
},
'MozIccInfo': {
'nativeType': 'mozilla::dom::IccInfo',
},
'MozIccManager': {
'nativeType': 'mozilla::dom::IccManager',
},
@ -1794,7 +1808,6 @@ addExternalIface('MozControllers', nativeType='nsIControllers')
addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
addExternalIface('MozFrameRequestCallback', nativeType='nsIFrameRequestCallback',
notflattened=True)
addExternalIface('MozIccInfo', headerFile='nsIDOMIccInfo.h')
addExternalIface('MozMmsMessage')
addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',

View File

@ -16,7 +16,7 @@
#include "mozilla/StaticPtr.h"
#include "nsContentUtils.h"
#include "nsIAudioManager.h"
#include "nsIDOMIccInfo.h"
#include "nsIIccInfo.h"
#include "nsIIccProvider.h"
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionService.h"
@ -673,11 +673,11 @@ BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId)
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
NS_ENSURE_TRUE_VOID(icc);
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsCOMPtr<nsIIccInfo> iccInfo;
icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo));
NS_ENSURE_TRUE_VOID(iccInfo);
nsCOMPtr<nsIDOMMozGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
nsCOMPtr<nsIGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
NS_ENSURE_TRUE_VOID(gsmIccInfo);
gsmIccInfo->GetMsisdn(mMsisdn);
}

View File

@ -27,7 +27,7 @@
#include "mozilla/dom/SettingChangeNotificationBinding.h"
#ifdef MOZ_B2G_RIL
#include "nsIDOMIccInfo.h"
#include "nsIIccInfo.h"
#include "nsIIccProvider.h"
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionService.h"
@ -674,11 +674,11 @@ BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId)
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
NS_ENSURE_TRUE_VOID(icc);
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsCOMPtr<nsIIccInfo> iccInfo;
icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo));
NS_ENSURE_TRUE_VOID(iccInfo);
nsCOMPtr<nsIDOMMozGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
nsCOMPtr<nsIGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
NS_ENSURE_TRUE_VOID(gsmIccInfo);
gsmIccInfo->GetMsisdn(mMsisdn);
}

View File

@ -16,7 +16,7 @@
#include "mozilla/StaticPtr.h"
#include "nsContentUtils.h"
#include "nsIAudioManager.h"
#include "nsIDOMIccInfo.h"
#include "nsIIccInfo.h"
#include "nsIIccProvider.h"
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionService.h"
@ -678,11 +678,11 @@ BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId)
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
NS_ENSURE_TRUE_VOID(icc);
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsCOMPtr<nsIIccInfo> iccInfo;
icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo));
NS_ENSURE_TRUE_VOID(iccInfo);
nsCOMPtr<nsIDOMMozGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
nsCOMPtr<nsIGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
NS_ENSURE_TRUE_VOID(gsmIccInfo);
gsmIccInfo->GetMsisdn(mMsisdn);
}

View File

@ -27,7 +27,7 @@
#include "mozilla/dom/SettingChangeNotificationBinding.h"
#ifdef MOZ_B2G_RIL
#include "nsIDOMIccInfo.h"
#include "nsIIccInfo.h"
#include "nsIIccProvider.h"
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionService.h"
@ -674,11 +674,11 @@ BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId)
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
NS_ENSURE_TRUE_VOID(icc);
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsCOMPtr<nsIIccInfo> iccInfo;
icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo));
NS_ENSURE_TRUE_VOID(iccInfo);
nsCOMPtr<nsIDOMMozGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
nsCOMPtr<nsIGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
NS_ENSURE_TRUE_VOID(gsmIccInfo);
gsmIccInfo->GetMsisdn(mMsisdn);
}

View File

@ -2,29 +2,43 @@
* 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 "Icc.h"
#include "mozilla/dom/Icc.h"
#include "mozilla/dom/DOMRequest.h"
#include "mozilla/dom/IccInfo.h"
#include "mozilla/dom/MozIccBinding.h"
#include "mozilla/dom/MozStkCommandEvent.h"
#include "mozilla/dom/DOMRequest.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsIDOMIccInfo.h"
#include "nsIIccInfo.h"
#include "nsIIccProvider.h"
#include "nsJSON.h"
#include "nsRadioInterfaceLayer.h"
#include "nsServiceManagerUtils.h"
using namespace mozilla::dom;
Icc::Icc(nsPIDOMWindow* aWindow, long aClientId, const nsAString& aIccId)
NS_IMPL_CYCLE_COLLECTION_INHERITED(Icc, DOMEventTargetHelper, mIccInfo)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Icc)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(Icc, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(Icc, DOMEventTargetHelper)
Icc::Icc(nsPIDOMWindow* aWindow, long aClientId, nsIIccInfo* aIccInfo)
: mLive(true)
, mClientId(aClientId)
, mIccId(aIccId)
{
SetIsDOMBinding();
BindToOwner(aWindow);
mProvider = do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
if (aIccInfo) {
aIccInfo->GetIccid(mIccId);
UpdateIccInfo(aIccInfo);
}
// Not being able to acquire the provider isn't fatal since we check
// for it explicitly below.
if (!mProvider) {
@ -35,6 +49,7 @@ Icc::Icc(nsPIDOMWindow* aWindow, long aClientId, const nsAString& aIccId)
void
Icc::Shutdown()
{
mIccInfo.SetNull();
mProvider = nullptr;
mLive = false;
}
@ -74,6 +89,38 @@ Icc::NotifyStkEvent(const nsAString& aName, const nsAString& aMessage)
return DispatchTrustedEvent(event);
}
void
Icc::UpdateIccInfo(nsIIccInfo* aIccInfo)
{
if (!aIccInfo) {
mIccInfo.SetNull();
return;
}
nsCOMPtr<nsIGsmIccInfo> gsmIccInfo(do_QueryInterface(aIccInfo));
if (gsmIccInfo) {
if (mIccInfo.IsNull() || !mIccInfo.Value().IsMozGsmIccInfo()) {
mIccInfo.SetValue().SetAsMozGsmIccInfo() = new GsmIccInfo(GetOwner());
}
mIccInfo.Value().GetAsMozGsmIccInfo().get()->Update(gsmIccInfo);
return;
}
nsCOMPtr<nsICdmaIccInfo> cdmaIccInfo(do_QueryInterface(aIccInfo));
if (cdmaIccInfo) {
if (mIccInfo.IsNull() || !mIccInfo.Value().IsMozCdmaIccInfo()) {
mIccInfo.SetValue().SetAsMozCdmaIccInfo() = new CdmaIccInfo(GetOwner());
}
mIccInfo.Value().GetAsMozCdmaIccInfo().get()->Update(cdmaIccInfo);
return;
}
if (mIccInfo.IsNull() || !mIccInfo.Value().IsMozIccInfo()) {
mIccInfo.SetValue().SetAsMozIccInfo() = new IccInfo(GetOwner());
}
mIccInfo.Value().GetAsMozIccInfo().get()->Update(aIccInfo);
}
// WrapperCache
JSObject*
@ -84,20 +131,10 @@ Icc::WrapObject(JSContext* aCx)
// MozIcc WebIDL
already_AddRefed<nsIDOMMozIccInfo>
Icc::GetIccInfo() const
void
Icc::GetIccInfo(Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo>& aIccInfo) const
{
if (!mProvider) {
return nullptr;
}
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsresult rv = mProvider->GetIccInfo(mClientId, getter_AddRefs(iccInfo));
if (NS_FAILED(rv)) {
return nullptr;
}
return iccInfo.forget();
aIccInfo = mIccInfo;
}
void

View File

@ -5,8 +5,11 @@
#ifndef mozilla_dom_Icc_h
#define mozilla_dom_Icc_h
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "nsIIccProvider.h"
class nsIIccInfo;
class nsIIccProvider;
namespace mozilla {
namespace dom {
@ -16,9 +19,11 @@ class DOMRequest;
class Icc MOZ_FINAL : public DOMEventTargetHelper
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Icc, DOMEventTargetHelper)
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
Icc(nsPIDOMWindow* aWindow, long aClientId, const nsAString& aIccId);
Icc(nsPIDOMWindow* aWindow, long aClientId, nsIIccInfo* aIccInfo);
void
Shutdown();
@ -35,6 +40,9 @@ public:
return mIccId;
}
void
UpdateIccInfo(nsIIccInfo* aIccInfo);
nsPIDOMWindow*
GetParentObject() const
{
@ -46,8 +54,8 @@ public:
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
// MozIcc WebIDL
already_AddRefed<nsIDOMMozIccInfo>
GetIccInfo() const;
void
GetIccInfo(Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo>& aIccInfo) const;
void
GetCardState(nsString& aCardState) const;
@ -116,6 +124,7 @@ private:
// mProvider is a xpcom service and will be released at shutdown, so it
// doesn't need to be cycle collected.
nsCOMPtr<nsIIccProvider> mProvider;
Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo> mIccInfo;
};
} // namespace dom

230
dom/icc/IccInfo.cpp Normal file
View File

@ -0,0 +1,230 @@
/* 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/IccInfo.h"
#include "nsPIDOMWindow.h"
#define CONVERT_STRING_TO_NULLABLE_ENUM(_string, _enumType, _enum) \
{ \
uint32_t i = 0; \
for (const EnumEntry* entry = _enumType##Values::strings; \
entry->value; \
++entry, ++i) { \
if (_string.EqualsASCII(entry->value)) { \
_enum.SetValue(static_cast<_enumType>(i)); \
} \
} \
}
using namespace mozilla::dom;
// IccInfo
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(IccInfo, mWindow, mIccInfo)
NS_IMPL_CYCLE_COLLECTING_ADDREF(IccInfo)
NS_IMPL_CYCLE_COLLECTING_RELEASE(IccInfo)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IccInfo)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
IccInfo::IccInfo(nsPIDOMWindow* aWindow)
: mWindow(aWindow)
{
SetIsDOMBinding();
}
void
IccInfo::Update(nsIIccInfo* aInfo)
{
mIccInfo = aInfo;
}
JSObject*
IccInfo::WrapObject(JSContext* aCx)
{
return MozIccInfoBinding::Wrap(aCx, this);
}
Nullable<IccType>
IccInfo::GetIccType() const
{
if (!mIccInfo) {
return Nullable<IccType>();
}
nsAutoString type;
Nullable<IccType> iccType;
mIccInfo->GetIccType(type);
CONVERT_STRING_TO_NULLABLE_ENUM(type, IccType, iccType);
return iccType;
}
void
IccInfo::GetIccid(nsAString& aIccId) const
{
if (!mIccInfo) {
aIccId.SetIsVoid(true);
return;
}
mIccInfo->GetIccid(aIccId);
}
void
IccInfo::GetMcc(nsAString& aMcc) const
{
if (!mIccInfo) {
aMcc.SetIsVoid(true);
return;
}
mIccInfo->GetMcc(aMcc);
}
void
IccInfo::GetMnc(nsAString& aMnc) const
{
if (!mIccInfo) {
aMnc.SetIsVoid(true);
return;
}
mIccInfo->GetMnc(aMnc);
}
void
IccInfo::GetSpn(nsAString& aSpn) const
{
if (!mIccInfo) {
aSpn.SetIsVoid(true);
return;
}
mIccInfo->GetSpn(aSpn);
}
bool
IccInfo::IsDisplayNetworkNameRequired() const
{
if (!mIccInfo) {
return false;
}
bool isDisplayNetworkNameRequired;
mIccInfo->GetIsDisplayNetworkNameRequired(&isDisplayNetworkNameRequired);
return isDisplayNetworkNameRequired;
}
bool
IccInfo::IsDisplaySpnRequired() const
{
if (!mIccInfo) {
return false;
}
bool isDisplaySpnRequired;
mIccInfo->GetIsDisplaySpnRequired(&isDisplaySpnRequired);
return isDisplaySpnRequired;
}
// GsmIccInfo
NS_IMPL_CYCLE_COLLECTION_INHERITED(GsmIccInfo, IccInfo, mGsmIccInfo)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(GsmIccInfo)
NS_INTERFACE_MAP_END_INHERITING(IccInfo)
NS_IMPL_ADDREF_INHERITED(GsmIccInfo, IccInfo)
NS_IMPL_RELEASE_INHERITED(GsmIccInfo, IccInfo)
GsmIccInfo::GsmIccInfo(nsPIDOMWindow* aWindow)
: IccInfo(aWindow)
{
SetIsDOMBinding();
}
void
GsmIccInfo::Update(nsIGsmIccInfo* aInfo)
{
IccInfo::Update(aInfo);
mGsmIccInfo = aInfo;
}
JSObject*
GsmIccInfo::WrapObject(JSContext* aCx)
{
return MozGsmIccInfoBinding::Wrap(aCx, this);
}
void
GsmIccInfo::GetMsisdn(nsAString& aMsisdn) const
{
if (!mGsmIccInfo) {
aMsisdn.SetIsVoid(true);
return;
}
mGsmIccInfo->GetMsisdn(aMsisdn);
}
// CdmaIccInfo
NS_IMPL_CYCLE_COLLECTION_INHERITED(CdmaIccInfo, IccInfo, mCdmaIccInfo)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(CdmaIccInfo)
NS_INTERFACE_MAP_END_INHERITING(IccInfo)
NS_IMPL_ADDREF_INHERITED(CdmaIccInfo, IccInfo)
NS_IMPL_RELEASE_INHERITED(CdmaIccInfo, IccInfo)
CdmaIccInfo::CdmaIccInfo(nsPIDOMWindow* aWindow)
: IccInfo(aWindow)
{
SetIsDOMBinding();
}
void
CdmaIccInfo::Update(nsICdmaIccInfo* aInfo)
{
IccInfo::Update(aInfo);
mCdmaIccInfo = aInfo;
}
JSObject*
CdmaIccInfo::WrapObject(JSContext* aCx)
{
return MozCdmaIccInfoBinding::Wrap(aCx, this);
}
void
CdmaIccInfo::GetMdn(nsAString& aMdn) const
{
if (!mCdmaIccInfo) {
aMdn.SetIsVoid(true);
return;
}
mCdmaIccInfo->GetMdn(aMdn);
}
int32_t
CdmaIccInfo::PrlVersion() const
{
if (!mCdmaIccInfo) {
return 0;
}
int32_t prlVersion;
mCdmaIccInfo->GetPrlVersion(&prlVersion);
return prlVersion;
}

128
dom/icc/IccInfo.h Normal file
View File

@ -0,0 +1,128 @@
/* 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/. */
#ifndef mozilla_dom_IccInfo_h
#define mozilla_dom_IccInfo_h
#include "MozIccInfoBinding.h"
#include "nsIIccInfo.h"
#include "nsWrapperCache.h"
class nsPIDOMWindow;
namespace mozilla {
namespace dom {
class IccInfo : public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IccInfo)
explicit IccInfo(nsPIDOMWindow* aWindow);
void
Update(nsIIccInfo* aInfo);
nsPIDOMWindow*
GetParentObject() const
{
return mWindow;
}
// WrapperCache
virtual JSObject*
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
// WebIDL interface
Nullable<IccType>
GetIccType() const;
void
GetIccid(nsAString& aIccId) const;
void
GetMcc(nsAString& aMcc) const;
void
GetMnc(nsAString& aMnc) const;
void
GetSpn(nsAString& aSpn) const;
bool
IsDisplayNetworkNameRequired() const;
bool
IsDisplaySpnRequired() const;
protected:
~IccInfo() {}
protected:
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsIIccInfo> mIccInfo;
};
class GsmIccInfo MOZ_FINAL : public IccInfo
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(GsmIccInfo, IccInfo)
explicit GsmIccInfo(nsPIDOMWindow* aWindow);
void
Update(nsIGsmIccInfo* aInfo);
// WrapperCache
virtual JSObject*
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
// MozCdmaIccInfo WebIDL
void
GetMsisdn(nsAString& aMsisdn) const;
private:
~GsmIccInfo() {}
private:
nsCOMPtr<nsIGsmIccInfo> mGsmIccInfo;
};
class CdmaIccInfo MOZ_FINAL : public IccInfo
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CdmaIccInfo, IccInfo)
explicit CdmaIccInfo(nsPIDOMWindow* aWindow);
void
Update(nsICdmaIccInfo* aInfo);
// WrapperCache
virtual JSObject*
WrapObject(JSContext* aCx) MOZ_OVERRIDE;
// MozCdmaIccInfo WebIDL
void
GetMdn(nsAString& aMdn) const;
int32_t
PrlVersion() const;
private:
~CdmaIccInfo() {}
private:
nsCOMPtr<nsICdmaIccInfo> mCdmaIccInfo;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_IccInfo_h

View File

@ -7,7 +7,7 @@
#include "Icc.h"
#include "IccManager.h"
#include "nsIDOMClassInfo.h"
#include "nsIDOMIccInfo.h"
#include "nsIIccInfo.h"
#include "nsRadioInterfaceLayer.h"
using namespace mozilla::dom;
@ -27,13 +27,13 @@ IccListener::IccListener(IccManager* aIccManager, uint32_t aClientId)
return;
}
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsCOMPtr<nsIIccInfo> iccInfo;
mProvider->GetIccInfo(mClientId, getter_AddRefs(iccInfo));
if (iccInfo) {
nsString iccId;
iccInfo->GetIccid(iccId);
if (!iccId.IsEmpty()) {
mIcc = new Icc(mIccManager->GetOwner(), mClientId, iccId);
mIcc = new Icc(mIccManager->GetOwner(), mClientId, iccInfo);
}
}
@ -98,7 +98,7 @@ IccListener::NotifyCardStateChanged()
NS_IMETHODIMP
IccListener::NotifyIccInfoChanged()
{
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsCOMPtr<nsIIccInfo> iccInfo;
mProvider->GetIccInfo(mClientId, getter_AddRefs(iccInfo));
// Create/delete icc object based on current iccInfo.
@ -111,12 +111,13 @@ IccListener::NotifyIccInfoChanged()
nsString iccId;
iccInfo->GetIccid(iccId);
if (!iccId.IsEmpty()) {
mIcc = new Icc(mIccManager->GetOwner(), mClientId, iccId);
mIcc = new Icc(mIccManager->GetOwner(), mClientId, iccInfo);
mIccManager->NotifyIccAdd(iccId);
mIcc->NotifyEvent(NS_LITERAL_STRING("iccinfochange"));
}
}
} else {
mIcc->UpdateIccInfo(iccInfo);
mIcc->NotifyEvent(NS_LITERAL_STRING("iccinfochange"));
if (!iccInfo) {
nsString iccId = mIcc->GetIccId();

View File

@ -8,7 +8,7 @@
#include "IccListener.h"
#include "mozilla/dom/IccChangeEvent.h"
#include "mozilla/Preferences.h"
#include "nsIDOMIccInfo.h"
#include "nsIIccInfo.h"
using namespace mozilla::dom;

View File

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsIDOMIccInfo.idl',
'nsIIccInfo.idl',
'nsIIccProvider.idl',
]

View File

@ -4,8 +4,8 @@
#include "nsISupports.idl"
[scriptable, uuid(dd9f229c-e5a6-453a-8388-950af0ff9918)]
interface nsIDOMMozIccInfo : nsISupports
[scriptable, uuid(3ba11a90-34e0-11e4-8c21-0800200c9a66)]
interface nsIIccInfo : nsISupports
{
/**
* Integrated Circuit Card Type.
@ -45,8 +45,8 @@ interface nsIDOMMozIccInfo : nsISupports
readonly attribute boolean isDisplaySpnRequired;
};
[scriptable, uuid(3c237e39-7af3-4748-baf4-4a3b6c3e0e66)]
interface nsIDOMMozGsmIccInfo : nsIDOMMozIccInfo
[scriptable, uuid(6c9c78b0-34e0-11e4-8c21-0800200c9a66)]
interface nsIGsmIccInfo : nsIIccInfo
{
/**
* Mobile Station ISDN Number (MSISDN) of the subscriber, aka
@ -55,8 +55,8 @@ interface nsIDOMMozGsmIccInfo : nsIDOMMozIccInfo
readonly attribute DOMString msisdn;
};
[scriptable, uuid(7e937d09-4d1d-43c5-96d8-c91396022809)]
interface nsIDOMMozCdmaIccInfo : nsIDOMMozIccInfo
[scriptable, uuid(7452f570-34e0-11e4-8c21-0800200c9a66)]
interface nsICdmaIccInfo : nsIIccInfo
{
/**
* Mobile Directory Number (MDN) of the subscriber, aka his phone number.

View File

@ -5,8 +5,8 @@
#include "nsISupports.idl"
interface nsIDOMDOMRequest;
interface nsIDOMMozIccInfo;
interface nsIDOMWindow;
interface nsIIccInfo;
[scriptable, uuid(7c0ada3d-d8d4-493e-9243-fa3df39855e4)]
interface nsIIccListener : nsISupports
@ -20,7 +20,7 @@ interface nsIIccListener : nsISupports
/**
* XPCOM component (in the content process) that provides the ICC information.
*/
[scriptable, uuid(7c67ab92-52a3-4e11-995c-c0ad2f66c4cb)]
[scriptable, uuid(1afa72d0-3d70-11e4-916c-0800200c9a66)]
interface nsIIccProvider : nsISupports
{
/**
@ -34,7 +34,7 @@ interface nsIIccProvider : nsISupports
/**
* UICC Information
*/
nsIDOMMozIccInfo getIccInfo(in unsigned long clientId);
nsIIccInfo getIccInfo(in unsigned long clientId);
/**
* Card State

View File

@ -8,11 +8,13 @@ DIRS += ['interfaces']
EXPORTS.mozilla.dom += [
'Icc.h',
'IccInfo.h',
'IccManager.h',
]
UNIFIED_SOURCES += [
'Icc.cpp',
"IccInfo.cpp",
'IccListener.cpp',
'IccManager.cpp',
]

View File

View File

@ -35,7 +35,7 @@ taskHelper.push(function basicTest() {
// See it here {B2G_HOME}/external/qemu/telephony/sim_card.c#L299.
is(iccInfo.iccid, 89014103211118510720);
if (iccInfo instanceof Ci.nsIDOMMozGsmIccInfo) {
if (iccInfo instanceof MozGsmIccInfo) {
log("Test Gsm IccInfo");
is(iccInfo.iccType, "sim");
is(iccInfo.spn, "Android");

View File

@ -339,10 +339,10 @@ MmsConnection.prototype = {
* Get phone number from iccInfo.
*
* If the icc card is gsm card, the phone number is in msisdn.
* @see nsIDOMMozGsmIccInfo
* @see nsIGsmIccInfo
*
* Otherwise, the phone number is in mdn.
* @see nsIDOMMozCdmaIccInfo
* @see nsICdmaIccInfo
*/
getPhoneNumber: function() {
let number;
@ -351,10 +351,10 @@ MmsConnection.prototype = {
let iccInfo = null;
let baseIccInfo = this.radioInterface.rilContext.iccInfo;
if (baseIccInfo.iccType === 'ruim' || baseIccInfo.iccType === 'csim') {
iccInfo = baseIccInfo.QueryInterface(Ci.nsIDOMMozCdmaIccInfo);
iccInfo = baseIccInfo.QueryInterface(Ci.nsICdmaIccInfo);
number = iccInfo.mdn;
} else {
iccInfo = baseIccInfo.QueryInterface(Ci.nsIDOMMozGsmIccInfo);
iccInfo = baseIccInfo.QueryInterface(Ci.nsIGsmIccInfo);
number = iccInfo.msisdn;
}
} catch (e) {

View File

@ -34,7 +34,7 @@
#include "prtime.h"
#ifdef MOZ_B2G_RIL
#include "nsIDOMIccInfo.h"
#include "nsIIccInfo.h"
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionService.h"
#include "nsIMobileCellInfo.h"
@ -459,10 +459,10 @@ GonkGPSGeolocationProvider::RequestSetID(uint32_t flags)
}
if (flags & AGPS_RIL_REQUEST_SETID_MSISDN) {
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsCOMPtr<nsIIccInfo> iccInfo;
rilCtx->GetIccInfo(getter_AddRefs(iccInfo));
if (iccInfo) {
nsCOMPtr<nsIDOMMozGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
nsCOMPtr<nsIGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
if (gsmIccInfo) {
type = AGPS_SETID_TYPE_MSISDN;
gsmIccInfo->GetMsisdn(id);
@ -494,7 +494,7 @@ GonkGPSGeolocationProvider::SetReferenceLocation()
location.type = AGPS_REF_LOCATION_TYPE_UMTS_CELLID;
if (rilCtx) {
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
nsCOMPtr<nsIIccInfo> iccInfo;
rilCtx->GetIccInfo(getter_AddRefs(iccInfo));
if (iccInfo) {
nsresult result;

View File

@ -41,12 +41,6 @@ function debug(s) {
const RILCONTENTHELPER_CID =
Components.ID("{472816e1-1fd6-4405-996c-806f9ea68174}");
const ICCINFO_CID =
Components.ID("{39d64d90-26a6-11e4-8c21-0800200c9a66}");
const GSMICCINFO_CID =
Components.ID("{e0fa785b-ad3f-46ed-bc56-fcb0d6fe4fa8}");
const CDMAICCINFO_CID =
Components.ID("{3d1f844f-9ec5-48fb-8907-aed2e5421709}");
const ICCCARDLOCKERROR_CID =
Components.ID("{08a71987-408c-44ff-93fd-177c0a85c3dd}");
@ -108,16 +102,9 @@ MobileIccCardLockRetryCount.prototype = {
function IccInfo() {}
IccInfo.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozIccInfo]),
classID: ICCINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: ICCINFO_CID,
classDescription: "MozIccInfo",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozIccInfo]
}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIIccInfo]),
// nsIDOMMozIccInfo
// nsIIccInfo
iccType: null,
iccid: null,
@ -130,34 +117,20 @@ IccInfo.prototype = {
function GsmIccInfo() {}
GsmIccInfo.prototype = {
__proto__: IccInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozGsmIccInfo]),
classID: GSMICCINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: GSMICCINFO_CID,
classDescription: "MozGsmIccInfo",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozGsmIccInfo]
}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGsmIccInfo,
Ci.nsIIccInfo]),
// nsIDOMMozGsmIccInfo
// nsIGsmIccInfo
msisdn: null
};
function CdmaIccInfo() {}
CdmaIccInfo.prototype = {
__proto__: IccInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozCdmaIccInfo]),
classID: CDMAICCINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: CDMAICCINFO_CID,
classDescription: "MozCdmaIccInfo",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozCdmaIccInfo]
}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICdmaIccInfo,
Ci.nsIIccInfo]),
// nsIDOMMozCdmaIccInfo
// nsICdmaIccInfo
mdn: null,
prlVersion: 0

View File

@ -53,12 +53,6 @@ const RADIOINTERFACE_CID =
Components.ID("{6a7c91f0-a2b3-4193-8562-8969296c0b54}");
const RILNETWORKINTERFACE_CID =
Components.ID("{3bdd52a9-3965-4130-b569-0ac5afed045e}");
const ICCINFO_CID =
Components.ID("{52eec7f0-26a4-11e4-8c21-0800200c9a66}");
const GSMICCINFO_CID =
Components.ID("{d90c4261-a99d-47bc-8b05-b057bb7e8f8a}");
const CDMAICCINFO_CID =
Components.ID("{39ba3c08-aacc-46d0-8c04-9b619c387061}");
const NEIGHBORINGCELLINFO_CID =
Components.ID("{f9dfe26a-851e-4a8b-a769-cbb1baae7ded}");
const GSMCELLINFO_CID =
@ -941,16 +935,9 @@ try {
function IccInfo() {}
IccInfo.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozIccInfo]),
classID: ICCINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: ICCINFO_CID,
classDescription: "MozIccInfo",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozIccInfo]
}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIIccInfo]),
// nsIDOMMozIccInfo
// nsIIccInfo
iccType: null,
iccid: null,
@ -964,16 +951,10 @@ IccInfo.prototype = {
function GsmIccInfo() {}
GsmIccInfo.prototype = {
__proto__: IccInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozGsmIccInfo]),
classID: GSMICCINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: GSMICCINFO_CID,
classDescription: "MozGsmIccInfo",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozGsmIccInfo]
}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGsmIccInfo,
Ci.nsIIccInfo]),
// nsIDOMMozGsmIccInfo
// nsIGsmIccInfo
msisdn: null
};
@ -981,16 +962,10 @@ GsmIccInfo.prototype = {
function CdmaIccInfo() {}
CdmaIccInfo.prototype = {
__proto__: IccInfo.prototype,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozCdmaIccInfo]),
classID: CDMAICCINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: CDMAICCINFO_CID,
classDescription: "MozCdmaIccInfo",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozCdmaIccInfo]
}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICdmaIccInfo,
Ci.nsIIccInfo]),
// nsIDOMMozCdmaIccInfo
// nsICdmaIccInfo
mdn: null,
prlVersion: 0
@ -2141,10 +2116,10 @@ RadioInterface.prototype = {
* Get phone number from iccInfo.
*
* If the icc card is gsm card, the phone number is in msisdn.
* @see nsIDOMMozGsmIccInfo
* @see nsIGsmIccInfo
*
* Otherwise, the phone number is in mdn.
* @see nsIDOMMozCdmaIccInfo
* @see nsICdmaIccInfo
*/
getPhoneNumber: function() {
let iccInfo = this.rilContext.iccInfo;
@ -2154,7 +2129,7 @@ RadioInterface.prototype = {
}
// After moving SMS code out of RadioInterfaceLayer, we could use
// |iccInfo instanceof Ci.nsIDOMMozGsmIccInfo| here.
// |iccInfo instanceof Ci.nsIGsmIccInfo| here.
// TODO: Bug 873351 - B2G SMS: move SMS code out of RadioInterfaceLayer to
// SmsService
let number = (iccInfo instanceof GsmIccInfo) ? iccInfo.msisdn : iccInfo.mdn;

View File

@ -5,11 +5,11 @@
#include "nsISupports.idl"
#include "nsINetworkManager.idl"
interface nsIDOMMozIccInfo;
interface nsICellInfoListCallback;
interface nsIIccInfo;
interface nsIMobileConnectionInfo;
interface nsIMobileMessageCallback;
interface nsINeighboringCellIdsCallback;
interface nsICellInfoListCallback;
[scriptable, uuid(6e0f45b8-410e-11e3-8c8e-b715b2cd0128)]
interface nsIRilNetworkInterface : nsINetworkInterface
@ -23,14 +23,14 @@ interface nsIRilNetworkInterface : nsINetworkInterface
readonly attribute long mmsPort; // -1 if not set.
};
[scriptable, uuid(0226a2c1-a3b9-416a-92cb-c89e4dad4be0)]
[scriptable, uuid(08a69c70-34b1-11e4-8c21-0800200c9a66)]
interface nsIRilContext : nsISupports
{
readonly attribute DOMString cardState;
readonly attribute DOMString imsi;
readonly attribute nsIDOMMozIccInfo iccInfo;
readonly attribute nsIIccInfo iccInfo;
};
[scriptable, function, uuid(3bc96351-53b0-47a1-a888-c74c64b60f25)]

View File

@ -2725,6 +2725,13 @@ RilObject.prototype = {
queryCallBarringStatus: function(options) {
options.facility = CALL_BARRING_PROGRAM_TO_FACILITY[options.program];
options.password = ""; // For query no need to provide it.
// For some operators, querying specific serviceClass doesn't work. We use
// serviceClass 0 instead, and then process the response to extract the
// answer for queryServiceClass.
options.queryServiceClass = options.serviceClass;
options.serviceClass = 0;
this.queryICCFacilityLock(options);
},
@ -5930,20 +5937,23 @@ RilObject.prototype[REQUEST_QUERY_FACILITY_LOCK] = function REQUEST_QUERY_FACILI
return;
}
let services;
if (length) {
// Buf.readInt32List()[0] for Call Barring is a bit vector of services.
services = this.context.Buf.readInt32List()[0];
} else {
if (!length) {
options.success = false;
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
this.sendChromeMessage(options);
return;
}
options.enabled = services === 0 ? false : true;
// Buf.readInt32List()[0] for Call Barring is a bit vector of services.
let services = this.context.Buf.readInt32List()[0];
if (options.success && (options.rilMessageType === "sendMMI")) {
if (options.queryServiceClass) {
options.enabled = (services & options.queryServiceClass) ? true : false;
} else {
options.enabled = services ? true : false;
}
if (options.rilMessageType === "sendMMI") {
if (!options.enabled) {
options.statusMessage = MMI_SM_KS_SERVICE_DISABLED;
} else {

View File

@ -700,16 +700,22 @@ var interfaceNamesInGlobalScope =
"MozCSSKeyframeRule",
// IMPORTANT: Do not change this list without review from a DOM peer!
"MozCSSKeyframesRule",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozCdmaIccInfo", b2g: true, pref: "dom.icc.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozEmergencyCbModeEvent", b2g: true, pref: "dom.mobileconnection.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozIcc", b2g: true, pref: "dom.icc.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozIccInfo", b2g: true, pref: "dom.icc.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozIccManager", b2g: true, pref: "dom.icc.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozInputContext", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozInputMethodManager", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozGsmIccInfo", b2g: true, pref: "dom.icc.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MozMessageDeletedEvent", b2g: true, pref: "dom.sms.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -2,8 +2,6 @@
* 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/. */
interface MozIccInfo;
[Pref="dom.icc.enabled"]
interface MozIcc : EventTarget
{
@ -16,7 +14,7 @@ interface MozIcc : EventTarget
* Also, the attribute is set to null and this MozIcc object becomes invalid.
* Calling asynchronous functions raises exception then.
*/
readonly attribute MozIccInfo? iccInfo;
readonly attribute (MozIccInfo or MozGsmIccInfo or MozCdmaIccInfo)? iccInfo;
/**
* The 'iccinfochange' event is notified whenever the icc info object

View File

@ -0,0 +1,65 @@
/* 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/. */
enum IccType {"sim", "usim", "csim", "ruim"};
[Pref="dom.icc.enabled"]
interface MozIccInfo {
/**
* Integrated Circuit Card Type.
*/
readonly attribute IccType? iccType;
/**
* Integrated Circuit Card Identifier.
*/
readonly attribute DOMString? iccid;
/**
* Mobile Country Code (MCC) of the subscriber's home network.
*/
readonly attribute DOMString? mcc;
/**
* Mobile Network Code (MNC) of the subscriber's home network.
*/
readonly attribute DOMString? mnc;
/**
* Service Provider Name (SPN) of the subscriber's home network.
*/
readonly attribute DOMString? spn;
/**
* Network name must be a part of displayed carrier name.
*/
readonly attribute boolean isDisplayNetworkNameRequired;
/**
* Service provider name must be a part of displayed carrier name.
*/
readonly attribute boolean isDisplaySpnRequired;
};
[Pref="dom.icc.enabled"]
interface MozGsmIccInfo : MozIccInfo {
/**
* Mobile Station ISDN Number (MSISDN) of the subscriber, aka
* his phone number.
*/
readonly attribute DOMString? msisdn;
};
[Pref="dom.icc.enabled"]
interface MozCdmaIccInfo : MozIccInfo {
/**
* Mobile Directory Number (MDN) of the subscriber, aka his phone number.
*/
readonly attribute DOMString? mdn;
/**
* Preferred Roaming List (PRL) version of the subscriber.
*/
readonly attribute long prlVersion;
};

View File

@ -616,6 +616,7 @@ if CONFIG['MOZ_B2G_RIL']:
WEBIDL_FILES += [
'IccCardLockError.webidl',
'MozIcc.webidl',
'MozIccInfo.webidl',
'MozIccManager.webidl',
]

View File

@ -49,6 +49,7 @@ RTSPSource::RTSPSource(
mFinalResult(OK),
mDisconnectReplyID(0),
mLatestPausedUnit(0),
mPlayPending(false),
mSeekGeneration(0)
{
@ -213,11 +214,19 @@ void RTSPSource::performPlay(int64_t playTimeUs) {
start();
return;
}
if (mState != CONNECTED && mState != PAUSING) {
// If state is PAUSING, which means a previous PAUSE request is still being
// processed, put off the PLAY request until PausedDone.
if (mState == PAUSING) {
mPlayPending = true;
return;
}
if (mState == PAUSING) {
playTimeUs = mLatestPausedUnit;
// Reject invalid state transition.
if (mState != CONNECTED && mState != PAUSED) {
return;
}
// Use the latest received frame time if we were paused.
if (mState == PAUSED) {
playTimeUs = mLatestPausedUnit;
}
int64_t duration = 0;
@ -225,7 +234,7 @@ void RTSPSource::performPlay(int64_t playTimeUs) {
MOZ_ASSERT(playTimeUs < duration,
"Should never receive an out of bounds play time!");
if (playTimeUs >= duration) {
return;
return;
}
LOGI("performPlay : duration=%lld playTimeUs=%lld", duration, playTimeUs);
@ -234,13 +243,14 @@ void RTSPSource::performPlay(int64_t playTimeUs) {
}
void RTSPSource::performPause() {
// Reject invalid state transition.
if (mState != PLAYING) {
return;
}
LOGI("performPause :");
for (size_t i = 0; i < mTracks.size(); ++i) {
TrackInfo *info = &mTracks.editItemAt(i);
info->mLatestPausedUnit = 0;
TrackInfo *info = &mTracks.editItemAt(i);
info->mLatestPausedUnit = 0;
}
mLatestPausedUnit = 0;
@ -257,16 +267,17 @@ void RTSPSource::performSuspend() {
}
void RTSPSource::performPlaybackEnded() {
// Transition from PLAYING to CONNECTED state so that we are ready to
// perform an another play operation.
// Reject invalid state transition.
if (mState != PLAYING) {
return;
}
// Transition from PLAYING to CONNECTED state so that we are ready to
// perform an another play operation.
mState = CONNECTED;
}
void RTSPSource::performSeek(int64_t seekTimeUs) {
if (mState != CONNECTED && mState != PLAYING && mState != PAUSING) {
if (mState != CONNECTED && mState != PLAYING && mState != PAUSED) {
return;
}
@ -275,12 +286,12 @@ void RTSPSource::performSeek(int64_t seekTimeUs) {
MOZ_ASSERT(seekTimeUs < duration,
"Should never receive an out of bounds seek time!");
if (seekTimeUs >= duration) {
return;
return;
}
for (size_t i = 0; i < mTracks.size(); ++i) {
TrackInfo *info = &mTracks.editItemAt(i);
info->mLatestPausedUnit = 0;
TrackInfo *info = &mTracks.editItemAt(i);
info->mLatestPausedUnit = 0;
}
mLatestPausedUnit = 0;
@ -366,6 +377,12 @@ void RTSPSource::onMessageReceived(const sp<AMessage> &msg) {
case RtspConnectionHandler::kWhatPausedDone:
{
// Reject invalid state transition.
if (mState != PAUSING) {
return;
}
mState = PAUSED;
for (size_t i = 0; i < mTracks.size(); ++i) {
TrackInfo *info = &mTracks.editItemAt(i);
info->mLatestPausedUnit = info->mLatestReceivedUnit;
@ -381,6 +398,11 @@ void RTSPSource::onMessageReceived(const sp<AMessage> &msg) {
mLatestPausedUnit = info->mLatestReceivedUnit;
}
}
if (mPlayPending) {
mPlayPending = false;
performPlay(mLatestPausedUnit);
}
break;
}
@ -431,7 +453,7 @@ void RTSPSource::onMessageReceived(const sp<AMessage> &msg) {
info->mLatestReceivedUnit = nptUs;
// Drop the frames that are older than the frames in the queue.
if (info->mLatestPausedUnit && (int64_t)info->mLatestPausedUnit > nptUs) {
break;
break;
}
source->queueAccessUnit(accessUnit);
}
@ -576,17 +598,17 @@ void RTSPSource::onConnected(bool isSeekable)
meta->SetDuration(int64Value);
if (isAudio) {
CHECK(format->findInt32(kKeyChannelCount, &int32Value));
meta->SetChannelCount(int32Value);
CHECK(format->findInt32(kKeyChannelCount, &int32Value));
meta->SetChannelCount(int32Value);
CHECK(format->findInt32(kKeySampleRate, &int32Value));
meta->SetSampleRate(int32Value);
CHECK(format->findInt32(kKeySampleRate, &int32Value));
meta->SetSampleRate(int32Value);
} else {
CHECK(format->findInt32(kKeyWidth, &int32Value));
meta->SetWidth(int32Value);
CHECK(format->findInt32(kKeyWidth, &int32Value));
meta->SetWidth(int32Value);
CHECK(format->findInt32(kKeyHeight, &int32Value));
meta->SetHeight(int32Value);
CHECK(format->findInt32(kKeyHeight, &int32Value));
meta->SetHeight(int32Value);
}
// Optional meta data.
@ -595,15 +617,15 @@ void RTSPSource::onConnected(bool isSeekable)
size_t length = 0;
if (format->findData(kKeyESDS, &type, &data, &length)) {
nsCString esds;
esds.Assign((const char *)data, length);
meta->SetEsdsData(esds);
nsCString esds;
esds.Assign((const char *)data, length);
meta->SetEsdsData(esds);
}
if (format->findData(kKeyAVCC, &type, &data, &length)) {
nsCString avcc;
avcc.Assign((const char *)data, length);
meta->SetAvccData(avcc);
nsCString avcc;
avcc.Assign((const char *)data, length);
meta->SetAvccData(avcc);
}
mListener->OnConnected(i, meta.get());

View File

@ -89,6 +89,7 @@ private:
CONNECTED,
SEEKING,
PAUSING,
PAUSED,
PLAYING,
};
@ -117,6 +118,7 @@ private:
status_t mFinalResult;
uint32_t mDisconnectReplyID;
uint64_t mLatestPausedUnit;
bool mPlayPending;
sp<ALooper> mLooper;
sp<AHandlerReflector<RTSPSource> > mReflector;

View File

@ -280,8 +280,7 @@ this.MobileIdentityManager = {
.then(
(creds) => {
if (creds) {
this.iccInfo[aServiceId].credentials = creds;
return;
return creds;
}
return this.credStore.getByMsisdn(this.iccInfo[aServiceId].msisdn);
}
@ -306,10 +305,12 @@ this.MobileIdentityManager = {
)
.then(
(result) => {
log.debug("Discover result ${}", result);
// If we already have credentials for this ICC and no discover request
// is done, we just bail out.
if (!result || !result.verificationMethods) {
return;
}
log.debug("Discover result ${}", result);
this.iccInfo[aServiceId].verificationMethods = result.verificationMethods;
this.iccInfo[aServiceId].verificationDetails = result.verificationDetails;
this.iccInfo[aServiceId].canDoSilentVerification =
@ -675,14 +676,16 @@ this.MobileIdentityManager = {
let mcc;
// If the user selected one of the existing SIM cards we have to check
// that we either have the MSISDN for that SIM or we can do a silent
// verification that does not require us to have the MSISDN in advance.
// that we either have the MSISDN for that SIM, we have already existing
// credentials or we can do a silent verification that does not require
// us to have the MSISDN in advance.
// result.serviceId can be "0".
if (result.serviceId !== undefined &&
result.serviceId !== null) {
let icc = this.iccInfo[result.serviceId];
log.debug("icc ${}", icc);
if (!icc || !icc.msisdn && !icc.canDoSilentVerification) {
if (!icc || !icc.msisdn && !icc.canDoSilentVerification &&
!icc.credentials) {
return Promise.reject(ERROR_INTERNAL_CANNOT_VERIFY_SELECTION);
}
msisdn = icc.msisdn;
@ -972,7 +975,12 @@ this.MobileIdentityManager = {
// before generating and sharing the assertion.
// If we've just prompted the user in the previous step, the permission
// is already granted and stored so we just progress the credentials.
// But we have to refresh the cached permission before checking.
if (creds) {
permission = permissionManager.testPermissionFromPrincipal(
principal,
MOBILEID_PERM
);
if (permission == Ci.nsIPermissionManager.ALLOW_ACTION) {
return creds;
}

View File

@ -457,7 +457,7 @@ add_test(function() {
credStore._("add").call(1).arg(2, PHONE_NUMBER);
credStore._("add").call(1).arg(3, ORIGIN);
credStore._("add").call(1).arg(4, SESSION_TOKEN);
credStore._("add").call(1).arg(5, null);
credStore._("add").call(1).arg(5, []);
// MockUI.
@ -960,10 +960,10 @@ add_test(function() {
credStore._("add").call(1).arg(2, PHONE_NUMBER);
credStore._("add").call(1).arg(3, ORIGIN);
credStore._("add").call(1).arg(4, SESSION_TOKEN);
credStore._("add").call(1).arg(5, null);
credStore._("add").call(1).arg(5, []);
credStore._("setDeviceIccIds").callsLength(1);
credStore._("setDeviceIccIds").call(1).arg(1, PHONE_NUMBER);
credStore._("setDeviceIccIds").call(1).arg(2, null);
credStore._("setDeviceIccIds").call(1).arg(2, []);
// MockUI.
ui._("startFlow").callsLength(1);
@ -1054,7 +1054,7 @@ add_test(function() {
credStore._("add").call(1).arg(2, ANOTHER_PHONE_NUMBER);
credStore._("add").call(1).arg(3, ORIGIN);
credStore._("add").call(1).arg(4, _sessionToken);
credStore._("add").call(1).arg(5, null);
credStore._("add").call(1).arg(5, []);
credStore._("setDeviceIccIds").callsLength(0);
credStore._("removeOrigin").callsLength(1);
credStore._("removeOrigin").call(1).arg(1, PHONE_NUMBER);
@ -1139,7 +1139,7 @@ add_test(function() {
credStore._("add").call(1).arg(2, PHONE_NUMBER);
credStore._("add").call(1).arg(3, ORIGIN);
credStore._("add").call(1).arg(4, _sessionToken);
credStore._("add").call(1).arg(5, null);
credStore._("add").call(1).arg(5, []);
credStore._("setDeviceIccIds").callsLength(1);
credStore._("removeOrigin").callsLength(0);
@ -1229,7 +1229,7 @@ add_test(function() {
credStore._("add").call(1).arg(2, ANOTHER_PHONE_NUMBER);
credStore._("add").call(1).arg(3, ORIGIN);
credStore._("add").call(1).arg(4, _sessionToken);
credStore._("add").call(1).arg(5, null);
credStore._("add").call(1).arg(5, []);
credStore._("setDeviceIccIds").callsLength(0);
credStore._("removeOrigin").callsLength(1);
credStore._("removeOrigin").call(1).arg(1, PHONE_NUMBER);
@ -1278,7 +1278,7 @@ add_test(function() {
sessionToken: _sessionToken,
msisdn: PHONE_NUMBER,
origin: ORIGIN,
deviceIccIds: null
deviceIccIds: []
};
let ui = new MockUi({
@ -1323,7 +1323,7 @@ add_test(function() {
credStore._("add").call(1).arg(2, PHONE_NUMBER);
credStore._("add").call(1).arg(3, ORIGIN);
credStore._("add").call(1).arg(4, SESSION_TOKEN);
credStore._("add").call(1).arg(5, null);
credStore._("add").call(1).arg(5, []);
credStore._("setDeviceIccIds").callsLength(0);
credStore._("delete").callsLength(1);
credStore._("delete").call(1).arg(1, PHONE_NUMBER);
@ -1383,12 +1383,8 @@ add_test(function() {
MobileIdentityManager._mobileConnectionService = {
_interfaces: [RADIO_INTERFACE, ANOTHER_RADIO_INTERFACE],
getVoiceConnectionInfo: function(aIndex) {
return this._interfaces[aIndex].voice;
},
getDataConnectionInfo: function(aIndex) {
return this._interfaces[aIndex].data;
getItemByServiceId: function(aIndex) {
return this._interfaces[aIndex];
}
};