mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge b2g-inbound to m-c.
This commit is contained in:
commit
b0817ed5a7
@ -10,7 +10,6 @@ chrome.jar:
|
||||
|
||||
content/arrow.svg (content/arrow.svg)
|
||||
* content/dbg-browser-actors.js (content/dbg-browser-actors.js)
|
||||
content/forms.js (content/forms.js)
|
||||
* content/settings.js (content/settings.js)
|
||||
* content/shell.html (content/shell.html)
|
||||
* content/shell.js (content/shell.js)
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"revision": "4a3f02dbc339012f5f595b8180f54adf5cb08713",
|
||||
"revision": "8aa52bb04742d118e84f830e72a5799b81c98e3a",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
* If the meta data isn't well format, this function will return NS_ERROR_FAILURE to caller,
|
||||
* else save the pointer to mMetadata and return NS_OK.
|
||||
*/
|
||||
virtual nsresult SetMetadata(nsRefPtr<TrackMetadataBase> aMetadata) = 0;
|
||||
virtual nsresult SetMetadata(TrackMetadataBase* aMetadata) = 0;
|
||||
|
||||
enum {
|
||||
FLUSH_NEEDED = 1 << 0,
|
||||
@ -61,7 +61,6 @@ public:
|
||||
uint32_t aFlags = 0) = 0;
|
||||
|
||||
protected:
|
||||
nsRefPtr<TrackMetadataBase> mMetadata;
|
||||
bool mInitialized;
|
||||
};
|
||||
}
|
||||
|
@ -26,19 +26,20 @@ public:
|
||||
mEncodedFrames.AppendElement(aEncodedFrame);
|
||||
}
|
||||
// Retrieve all of the encoded frames
|
||||
const nsTArray<nsAutoPtr<EncodedFrame> >& GetEncodedFrames() const
|
||||
const nsTArray<nsRefPtr<EncodedFrame> >& GetEncodedFrames() const
|
||||
{
|
||||
return mEncodedFrames;
|
||||
}
|
||||
private:
|
||||
// This container is used to store the video or audio encoded packets.
|
||||
// Muxer should check mFrameType and get the encoded data type from mEncodedFrames.
|
||||
nsTArray<nsAutoPtr<EncodedFrame> > mEncodedFrames;
|
||||
nsTArray<nsRefPtr<EncodedFrame> > mEncodedFrames;
|
||||
};
|
||||
|
||||
// Represent one encoded frame
|
||||
class EncodedFrame
|
||||
{
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EncodedFrame)
|
||||
public:
|
||||
EncodedFrame() :
|
||||
mTimeStamp(0),
|
||||
|
@ -186,7 +186,7 @@ OpusTrackEncoder::GetPacketDuration()
|
||||
return GetOutputSampleRate() * kFrameDurationMs / 1000;
|
||||
}
|
||||
|
||||
nsRefPtr<TrackMetadataBase>
|
||||
already_AddRefed<TrackMetadataBase>
|
||||
OpusTrackEncoder::GetMetadata()
|
||||
{
|
||||
{
|
||||
@ -201,7 +201,7 @@ OpusTrackEncoder::GetMetadata()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OpusMetadata* meta = new OpusMetadata();
|
||||
nsRefPtr<OpusMetadata> meta = new OpusMetadata();
|
||||
|
||||
mLookahead = 0;
|
||||
int error = opus_encoder_ctl(mEncoder, OPUS_GET_LOOKAHEAD(&mLookahead));
|
||||
@ -222,7 +222,7 @@ OpusTrackEncoder::GetMetadata()
|
||||
SerializeOpusCommentHeader(vendor, comments,
|
||||
&meta->mCommentHeader);
|
||||
|
||||
return meta;
|
||||
return meta.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -281,7 +281,7 @@ OpusTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData)
|
||||
iter.Next();
|
||||
}
|
||||
|
||||
EncodedFrame* audiodata = new EncodedFrame();
|
||||
nsRefPtr<EncodedFrame> audiodata = new EncodedFrame();
|
||||
audiodata->SetFrameType(EncodedFrame::AUDIO_FRAME);
|
||||
if (mResampler) {
|
||||
nsAutoTArray<AudioDataValue, 9600> resamplingDest;
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
OpusTrackEncoder();
|
||||
virtual ~OpusTrackEncoder();
|
||||
|
||||
nsRefPtr<TrackMetadataBase> GetMetadata() MOZ_OVERRIDE;
|
||||
already_AddRefed<TrackMetadataBase> GetMetadata() MOZ_OVERRIDE;
|
||||
|
||||
nsresult GetEncodedTrack(EncodedFrameContainer& aData) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
/**
|
||||
* Creates and sets up meta data for a specific codec
|
||||
*/
|
||||
virtual nsRefPtr<TrackMetadataBase> GetMetadata() = 0;
|
||||
virtual already_AddRefed<TrackMetadataBase> GetMetadata() = 0;
|
||||
|
||||
/**
|
||||
* Encodes raw segments. Result data is returned in aData.
|
||||
|
@ -4,7 +4,6 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "OggWriter.h"
|
||||
#include "prtime.h"
|
||||
#include "OpusTrackEncoder.h"
|
||||
|
||||
#undef LOG
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
@ -168,24 +167,23 @@ OggWriter::GetContainerData(nsTArray<nsTArray<uint8_t> >* aOutputBufs,
|
||||
}
|
||||
|
||||
nsresult
|
||||
OggWriter::SetMetadata(nsRefPtr<TrackMetadataBase> aMetadata)
|
||||
OggWriter::SetMetadata(TrackMetadataBase* aMetadata)
|
||||
{
|
||||
if (aMetadata->GetKind() != TrackMetadataBase::METADATA_OPUS) {
|
||||
LOG("wrong meta data type!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Validate each field of METADATA
|
||||
OpusMetadata* meta = static_cast<OpusMetadata*>(aMetadata.get());
|
||||
if (meta->mIdHeader.Length() == 0) {
|
||||
mMetadata = static_cast<OpusMetadata*>(aMetadata);
|
||||
if (mMetadata->mIdHeader.Length() == 0) {
|
||||
LOG("miss mIdHeader!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (meta->mCommentHeader.Length() == 0) {
|
||||
if (mMetadata->mCommentHeader.Length() == 0) {
|
||||
LOG("miss mCommentHeader!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mMetadata = aMetadata;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define OggWriter_h_
|
||||
|
||||
#include "ContainerWriter.h"
|
||||
#include "OpusTrackEncoder.h"
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
namespace mozilla {
|
||||
@ -29,7 +30,7 @@ public:
|
||||
uint32_t aFlags = 0) MOZ_OVERRIDE;
|
||||
|
||||
// Check metadata type integrity and reject unacceptable track encoder.
|
||||
nsresult SetMetadata(nsRefPtr<TrackMetadataBase> aMetadata) MOZ_OVERRIDE;
|
||||
nsresult SetMetadata(TrackMetadataBase* aMetadata) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
nsresult Init();
|
||||
@ -38,6 +39,8 @@ private:
|
||||
uint32_t aFlags = 0);
|
||||
|
||||
void ProduceOggPage(nsTArray<nsTArray<uint8_t> >* aOutputBufs);
|
||||
// Store the Medatata from track encoder
|
||||
nsRefPtr<OpusMetadata> mMetadata;
|
||||
|
||||
ogg_stream_state mOggStreamState;
|
||||
ogg_page mOggPage;
|
||||
|
@ -415,7 +415,7 @@ BluetoothHfpManager::Init()
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
mListener = new BluetoothRilListener();
|
||||
if (!mListener->Listen(true)) {
|
||||
if (!mListener->StartListening()) {
|
||||
BT_WARNING("Failed to start listening RIL");
|
||||
return false;
|
||||
}
|
||||
@ -447,7 +447,7 @@ BluetoothHfpManager::Init()
|
||||
BluetoothHfpManager::~BluetoothHfpManager()
|
||||
{
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if (!mListener->Listen(false)) {
|
||||
if (!mListener->StopListening()) {
|
||||
BT_WARNING("Failed to stop listening RIL");
|
||||
}
|
||||
mListener = nullptr;
|
||||
@ -586,14 +586,15 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
void
|
||||
BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
|
||||
BluetoothHfpManager::HandleVoiceConnectionChanged()
|
||||
{
|
||||
nsCOMPtr<nsIMobileConnectionProvider> connection =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(connection);
|
||||
|
||||
nsCOMPtr<nsIDOMMozMobileConnectionInfo> voiceInfo;
|
||||
connection->GetVoiceConnectionInfo(aClientId, getter_AddRefs(voiceInfo));
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
connection->GetVoiceConnectionInfo(0, getter_AddRefs(voiceInfo));
|
||||
NS_ENSURE_TRUE_VOID(voiceInfo);
|
||||
|
||||
nsString type;
|
||||
@ -604,12 +605,11 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
|
||||
voiceInfo->GetRoaming(&roaming);
|
||||
UpdateCIND(CINDType::ROAM, roaming);
|
||||
|
||||
bool service = false;
|
||||
nsString regState;
|
||||
voiceInfo->GetState(regState);
|
||||
bool service = regState.EqualsLiteral("registered");
|
||||
if (service != sCINDItems[CINDType::SERVICE].value) {
|
||||
// Notify BluetoothRilListener of service change
|
||||
mListener->ServiceChanged(aClientId, service);
|
||||
if (regState.EqualsLiteral("registered")) {
|
||||
service = true;
|
||||
}
|
||||
UpdateCIND(CINDType::SERVICE, service);
|
||||
|
||||
@ -630,7 +630,8 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
|
||||
* - manual: set mNetworkSelectionMode to 1 (manual)
|
||||
*/
|
||||
nsString mode;
|
||||
connection->GetNetworkSelectionMode(aClientId, mode);
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
connection->GetNetworkSelectionMode(0, mode);
|
||||
if (mode.EqualsLiteral("manual")) {
|
||||
mNetworkSelectionMode = 1;
|
||||
} else {
|
||||
@ -657,14 +658,15 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId)
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId)
|
||||
BluetoothHfpManager::HandleIccInfoChanged()
|
||||
{
|
||||
nsCOMPtr<nsIIccProvider> icc =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(icc);
|
||||
|
||||
nsCOMPtr<nsIDOMMozIccInfo> iccInfo;
|
||||
icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo));
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
icc->GetIccInfo(0, getter_AddRefs(iccInfo));
|
||||
NS_ENSURE_TRUE_VOID(iccInfo);
|
||||
|
||||
nsCOMPtr<nsIDOMMozGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
|
||||
|
@ -121,8 +121,8 @@ public:
|
||||
void HandleCallStateChanged(uint32_t aCallIndex, uint16_t aCallState,
|
||||
const nsAString& aError, const nsAString& aNumber,
|
||||
const bool aIsOutgoing, bool aSend);
|
||||
void HandleIccInfoChanged(uint32_t aClientId);
|
||||
void HandleVoiceConnectionChanged(uint32_t aClientId);
|
||||
void HandleIccInfoChanged();
|
||||
void HandleVoiceConnectionChanged();
|
||||
#endif
|
||||
|
||||
bool IsConnected();
|
||||
|
@ -7,24 +7,36 @@
|
||||
#include "BluetoothRilListener.h"
|
||||
|
||||
#include "BluetoothHfpManager.h"
|
||||
#include "nsIDOMMobileConnection.h"
|
||||
#include "nsIRadioInterfaceLayer.h"
|
||||
#include "nsIIccProvider.h"
|
||||
#include "nsIMobileConnectionProvider.h"
|
||||
#include "nsITelephonyProvider.h"
|
||||
#include "nsRadioInterfaceLayer.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsString.h"
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* IccListener
|
||||
*/
|
||||
class IccListener : public nsIIccListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIICCLISTENER
|
||||
|
||||
IccListener() { }
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(IccListener, nsIIccListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccListener::NotifyIccInfoChanged()
|
||||
{
|
||||
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||
hfp->HandleIccInfoChanged(mOwner->mClientId);
|
||||
hfp->HandleIccInfoChanged();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -47,39 +59,25 @@ IccListener::NotifyCardStateChanged()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
IccListener::Listen(bool aStart)
|
||||
{
|
||||
nsCOMPtr<nsIIccProvider> provider =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
nsresult rv;
|
||||
if (aStart) {
|
||||
rv = provider->RegisterIccMsg(mOwner->mClientId, this);
|
||||
} else {
|
||||
rv = provider->UnregisterIccMsg(mOwner->mClientId, this);
|
||||
}
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
void
|
||||
IccListener::SetOwner(BluetoothRilListener *aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* MobileConnectionListener
|
||||
*/
|
||||
class MobileConnectionListener : public nsIMobileConnectionListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMOBILECONNECTIONLISTENER
|
||||
|
||||
MobileConnectionListener() { }
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(MobileConnectionListener, nsIMobileConnectionListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionListener::NotifyVoiceChanged()
|
||||
{
|
||||
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||
hfp->HandleVoiceConnectionChanged(mClientId);
|
||||
hfp->HandleVoiceConnectionChanged();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -133,26 +131,20 @@ MobileConnectionListener::NotifyIccChanged()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
MobileConnectionListener::Listen(bool aStart)
|
||||
{
|
||||
nsCOMPtr<nsIMobileConnectionProvider> provider =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
nsresult rv;
|
||||
if (aStart) {
|
||||
rv = provider->RegisterMobileConnectionMsg(mClientId, this);
|
||||
} else {
|
||||
rv = provider->UnregisterMobileConnectionMsg(mClientId, this);
|
||||
}
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
/**
|
||||
* TelephonyListener Implementation
|
||||
*
|
||||
* TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
*/
|
||||
class TelephonyListener : public nsITelephonyListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITELEPHONYLISTENER
|
||||
|
||||
TelephonyListener() { }
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(TelephonyListener, nsITelephonyListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -251,109 +243,36 @@ TelephonyListener::NotifyCdmaCallWaiting(uint32_t aServiceId,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
TelephonyListener::Listen(bool aStart)
|
||||
{
|
||||
nsCOMPtr<nsITelephonyProvider> provider =
|
||||
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
nsresult rv;
|
||||
if (aStart) {
|
||||
rv = provider->RegisterListener(this);
|
||||
} else {
|
||||
rv = provider->UnregisterListener(this);
|
||||
}
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
/**
|
||||
* BluetoothRilListener
|
||||
*/
|
||||
BluetoothRilListener::BluetoothRilListener()
|
||||
{
|
||||
// Query number of total clients (sim slots)
|
||||
uint32_t numOfClients;
|
||||
nsCOMPtr<nsIRadioInterfaceLayer> radioInterfaceLayer =
|
||||
do_GetService(NS_RADIOINTERFACELAYER_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(radioInterfaceLayer);
|
||||
|
||||
radioInterfaceLayer->GetNumRadioInterfaces(&numOfClients);
|
||||
|
||||
// Init MobileConnectionListener array and IccInfoListener
|
||||
for (uint32_t i = 0; i < numOfClients; i++) {
|
||||
MobileConnectionListener listener(i);
|
||||
mMobileConnListeners.AppendElement(listener);
|
||||
}
|
||||
mIccListener.SetOwner(this);
|
||||
|
||||
// Probe for available client
|
||||
SelectClient();
|
||||
mIccListener = new IccListener();
|
||||
mMobileConnectionListener = new MobileConnectionListener();
|
||||
mTelephonyListener = new TelephonyListener();
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRilListener::Listen(bool aStart)
|
||||
BluetoothRilListener::StartListening()
|
||||
{
|
||||
NS_ENSURE_TRUE(ListenMobileConnAndIccInfo(aStart), false);
|
||||
NS_ENSURE_TRUE(mTelephonyListener.Listen(aStart), false);
|
||||
NS_ENSURE_TRUE(StartIccListening(), false);
|
||||
NS_ENSURE_TRUE(StartMobileConnectionListening(), false);
|
||||
NS_ENSURE_TRUE(StartTelephonyListening(), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothRilListener::SelectClient()
|
||||
bool
|
||||
BluetoothRilListener::StopListening()
|
||||
{
|
||||
// Reset mClientId
|
||||
mClientId = mMobileConnListeners.Length();
|
||||
NS_ENSURE_TRUE(StopIccListening(), false);
|
||||
NS_ENSURE_TRUE(StopMobileConnectionListening(), false);
|
||||
NS_ENSURE_TRUE(StopTelephonyListening(), false);
|
||||
|
||||
nsCOMPtr<nsIMobileConnectionProvider> connection =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(connection);
|
||||
|
||||
uint32_t i;
|
||||
for (i = 0; i < mMobileConnListeners.Length(); i++) {
|
||||
nsCOMPtr<nsIDOMMozMobileConnectionInfo> voiceInfo;
|
||||
connection->GetVoiceConnectionInfo(i, getter_AddRefs(voiceInfo));
|
||||
if (!voiceInfo) {
|
||||
BT_WARNING("%s: Failed to get voice connection info", __FUNCTION__);
|
||||
continue;
|
||||
}
|
||||
|
||||
nsString regState;
|
||||
voiceInfo->GetState(regState);
|
||||
if (regState.EqualsLiteral("registered")) {
|
||||
// Found available client
|
||||
mClientId = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothRilListener::ServiceChanged(uint32_t aClientId, bool aRegistered)
|
||||
{
|
||||
// Stop listening
|
||||
ListenMobileConnAndIccInfo(false);
|
||||
|
||||
/**
|
||||
* aRegistered:
|
||||
* - TRUE: service becomes registered. We were listening to all clients
|
||||
* and one of them becomes available. Select it to listen.
|
||||
* - FALSE: service becomes un-registered. The client we were listening
|
||||
* becomes unavailable. Select another registered one to listen.
|
||||
*/
|
||||
if (aRegistered) {
|
||||
mClientId = aClientId;
|
||||
} else {
|
||||
SelectClient();
|
||||
}
|
||||
|
||||
// Restart listening
|
||||
ListenMobileConnAndIccInfo(true);
|
||||
|
||||
BT_LOGR("%s: %d client %d. new mClientId %d", __FUNCTION__, aRegistered, aClientId,
|
||||
(mClientId < mMobileConnListeners.Length()) ? mClientId : -1);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
@ -363,32 +282,78 @@ BluetoothRilListener::EnumerateCalls()
|
||||
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(provider);
|
||||
|
||||
nsCOMPtr<nsITelephonyListener> listener(
|
||||
do_QueryInterface(&mTelephonyListener));
|
||||
provider->EnumerateCalls(mTelephonyListener);
|
||||
}
|
||||
|
||||
provider->EnumerateCalls(listener);
|
||||
// private
|
||||
bool
|
||||
BluetoothRilListener::StartIccListening()
|
||||
{
|
||||
nsCOMPtr<nsIIccProvider> provider =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
nsresult rv = provider->RegisterIccMsg(0, mIccListener);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRilListener::ListenMobileConnAndIccInfo(bool aStart)
|
||||
BluetoothRilListener::StopIccListening()
|
||||
{
|
||||
/**
|
||||
* mClientId < number of total clients:
|
||||
* The client with mClientId is available. Start/Stop listening
|
||||
* mobile connection and icc info of this client only.
|
||||
*
|
||||
* mClientId >= number of total clients:
|
||||
* All clients are unavailable. Start/Stop listening mobile
|
||||
* connections of all clients.
|
||||
*/
|
||||
if (mClientId < mMobileConnListeners.Length()) {
|
||||
NS_ENSURE_TRUE(mMobileConnListeners[mClientId].Listen(aStart), false);
|
||||
NS_ENSURE_TRUE(mIccListener.Listen(aStart), false);
|
||||
} else {
|
||||
for (uint32_t i = 0; i < mMobileConnListeners.Length(); i++) {
|
||||
NS_ENSURE_TRUE(mMobileConnListeners[i].Listen(aStart), false);
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIIccProvider> provider =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
return true;
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
nsresult rv = provider->UnregisterIccMsg(0, mIccListener);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRilListener::StartMobileConnectionListening()
|
||||
{
|
||||
nsCOMPtr<nsIMobileConnectionProvider> provider =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
nsresult rv = provider->
|
||||
RegisterMobileConnectionMsg(0, mMobileConnectionListener);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRilListener::StopMobileConnectionListening()
|
||||
{
|
||||
nsCOMPtr<nsIMobileConnectionProvider> provider =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
// TODO: Bug 921991 - B2G BT: support multiple sim cards
|
||||
nsresult rv = provider->
|
||||
UnregisterMobileConnectionMsg(0, mMobileConnectionListener);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRilListener::StartTelephonyListening()
|
||||
{
|
||||
nsCOMPtr<nsITelephonyProvider> provider =
|
||||
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
nsresult rv = provider->RegisterListener(mTelephonyListener);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRilListener::StopTelephonyListening()
|
||||
{
|
||||
nsCOMPtr<nsITelephonyProvider> provider =
|
||||
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(provider, false);
|
||||
|
||||
nsresult rv = provider->UnregisterListener(mTelephonyListener);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
@ -9,114 +9,37 @@
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
|
||||
#include "nsIIccProvider.h"
|
||||
#include "nsIMobileConnectionProvider.h"
|
||||
#include "nsITelephonyProvider.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsIIccListener;
|
||||
class nsIMobileConnectionListener;
|
||||
class nsITelephonyListener;
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothRilListener;
|
||||
|
||||
class IccListener : public nsIIccListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIICCLISTENER
|
||||
|
||||
IccListener() { }
|
||||
|
||||
bool Listen(bool aStart);
|
||||
void SetOwner(BluetoothRilListener *aOwner);
|
||||
|
||||
private:
|
||||
BluetoothRilListener* mOwner;
|
||||
};
|
||||
|
||||
class MobileConnectionListener : public nsIMobileConnectionListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMOBILECONNECTIONLISTENER
|
||||
|
||||
MobileConnectionListener(uint32_t aClientId)
|
||||
: mClientId(aClientId) { }
|
||||
|
||||
bool Listen(bool aStart);
|
||||
|
||||
private:
|
||||
uint32_t mClientId;
|
||||
};
|
||||
|
||||
class TelephonyListener : public nsITelephonyListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITELEPHONYLISTENER
|
||||
|
||||
TelephonyListener() { }
|
||||
|
||||
bool Listen(bool aStart);
|
||||
};
|
||||
|
||||
class BluetoothRilListener
|
||||
{
|
||||
public:
|
||||
BluetoothRilListener();
|
||||
|
||||
/**
|
||||
* Start/Stop listening.
|
||||
*
|
||||
* @param aStart [in] whether to start/stop listening
|
||||
*/
|
||||
bool Listen(bool aStart);
|
||||
bool StartListening();
|
||||
bool StopListening();
|
||||
|
||||
/**
|
||||
* Be informed that certain client's service has changed.
|
||||
*
|
||||
* @param aClientId [in] the client id with service change
|
||||
* @param aRegistered [in] whether changed service is registered
|
||||
*/
|
||||
void ServiceChanged(uint32_t aClientId, bool aRegistered);
|
||||
|
||||
/**
|
||||
* Enumerate current calls.
|
||||
*/
|
||||
void EnumerateCalls();
|
||||
|
||||
/**
|
||||
* The id of client that mobile connection and icc info listeners
|
||||
* are listening to.
|
||||
*
|
||||
* mClientId equals to number of total clients (array length of
|
||||
* mobile connection listeners) if there is no available client to listen.
|
||||
*/
|
||||
uint32_t mClientId;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Start/Stop listening of mobile connection and icc info.
|
||||
*
|
||||
* @param aStart [in] whether to start/stop listening
|
||||
*/
|
||||
bool ListenMobileConnAndIccInfo(bool aStart);
|
||||
bool StartIccListening();
|
||||
bool StopIccListening();
|
||||
|
||||
/**
|
||||
* Select available client to listen and assign mClientId.
|
||||
*
|
||||
* mClientId is assigned to number of total clients (array length of
|
||||
* mobile connection listeners) if there is no available client to listen.
|
||||
*/
|
||||
void SelectClient();
|
||||
bool StartMobileConnectionListening();
|
||||
bool StopMobileConnectionListening();
|
||||
|
||||
/**
|
||||
* Array of mobile connection listeners.
|
||||
*
|
||||
* The length equals to number of total clients.
|
||||
*/
|
||||
nsTArray<MobileConnectionListener> mMobileConnListeners;
|
||||
bool StartTelephonyListening();
|
||||
bool StopTelephonyListening();
|
||||
|
||||
IccListener mIccListener;
|
||||
TelephonyListener mTelephonyListener;
|
||||
nsCOMPtr<nsIIccListener> mIccListener;
|
||||
nsCOMPtr<nsIMobileConnectionListener> mMobileConnectionListener;
|
||||
nsCOMPtr<nsITelephonyListener> mTelephonyListener;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
@ -24,9 +24,14 @@ docShell.setFullscreenAllowed(infos.fullscreenAllowed);
|
||||
|
||||
|
||||
if (!('BrowserElementIsPreloaded' in this)) {
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
|
||||
Services.scriptloader.loadSubScript("chrome://global/content/forms.js");
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
// Those are produc-specific files that's sometimes unavailable.
|
||||
try {
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/forms.js");
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/ErrorPage.js");
|
||||
} catch (e) {
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ this.EXPORTED_SYMBOLS = ['Keyboard'];
|
||||
const Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const kFormsFrameScript = 'chrome://browser/content/forms.js';
|
||||
const kFormsFrameScript = 'chrome://global/content/forms.js';
|
||||
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
@ -64,27 +64,31 @@ this.Keyboard = {
|
||||
ppmm.broadcastAsyncMessage('Keyboard:FocusChange', { 'type': 'blur' });
|
||||
}
|
||||
} else {
|
||||
mm.addMessageListener('Forms:Input', this);
|
||||
mm.addMessageListener('Forms:SelectionChange', this);
|
||||
mm.addMessageListener('Forms:GetText:Result:OK', this);
|
||||
mm.addMessageListener('Forms:GetText:Result:Error', this);
|
||||
mm.addMessageListener('Forms:SetSelectionRange:Result:OK', this);
|
||||
mm.addMessageListener('Forms:ReplaceSurroundingText:Result:OK', this);
|
||||
mm.addMessageListener('Forms:SendKey:Result:OK', this);
|
||||
mm.addMessageListener('Forms:SequenceError', this);
|
||||
mm.addMessageListener('Forms:GetContext:Result:OK', this);
|
||||
mm.addMessageListener('Forms:SetComposition:Result:OK', this);
|
||||
mm.addMessageListener('Forms:EndComposition:Result:OK', this);
|
||||
this.initFormsFrameScript(mm);
|
||||
}
|
||||
},
|
||||
|
||||
// When not running apps OOP, we need to load forms.js here since this
|
||||
// won't happen from dom/ipc/preload.js
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("dom.ipc.tabs.disabled") === true) {
|
||||
mm.loadFrameScript(kFormsFrameScript, true);
|
||||
}
|
||||
} catch (e) {
|
||||
dump('Error loading ' + kFormsFrameScript + ' as frame script: ' + e + '\n');
|
||||
initFormsFrameScript: function(mm) {
|
||||
mm.addMessageListener('Forms:Input', this);
|
||||
mm.addMessageListener('Forms:SelectionChange', this);
|
||||
mm.addMessageListener('Forms:GetText:Result:OK', this);
|
||||
mm.addMessageListener('Forms:GetText:Result:Error', this);
|
||||
mm.addMessageListener('Forms:SetSelectionRange:Result:OK', this);
|
||||
mm.addMessageListener('Forms:ReplaceSurroundingText:Result:OK', this);
|
||||
mm.addMessageListener('Forms:SendKey:Result:OK', this);
|
||||
mm.addMessageListener('Forms:SequenceError', this);
|
||||
mm.addMessageListener('Forms:GetContext:Result:OK', this);
|
||||
mm.addMessageListener('Forms:SetComposition:Result:OK', this);
|
||||
mm.addMessageListener('Forms:EndComposition:Result:OK', this);
|
||||
|
||||
// When not running apps OOP, we need to load forms.js here since this
|
||||
// won't happen from dom/ipc/preload.js
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("dom.ipc.tabs.disabled") === true) {
|
||||
mm.loadFrameScript(kFormsFrameScript, true);
|
||||
}
|
||||
} catch (e) {
|
||||
dump('Error loading ' + kFormsFrameScript + ' as frame script: ' + e + '\n');
|
||||
}
|
||||
},
|
||||
|
||||
|
6
dom/inputmethod/jar.mn
Normal file
6
dom/inputmethod/jar.mn
Normal file
@ -0,0 +1,6 @@
|
||||
# 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/.
|
||||
|
||||
toolkit.jar:
|
||||
content/global/forms.js (forms.js)
|
@ -87,9 +87,15 @@ const BrowserElementIsPreloaded = true;
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
|
||||
Services.scriptloader.loadSubScript("chrome://global/content/forms.js", global);
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
// Those are produc-specific files that's sometimes unavailable.
|
||||
try {
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/forms.js", global);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/ErrorPage.js", global);
|
||||
} catch (e) {
|
||||
}
|
||||
|
@ -11,6 +11,4 @@
|
||||
#define NS_RILCONTENTHELPER_CID \
|
||||
{ 0x472816e1, 0x1fd6, 0x4405, \
|
||||
{ 0x99, 0x6c, 0x80, 0x6f, 0x9e, 0xa6, 0x81, 0x74 } }
|
||||
|
||||
#define NS_RADIOINTERFACELAYER_CONTRACTID "@mozilla.org/ril;1"
|
||||
#define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
|
||||
|
@ -195,12 +195,14 @@ var WifiManager = (function() {
|
||||
// On properly written drivers, bringing the interface
|
||||
// down powers down the interface.
|
||||
callback(0);
|
||||
notify("supplicantlost", { success: true });
|
||||
return;
|
||||
}
|
||||
|
||||
wifiCommand.unloadDriver(function(status) {
|
||||
driverLoaded = (status < 0);
|
||||
callback(status);
|
||||
notify("supplicantlost", { success: true });
|
||||
});
|
||||
}
|
||||
|
||||
@ -413,6 +415,12 @@ var WifiManager = (function() {
|
||||
}
|
||||
|
||||
function notifyStateChange(fields) {
|
||||
// Don't handle any state change when and after disabling.
|
||||
if (manager.state === "DISABLING" ||
|
||||
manager.state === "UNINITIALIZED") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we're already in the COMPLETED state, we might receive events from
|
||||
// the supplicant that tell us that we're re-authenticating or reminding
|
||||
// us that we're associated to a network. In those cases, we don't need to
|
||||
@ -676,22 +684,22 @@ var WifiManager = (function() {
|
||||
return true;
|
||||
}
|
||||
if (eventData.indexOf("CTRL-EVENT-TERMINATING") === 0) {
|
||||
// If the monitor socket is closed, we have already stopped the
|
||||
// supplicant and we can stop waiting for more events and
|
||||
// simply exit here (we don't have to notify about having lost
|
||||
// the connection).
|
||||
if (eventData.indexOf("connection closed") !== -1) {
|
||||
notify("supplicantlost", { success: true });
|
||||
return false;
|
||||
}
|
||||
|
||||
// As long we haven't seen too many recv errors yet, we
|
||||
// will keep going for a bit longer.
|
||||
if (eventData.indexOf("recv error") !== -1 && ++recvErrors < 10)
|
||||
// As long the monitor socket is not closed and we haven't seen too many
|
||||
// recv errors yet, we will keep going for a bit longer.
|
||||
if (eventData.indexOf("connection closed") === -1 &&
|
||||
eventData.indexOf("recv error") !== -1 && ++recvErrors < 10)
|
||||
return true;
|
||||
|
||||
notifyStateChange({ state: "DISCONNECTED", BSSID: null, id: -1 });
|
||||
notify("supplicantlost", { success: true });
|
||||
|
||||
// If the supplicant is terminated as commanded, the supplicant lost
|
||||
// notification will be sent after driver unloaded. In such case, the
|
||||
// manager state will be "DISABLING" or "UNINITIALIZED".
|
||||
// So if supplicant terminated with incorrect manager state, implying
|
||||
// unexpected condition, we should notify supplicant lost here.
|
||||
if (manager.state !== "DISABLING" && manager.state !== "UNINITIALIZED") {
|
||||
notify("supplicantlost", { success: true });
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (eventData.indexOf("CTRL-EVENT-DISCONNECTED") === 0) {
|
||||
@ -897,6 +905,7 @@ var WifiManager = (function() {
|
||||
// Note these following calls ignore errors. If we fail to kill the
|
||||
// supplicant gracefully, then we need to continue telling it to die
|
||||
// until it does.
|
||||
manager.state = "DISABLING";
|
||||
wifiCommand.terminateSupplicant(function (ok) {
|
||||
manager.connectionDropped(function () {
|
||||
wifiCommand.stopSupplicant(function (status) {
|
||||
|
@ -1509,7 +1509,7 @@ private:
|
||||
"rtp-time", (int32_t *)&rtpTime));
|
||||
|
||||
int64_t relRtpTimeUs =
|
||||
(((int64_t)rtpTime - (int64_t)track->mRTPAnchor) * 1000000ll)
|
||||
(((int64_t)rtpTime - (int64_t)track->mNormalPlayTimeRTP) * 1000000ll)
|
||||
/ track->mTimeScale;
|
||||
|
||||
int64_t ntpTimeUs = track->mNTPAnchorUs + relRtpTimeUs;
|
||||
|
@ -32,12 +32,14 @@
|
||||
#define SECCOMP_WHITELIST_ARCH_LOW \
|
||||
ALLOW_SYSCALL(_llseek), \
|
||||
ALLOW_SYSCALL(getuid32), \
|
||||
ALLOW_SYSCALL(geteuid32), \
|
||||
ALLOW_SYSCALL(sigreturn), \
|
||||
ALLOW_SYSCALL(fcntl64),
|
||||
#elif defined(__i386__)
|
||||
#define SECCOMP_WHITELIST_ARCH_LOW \
|
||||
ALLOW_SYSCALL(_llseek), \
|
||||
ALLOW_SYSCALL(getuid32), \
|
||||
ALLOW_SYSCALL(geteuid32), \
|
||||
ALLOW_SYSCALL(sigreturn), \
|
||||
ALLOW_SYSCALL(fcntl64),
|
||||
#else
|
||||
@ -70,11 +72,13 @@
|
||||
#define SECCOMP_WHITELIST_ARCH_TOREMOVE \
|
||||
ALLOW_SYSCALL(fstat64), \
|
||||
ALLOW_SYSCALL(stat64), \
|
||||
ALLOW_SYSCALL(lstat64), \
|
||||
ALLOW_SYSCALL(sigprocmask),
|
||||
#elif defined(__i386__)
|
||||
#define SECCOMP_WHITELIST_ARCH_TOREMOVE \
|
||||
ALLOW_SYSCALL(fstat64), \
|
||||
ALLOW_SYSCALL(stat64), \
|
||||
ALLOW_SYSCALL(lstat64), \
|
||||
ALLOW_SYSCALL(sigprocmask),
|
||||
#else
|
||||
#define SECCOMP_WHITELIST_ARCH_TOREMOVE
|
||||
@ -133,6 +137,9 @@
|
||||
ALLOW_SYSCALL(access), \
|
||||
ALLOW_SYSCALL(getdents64), \
|
||||
ALLOW_SYSCALL(unlink), \
|
||||
ALLOW_SYSCALL(fsync), \
|
||||
ALLOW_SYSCALL(socketpair), \
|
||||
ALLOW_SYSCALL(sendmsg), \
|
||||
/* Should remove all of the following in the future, if possible */ \
|
||||
ALLOW_SYSCALL(getpriority), \
|
||||
ALLOW_SYSCALL(setpriority), \
|
||||
|
Loading…
Reference in New Issue
Block a user