mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
7edec4880a
- Bug 859764 - Part 5: Changes in Test Cases. r=echen (f1a5cd4fd3) - Bug 859764 - Part 6: Changes in Payment. r=ferjm, r=smaug (2b47641375) - Bug 1010756 - Helpful errors for using nsCOMPtr on non-XPCOM types; r=froydnj (6b1521c482) - leftover (e1a24351e9) - Bug 1192102 - Remove unused file embedded/android/GeckoSmsManager.java. r=blassey (ac05ae649d) - var-let (8ddb529f96) - Bug 1181466 - Fix observe function in SmsService/MmsService. r=btseng (ca93122404) - Bug 733331 - Part 2: Update enabledGsmTableTuples when MCC changes in SmsService.js and fix segmentChars in SmsSegmentHelper.jsm. r=btseng (24fa23e4be) - Bug 1173156 - Fix typo and add a Marionette test case. r=btseng (e7199eb55a) - Bug 1132774 - [B2G][SMS] Enable DEBUG Flag in SmsService if the default value of "ril.debugging.enabled" is true. r=btseng (7300d24fb7) - Bug 1169160 - [MobileConnection] Support more call barring program: all service, outgoing service and incoming service. r=hsinyi,aknow (872c2cc056) - Bug 1169225 - [MobileConnectionService] Support setting/getting call waiting on all serviceClass. r=aknow (14c546a9ca) - Bug 1110619 - Part 1: IDL Interface Changes. r=echen (beae2b4b77) - Bug 1168064 - B2G RIL: filter out cell info with unknown values. r=echen (11dfc5a7e8) - Bug 1159591 - Part 2: Move MMI logic from ril_worker to telephonyService (Call Forwarding). r=aknow (b4edb76863) - Bug 1159591 - Part 3: Move MMI logic from ril_worker to telephonyService (Icc Lock). r=aknow (3faba76808) - Bug 1138263 - Make TelephonyService.js JSHint friendly. r=hsinyi (454bd4c765) - Bug 1159591 - Part 4: Move MMI logic from ril_worker to telephonyService (IMEI). r=aknow (57f423ecdd) - Bug 1159591 - Part 5: Move MMI logic from ril_worker to telephonyService (CLIP). r=aknow (c6611dbcb8) - Bug 1159591 - Part 6: Move MMI logic from ril_worker to telephonyService (CLIR). r=aknow (8c1fc03edb) - Bug 1159591 - Part 7: Move MMI logic from ril_worker to telephonyService (Call Barring Password). r=aknow (5d8bcbf177) - Bug 1159591 - Part 8: Move MMI logic from ril_worker to telephonyService (Call Barring). r=aknow (aa0b89aea1) - Bug 1159591 - Part 9: Move MMI logic from ril_worker to telephonyService (Call Waiting). r=aknow (1d14d2b864) - Bug 1159591 - Part 10: Move MMI logic from ril_worker to telephonyService (USSD). r=aknow (c92130b5b2) - Bug 1159591 - Part 11: Move MMI consts from ril_consts to telephonyService. r=aknow (0e7b3fea9a) - Bug 1159591 - Part 12: Move radio check for MMI to a common place. r=aknow (dcdc3178ad) - Bug 1110619 - Part 2: Implementation Changes. r=echen (6d8e78d684) - Bug 1110619 - Part 3: Bluetooth Changes. r=btian (9787727be0) - Bug 1147736 - Part 1: Extend TelephonyCallInfo. r=aknow (2a426cc99f) - Bug 1147736 - Part 2: Bypass NotifyError. r=aknow (6cd6fd6867) - Bug 1147736 - Part 3: Deprecate NotifyError. r=aknow (e41c719442) - Bug 1147736 - Part 4: Deprecate NotifyError(Bluetooth). r=btian (9c8f97bb22) - Bug 1204817 - Delete the child property of a parent call only when the parent call exists. r=btseng (d35dc6b08f) - Bug 1191205 - Cancel USSD sessions only when needed. r=edgar (01a72dbacb) - Bug 1200134 - Control USSD Sessions with State-Transitions instead of Boolean. r=echen (a4e55b3d9d) - Bug 1163511 - Use defineLazyModuleGetter. r=hsinyi (8a97a4912c) - Bug 991582 - Part 2: Handle the result of RIL request in a consistent way. r=aknow (914ecc2bbb) - Bug 1164248 - Handling of session/sessionEnded for notifyUssdReceived. r=edgar (a79df75d38) - Bug 1223662 - Part 1: Check mmiServiceCode with correct constant. r=echen (abeb286050) - Bug 1174673 - Part 1: Automatically resume the held call. r=hsinyi (280543af7d) - Bug 1174673 - Part 2: Update test case. r=hsinyi (cfe19f1a52) - Bug 1185156 - Fix bug in resuming held call. r=hsinyi (b96346d319) - Bug 1162426 - Part 1: Provide TelephonyUtils. r=hsinyi (62b71e6e83) - Bug 1162426 - Part 2: Test case. r=hsniyi (13a0b3c6f5) - Bug 1171807 - Part 1: Add enums for TelephonyCall::State and TelephonyCallGroup::State (WebIDL). r=hsinyi (0b698eecc4) - Bug 1145551 - DTMF should be sent using the active SIM, the given or the default one (in that order). r=aknow (6157636493) - Bug 1171807 - Part 2: Move to enums and deprecate TelephonyCall.mCallState and TelephonyCallGroup.mCallState (DOM). r=btseng (5faef22d91) - Bug 1168515 - do not block incall MMI requests on alerting state. r=aknow (b1f85c5789) - Bug 1155072 - Part 1: Deprecate nsITelephonyListener.conferenceCallStateChanged (Telephony). r=btseng (e41d1a4bc9) - Bug 1155072 - Part 2: Deprecate nsITelephonyListener.conferenceCallStateChanged (Bluetooth). r=btian (27e69fa89b) - Bug 1166936 - JS Warning in TelephonyService.js r=aknow (3559d3ad3d) - Bug 1191237 - Part 1: Enhance |TelephonyService.js|. r=aknow (86576a6d32) - Bug 1202902 - Fix the world. (0dc256d67d) - Bug 1161438 - Part 1 - Exporting contact to SIM should also return updated contact. r=echen (505d7d7f83) - Bug 1159622 - Split test_icc_contact.js into read contact and add contact. r=echen (fec0c428df) - Bug 1122376 - Support read SIM contact dialling number exceed 20 digits. r=echen (5d0599e93c) - Bug 1161438 - Part 2 - marionette testcase. r=echen (1f0d18a479) - Bug 1114937 - Part 5: Fix Test Case to Remove Contact with Correct Contact Id. r=echen (8d746fdbd2) - Bug 1194149 - Continue importing contacts when there is no sufficient Type 2 USIM contact fields record. r=echen (e9be40dbf2) - Bug 962995 - xpcshell tests for write ICC UCS2 characters for 0x81 and 0x82 encoding. r=echen (9500afaa4d) - Bug 1161438 - Part 3 - xpcshell testcase. r=echen (01f7fb4514) - Bug 1122376 - Support write SIM contact dialling number exceed 20 digits. r=echen (91133e286d) - Bug 999300 - Part 1: Removed the Ril v5 legacy support. r=edgar (ded77fcb6f) - Bug 999300 - Part 2: Update the related testcases. r=edgar (f77a8b96cc) - Bug 1177146 - [Aries][RIL] Reply from QUERY_AVAILABLE_NETWORKS has extra strings. r=hsinyi (a6816cbbab) - Bug 1043250 - Part 1: Update ril_worker and xpcshell test. r=btseng (8b9b25b5cf) - Bug 1185406 - B2G RIL: Read 'pcscf' and expose it in nsIRilNetworkInfo. r=hsinyi (ce707ecb83) - Bug 1174998 - Part 3: Read data call's MTU from network/apn settings. r=echen (bfa08d8380) - Bug 1166320 - Make volume service safer to use off main thread. r=dhylands (b3976622ad) - Bug 1177374 - Call realpath on volume mount points so thatVolumeService::GetVolumeByPath works properly. r=achen (aea97080eb) - Bug 1195166 - AutoMounter: add ignore command to allow volumes to be ignored. r=alchen (f265d832c8) - Bug 1196724 - Refactoring of AudioManager r=alwu (e5b896b7ce) - Bug 1222564 - Save audio volume to database r=alwu (1303d01ae7) - Bug 1164049 - Fix some mode lines in embedding/. r=smaug (79ddce4871)
623 lines
19 KiB
C++
623 lines
19 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* 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/mobileconnection/MobileConnectionChild.h"
|
|
|
|
#include "MobileConnectionCallback.h"
|
|
#include "mozilla/dom/MozMobileConnectionBinding.h"
|
|
#include "nsComponentManagerUtils.h"
|
|
|
|
using namespace mozilla::dom;
|
|
using namespace mozilla::dom::mobileconnection;
|
|
|
|
NS_IMPL_ISUPPORTS(MobileConnectionChild, nsIMobileConnection)
|
|
|
|
MobileConnectionChild::MobileConnectionChild(uint32_t aServiceId)
|
|
: mServiceId(aServiceId)
|
|
, mLive(true)
|
|
{
|
|
MOZ_COUNT_CTOR(MobileConnectionChild);
|
|
}
|
|
|
|
void
|
|
MobileConnectionChild::Init()
|
|
{
|
|
nsIMobileConnectionInfo* rawVoice;
|
|
nsIMobileConnectionInfo* rawData;
|
|
|
|
SendInit(&rawVoice, &rawData, &mLastNetwork, &mLastHomeNetwork,
|
|
&mNetworkSelectionMode, &mRadioState, &mSupportedNetworkTypes);
|
|
|
|
// Use dont_AddRef here because this instances is already AddRef-ed in
|
|
// MobileConnectionIPCSerializer.h
|
|
nsCOMPtr<nsIMobileConnectionInfo> voice = dont_AddRef(rawVoice);
|
|
mVoice = new MobileConnectionInfo(nullptr);
|
|
mVoice->Update(voice);
|
|
|
|
// Use dont_AddRef here because this instances is already AddRef-ed in
|
|
// MobileConnectionIPCSerializer.h
|
|
nsCOMPtr<nsIMobileConnectionInfo> data = dont_AddRef(rawData);
|
|
mData = new MobileConnectionInfo(nullptr);
|
|
mData->Update(data);
|
|
}
|
|
|
|
void
|
|
MobileConnectionChild::Shutdown()
|
|
{
|
|
if (mLive) {
|
|
mLive = false;
|
|
Send__delete__(this);
|
|
}
|
|
|
|
mListeners.Clear();
|
|
mVoice = nullptr;
|
|
mData = nullptr;
|
|
}
|
|
|
|
// nsIMobileConnection
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetServiceId(uint32_t* aServiceId)
|
|
{
|
|
*aServiceId = mServiceId;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::RegisterListener(nsIMobileConnectionListener* aListener)
|
|
{
|
|
NS_ENSURE_TRUE(!mListeners.Contains(aListener), NS_ERROR_UNEXPECTED);
|
|
|
|
mListeners.AppendObject(aListener);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::UnregisterListener(nsIMobileConnectionListener* aListener)
|
|
{
|
|
NS_ENSURE_TRUE(mListeners.Contains(aListener), NS_ERROR_UNEXPECTED);
|
|
|
|
mListeners.RemoveObject(aListener);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetVoice(nsIMobileConnectionInfo** aVoice)
|
|
{
|
|
RefPtr<nsIMobileConnectionInfo> voice(mVoice);
|
|
voice.forget(aVoice);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetData(nsIMobileConnectionInfo** aData)
|
|
{
|
|
RefPtr<nsIMobileConnectionInfo> data(mData);
|
|
data.forget(aData);
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetRadioState(int32_t* aRadioState)
|
|
{
|
|
*aRadioState = mRadioState;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetDeviceIdentities(nsIMobileDeviceIdentities** aIdentities)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetSupportedNetworkTypes(int32_t** aTypes,
|
|
uint32_t* aLength)
|
|
{
|
|
NS_ENSURE_ARG(aTypes);
|
|
NS_ENSURE_ARG(aLength);
|
|
|
|
*aLength = mSupportedNetworkTypes.Length();
|
|
*aTypes =
|
|
static_cast<int32_t*>(moz_xmalloc((*aLength) * sizeof(int32_t)));
|
|
NS_ENSURE_TRUE(*aTypes, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
for (uint32_t i = 0; i < *aLength; i++) {
|
|
(*aTypes)[i] = mSupportedNetworkTypes[i];
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetLastKnownNetwork(nsAString& aNetwork)
|
|
{
|
|
aNetwork = mLastNetwork;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetLastKnownHomeNetwork(nsAString& aNetwork)
|
|
{
|
|
aNetwork = mLastHomeNetwork;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetNetworkSelectionMode(int32_t* aMode)
|
|
{
|
|
*aMode = mNetworkSelectionMode;
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetNetworks(nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(GetNetworksRequest(), aCallback) ? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SelectNetwork(nsIMobileNetworkInfo* aNetwork,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
nsCOMPtr<nsIMobileNetworkInfo> network = aNetwork;
|
|
// We release the ref after serializing process is finished in
|
|
// MobileConnectionIPCSerializer.
|
|
return SendRequest(SelectNetworkRequest(network.forget().take()), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SelectNetworkAutomatically(nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SelectNetworkAutoRequest(), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SetPreferredNetworkType(int32_t aType,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SetPreferredNetworkTypeRequest(aType), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetPreferredNetworkType(nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(GetPreferredNetworkTypeRequest(), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SetRoamingPreference(int32_t aMode,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SetRoamingPreferenceRequest(aMode), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetRoamingPreference(nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(GetRoamingPreferenceRequest(), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SetVoicePrivacyMode(bool aEnabled,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SetVoicePrivacyModeRequest(aEnabled), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetVoicePrivacyMode(nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(GetVoicePrivacyModeRequest(), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SetCallForwarding(uint16_t aAction, uint16_t aReason,
|
|
const nsAString& aNumber,
|
|
uint16_t aTimeSeconds, uint16_t aServiceClass,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SetCallForwardingRequest(aAction, aReason,
|
|
nsString(aNumber),
|
|
aTimeSeconds, aServiceClass),
|
|
aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetCallForwarding(uint16_t aReason,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(GetCallForwardingRequest(aReason), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SetCallBarring(uint16_t aProgram, bool aEnabled,
|
|
const nsAString& aPassword,
|
|
uint16_t aServiceClass,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SetCallBarringRequest(aProgram, aEnabled,
|
|
nsString(aPassword),
|
|
aServiceClass),
|
|
aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetCallBarring(uint16_t aProgram,
|
|
const nsAString& aPassword,
|
|
uint16_t aServiceClass,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(GetCallBarringRequest(aProgram, nsString(aPassword),
|
|
aServiceClass),
|
|
aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::ChangeCallBarringPassword(const nsAString& aPin,
|
|
const nsAString& aNewPin,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(ChangeCallBarringPasswordRequest(nsString(aPin),
|
|
nsString(aNewPin)),
|
|
aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SetCallWaiting(bool aEnabled,
|
|
uint16_t aServiceClass,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SetCallWaitingRequest(aEnabled, aServiceClass), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetCallWaiting(nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(GetCallWaitingRequest(), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SetCallingLineIdRestriction(uint16_t aMode,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SetCallingLineIdRestrictionRequest(aMode), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetCallingLineIdRestriction(nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(GetCallingLineIdRestrictionRequest(), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::ExitEmergencyCbMode(nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(ExitEmergencyCbModeRequest(), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::SetRadioEnabled(bool aEnabled,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
return SendRequest(SetRadioEnabledRequest(aEnabled), aCallback)
|
|
? NS_OK : NS_ERROR_FAILURE;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetNeighboringCellIds(nsINeighboringCellIdsCallback* aCallback)
|
|
{
|
|
// This function is supported in chrome context only.
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MobileConnectionChild::GetCellInfoList(nsICellInfoListCallback* aCallback)
|
|
{
|
|
// This function is supported in chrome context only.
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::SendRequest(const MobileConnectionRequest& aRequest,
|
|
nsIMobileConnectionCallback* aCallback)
|
|
{
|
|
NS_ENSURE_TRUE(mLive, false);
|
|
|
|
// Deallocated in MobileConnectionChild::DeallocPMobileConnectionRequestChild().
|
|
MobileConnectionRequestChild* actor =
|
|
new MobileConnectionRequestChild(aCallback);
|
|
SendPMobileConnectionRequestConstructor(actor, aRequest);
|
|
|
|
return true;
|
|
}
|
|
|
|
void
|
|
MobileConnectionChild::ActorDestroy(ActorDestroyReason why)
|
|
{
|
|
mLive = false;
|
|
}
|
|
|
|
PMobileConnectionRequestChild*
|
|
MobileConnectionChild::AllocPMobileConnectionRequestChild(const MobileConnectionRequest& request)
|
|
{
|
|
MOZ_CRASH("Caller is supposed to manually construct a request!");
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::DeallocPMobileConnectionRequestChild(PMobileConnectionRequestChild* aActor)
|
|
{
|
|
delete aActor;
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyVoiceInfoChanged(nsIMobileConnectionInfo* const& aInfo)
|
|
{
|
|
// Use dont_AddRef here because this instances is already AddRef-ed in
|
|
// MobileConnectionIPCSerializer.h
|
|
nsCOMPtr<nsIMobileConnectionInfo> voice = dont_AddRef(aInfo);
|
|
mVoice->Update(voice);
|
|
|
|
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
mListeners[i]->NotifyVoiceChanged();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyDataInfoChanged(nsIMobileConnectionInfo* const& aInfo)
|
|
{
|
|
// Use dont_AddRef here because this instances is already AddRef-ed in
|
|
// MobileConnectionIPCSerializer.h
|
|
nsCOMPtr<nsIMobileConnectionInfo> data = dont_AddRef(aInfo);
|
|
mData->Update(data);
|
|
|
|
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
mListeners[i]->NotifyDataChanged();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyDataError(const nsString& aMessage)
|
|
{
|
|
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
mListeners[i]->NotifyDataError(aMessage);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyCFStateChanged(const uint16_t& aAction,
|
|
const uint16_t& aReason,
|
|
const nsString& aNumber,
|
|
const uint16_t& aTimeSeconds,
|
|
const uint16_t& aServiceClass)
|
|
{
|
|
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
mListeners[i]->NotifyCFStateChanged(aAction, aReason, aNumber, aTimeSeconds,
|
|
aServiceClass);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyEmergencyCbModeChanged(const bool& aActive,
|
|
const uint32_t& aTimeoutMs)
|
|
{
|
|
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
mListeners[i]->NotifyEmergencyCbModeChanged(aActive, aTimeoutMs);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyOtaStatusChanged(const nsString& aStatus)
|
|
{
|
|
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
mListeners[i]->NotifyOtaStatusChanged(aStatus);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyRadioStateChanged(const int32_t& aRadioState)
|
|
{
|
|
mRadioState = aRadioState;
|
|
|
|
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
mListeners[i]->NotifyRadioStateChanged();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyClirModeChanged(const uint32_t& aMode)
|
|
{
|
|
for (int32_t i = 0; i < mListeners.Count(); i++) {
|
|
mListeners[i]->NotifyClirModeChanged(aMode);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyLastNetworkChanged(const nsString& aNetwork)
|
|
{
|
|
mLastNetwork.Assign(aNetwork);
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyLastHomeNetworkChanged(const nsString& aNetwork)
|
|
{
|
|
mLastHomeNetwork.Assign(aNetwork);
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionChild::RecvNotifyNetworkSelectionModeChanged(const int32_t& aMode)
|
|
{
|
|
mNetworkSelectionMode = aMode;
|
|
|
|
return true;
|
|
}
|
|
|
|
/******************************************************************************
|
|
* MobileConnectionRequestChild
|
|
******************************************************************************/
|
|
|
|
void
|
|
MobileConnectionRequestChild::ActorDestroy(ActorDestroyReason why)
|
|
{
|
|
mRequestCallback = nullptr;
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccess& aReply)
|
|
{
|
|
return NS_SUCCEEDED(mRequestCallback->NotifySuccess());
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessBoolean& aReply)
|
|
{
|
|
return NS_SUCCEEDED(mRequestCallback->NotifySuccessWithBoolean(aReply.result()));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessNetworks& aReply)
|
|
{
|
|
uint32_t count = aReply.results().Length();
|
|
nsTArray<nsCOMPtr<nsIMobileNetworkInfo>> results;
|
|
for (uint32_t i = 0; i < count; i++) {
|
|
// Use dont_AddRef here because these instances are already AddRef-ed in
|
|
// MobileConnectionIPCSerializer.h
|
|
nsCOMPtr<nsIMobileNetworkInfo> item = dont_AddRef(aReply.results()[i]);
|
|
results.AppendElement(item);
|
|
}
|
|
|
|
return NS_SUCCEEDED(mRequestCallback->NotifyGetNetworksSuccess(count,
|
|
const_cast<nsIMobileNetworkInfo**>(aReply.results().Elements())));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessCallForwarding& aReply)
|
|
{
|
|
uint32_t count = aReply.results().Length();
|
|
nsTArray<nsCOMPtr<nsIMobileCallForwardingOptions>> results;
|
|
for (uint32_t i = 0; i < count; i++) {
|
|
// Use dont_AddRef here because these instances are already AddRef-ed in
|
|
// MobileConnectionIPCSerializer.h
|
|
nsCOMPtr<nsIMobileCallForwardingOptions> item = dont_AddRef(aReply.results()[i]);
|
|
results.AppendElement(item);
|
|
}
|
|
|
|
return NS_SUCCEEDED(mRequestCallback->NotifyGetCallForwardingSuccess(
|
|
count, const_cast<nsIMobileCallForwardingOptions**>(aReply.results().Elements())));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessCallBarring& aReply)
|
|
{
|
|
return NS_SUCCEEDED(mRequestCallback->NotifyGetCallBarringSuccess(aReply.program(),
|
|
aReply.enabled(),
|
|
aReply.serviceClass()));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessCallWaiting& aReply)
|
|
{
|
|
return NS_SUCCEEDED(mRequestCallback->NotifyGetCallWaitingSuccess(aReply.serviceClass()));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessClirStatus& aReply)
|
|
{
|
|
return NS_SUCCEEDED(mRequestCallback->NotifyGetClirStatusSuccess(aReply.n(),
|
|
aReply.m()));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessPreferredNetworkType& aReply)
|
|
{
|
|
return NS_SUCCEEDED(mRequestCallback->NotifyGetPreferredNetworkTypeSuccess(aReply.type()));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessRoamingPreference& aReply)
|
|
{
|
|
return NS_SUCCEEDED(mRequestCallback->NotifyGetRoamingPreferenceSuccess(aReply.mode()));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::DoReply(const MobileConnectionReplyError& aReply)
|
|
{
|
|
return NS_SUCCEEDED(mRequestCallback->NotifyError(aReply.message()));
|
|
}
|
|
|
|
bool
|
|
MobileConnectionRequestChild::Recv__delete__(const MobileConnectionReply& aReply)
|
|
{
|
|
MOZ_ASSERT(mRequestCallback);
|
|
|
|
switch (aReply.type()) {
|
|
case MobileConnectionReply::TMobileConnectionReplySuccess:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccess());
|
|
case MobileConnectionReply::TMobileConnectionReplySuccessBoolean:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccessBoolean());
|
|
case MobileConnectionReply::TMobileConnectionReplySuccessNetworks:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccessNetworks());
|
|
case MobileConnectionReply::TMobileConnectionReplySuccessCallForwarding:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccessCallForwarding());
|
|
case MobileConnectionReply::TMobileConnectionReplySuccessCallBarring:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccessCallBarring());
|
|
case MobileConnectionReply::TMobileConnectionReplySuccessCallWaiting:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccessCallWaiting());
|
|
case MobileConnectionReply::TMobileConnectionReplySuccessClirStatus:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccessClirStatus());
|
|
case MobileConnectionReply::TMobileConnectionReplySuccessPreferredNetworkType:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccessPreferredNetworkType());
|
|
case MobileConnectionReply::TMobileConnectionReplySuccessRoamingPreference:
|
|
return DoReply(aReply.get_MobileConnectionReplySuccessRoamingPreference());
|
|
case MobileConnectionReply::TMobileConnectionReplyError:
|
|
return DoReply(aReply.get_MobileConnectionReplyError());
|
|
default:
|
|
MOZ_CRASH("Received invalid response type!");
|
|
}
|
|
|
|
return false;
|
|
}
|