diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 9bd81f94aeb..a30921049e1 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "65400ea2bb3e99ad717f4b99e24ebbfa23b05b58", + "revision": "3b850fa17c888bdd31f1a163fd7b92f6f020449d", "repo_path": "/integration/gaia-central" } diff --git a/content/media/encoder/OpusTrackEncoder.cpp b/content/media/encoder/OpusTrackEncoder.cpp index 8ddedc170ab..e1ce627feac 100644 --- a/content/media/encoder/OpusTrackEncoder.cpp +++ b/content/media/encoder/OpusTrackEncoder.cpp @@ -287,8 +287,8 @@ OpusTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData) if (!chunk.IsNull()) { // Append the interleaved data to the end of pcm buffer. - InterleaveTrackData(chunk, frameToCopy, mChannels, - pcm.Elements() + frameCopied * mChannels); + AudioTrackEncoder::InterleaveTrackData(chunk, frameToCopy, mChannels, + pcm.Elements() + frameCopied * mChannels); } else { memset(pcm.Elements() + frameCopied * mChannels, 0, frameToCopy * mChannels * sizeof(AudioDataValue)); diff --git a/content/media/encoder/TrackEncoder.cpp b/content/media/encoder/TrackEncoder.cpp index fdecba8eeb8..42df784445e 100644 --- a/content/media/encoder/TrackEncoder.cpp +++ b/content/media/encoder/TrackEncoder.cpp @@ -106,6 +106,7 @@ AudioTrackEncoder::AppendAudioSegment(const AudioSegment& aSegment) static const int AUDIO_PROCESSING_FRAMES = 640; /* > 10ms of 48KHz audio */ static const uint8_t gZeroChannel[MAX_AUDIO_SAMPLE_SIZE*AUDIO_PROCESSING_FRAMES] = {0}; +/*static*/ void AudioTrackEncoder::InterleaveTrackData(AudioChunk& aChunk, int32_t aDuration, @@ -119,11 +120,11 @@ AudioTrackEncoder::InterleaveTrackData(AudioChunk& aChunk, if (aChunk.mChannelData.Length() > aOutputChannels) { DownmixAndInterleave(aChunk.mChannelData, aChunk.mBufferFormat, aDuration, - aChunk.mVolume, mChannels, aOutput); + aChunk.mVolume, aOutputChannels, aOutput); } else { InterleaveAndConvertBuffer(aChunk.mChannelData.Elements(), aChunk.mBufferFormat, aDuration, aChunk.mVolume, - mChannels, aOutput); + aOutputChannels, aOutput); } } diff --git a/content/media/encoder/TrackEncoder.h b/content/media/encoder/TrackEncoder.h index 3602d09744a..f322fc93126 100644 --- a/content/media/encoder/TrackEncoder.h +++ b/content/media/encoder/TrackEncoder.h @@ -148,6 +148,16 @@ public: uint32_t aTrackEvents, const MediaSegment& aQueuedMedia) MOZ_OVERRIDE; + /** + * Interleaves the track data and stores the result into aOutput. Might need + * to up-mix or down-mix the channel data if the channels number of this chunk + * is different from aOutputChannels. The channel data from aChunk might be + * modified by up-mixing. + */ + static void InterleaveTrackData(AudioChunk& aChunk, int32_t aDuration, + uint32_t aOutputChannels, + AudioDataValue* aOutput); + protected: /** * Number of samples per channel in a pcm buffer. This is also the value of @@ -179,15 +189,6 @@ protected: */ virtual void NotifyEndOfStream() MOZ_OVERRIDE; - /** - * Interleaves the track data and stores the result into aOutput. Might need - * to up-mix or down-mix the channel data if the channels number of this chunk - * is different from mChannels. The channel data from aChunk might be modified - * by up-mixing. - */ - void InterleaveTrackData(AudioChunk& aChunk, int32_t aDuration, - uint32_t aOutputChannels, AudioDataValue* aOutput); - /** * The number of channels are used for processing PCM data in the audio encoder. * This value comes from the first valid audio chunk. If encoder can't support diff --git a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp index cd33064466f..420f48226ec 100644 --- a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp @@ -10,7 +10,9 @@ #include #include +#if ANDROID_VERSION > 17 #include +#endif #include "BluetoothCommon.h" #include "BluetoothService.h" @@ -31,7 +33,9 @@ namespace { StaticRefPtr sBluetoothA2dpManager; bool sInShutdown = false; static const btav_interface_t* sBtA2dpInterface; +#if ANDROID_VERSION > 17 static const btrc_interface_t* sBtAvrcpInterface; +#endif } // anonymous namespace class SinkPropertyChangedHandler : public nsRunnable @@ -82,6 +86,7 @@ public: } }; +#if ANDROID_VERSION > 17 class UpdateRegisterNotificationTask : public nsRunnable { public: @@ -173,6 +178,7 @@ private: uint8_t mNumAttr; btrc_media_attr_t* mPlayerAttrs; }; +#endif NS_IMETHODIMP BluetoothA2dpManager::Observe(nsISupports* aSubject, @@ -264,6 +270,7 @@ A2dpAudioStateCallback(btav_audio_state_t aState, NS_DispatchToMainThread(new SinkPropertyChangedHandler(signal)); } +#if ANDROID_VERSION > 17 /* * Avrcp 1.3 callbacks */ @@ -369,6 +376,42 @@ AvrcpSetPlayerAppValueCallback(btrc_player_settings_t* aPlayerVals) // TODO: Support avrcp application setting related functions } +#endif + +#if ANDROID_VERSION > 18 +/* + * This callback function is to get CT features from Feature Bit Mask. + * If Advanced Control Player bit is set, CT supports + * volume sync (absolute volume feature). If Browsing bit is set, Avrcp 1.4 + * Browse feature will be supported + */ +static void +AvrcpRemoteFeaturesCallback(bt_bdaddr_t* aBdAddress, + btrc_remote_features_t aFeatures) +{ +// TODO: Support avrcp 1.4 absolute volume/browse +} + +/* + * This callback function is to get notification that volume changed on the + * remote car kit (if it supports Avrcp 1.4), not notification from phone. + */ +static void +AvrcpRemoteVolumeChangedCallback(uint8_t aVolume, uint8_t aCType) +{ +// TODO: Support avrcp 1.4 absolute volume/browse +} + +/* + * This callback function is to get notification that volume changed on the + * remote car kit (if it supports Avrcp 1.4), not notification from phone. + */ +static void +AvrcpPassThroughCallback(int id, int key_state) +{ +// TODO: Support avrcp 1.4 absolute volume/browse +} +#endif static btav_callbacks_t sBtA2dpCallbacks = { sizeof(sBtA2dpCallbacks), @@ -376,8 +419,12 @@ static btav_callbacks_t sBtA2dpCallbacks = { A2dpAudioStateCallback }; +#if ANDROID_VERSION > 17 static btrc_callbacks_t sBtAvrcpCallbacks = { sizeof(sBtAvrcpCallbacks), +#if ANDROID_VERSION > 18 + AvrcpRemoteFeaturesCallback, +#endif AvrcpGetPlayStatusCallback, AvrcpListPlayerAppAttributeCallback, AvrcpListPlayerAppValuesCallback, @@ -386,8 +433,13 @@ static btrc_callbacks_t sBtAvrcpCallbacks = { AvrcpGetPlayerAppValuesTextCallback, AvrcpSetPlayerAppValueCallback, AvrcpGetElementAttrCallback, - AvrcpRegisterNotificationCallback + AvrcpRegisterNotificationCallback, +#if ANDROID_VERSION > 18 + AvrcpRemoteVolumeChangedCallback, + AvrcpPassThroughCallback +#endif }; +#endif /* * This function will be only called when Bluetooth is turning on. @@ -411,6 +463,7 @@ BluetoothA2dpManager::Init() return false; } +#if ANDROID_VERSION > 17 sBtAvrcpInterface = (btrc_interface_t *)btInf-> get_profile_interface(BT_PROFILE_AV_RC_ID); NS_ENSURE_TRUE(sBtAvrcpInterface, false); @@ -420,6 +473,7 @@ BluetoothA2dpManager::Init() BT_LOGR("Warning: failed to init avrcp module"); return false; } +#endif return true; } @@ -768,6 +822,7 @@ BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle, { MOZ_ASSERT(NS_IsMainThread()); +#if ANDROID_VERSION > 17 NS_ENSURE_TRUE_VOID(sBtAvrcpInterface); // Send track changed and position changed if track num is not the same. @@ -802,6 +857,7 @@ BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle, mMediaNumber = aMediaNumber; mTotalMediaCount = aTotalMediaCount; mDuration = aDuration; +#endif } /* @@ -815,6 +871,7 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration, { MOZ_ASSERT(NS_IsMainThread()); +#if ANDROID_VERSION > 17 NS_ENSURE_TRUE_VOID(sBtAvrcpInterface); // when play status changed, send both play status and position if (mPlayStatus != aPlayStatus && @@ -842,6 +899,7 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration, mDuration = aDuration; mPosition = aPosition; mPlayStatus = aPlayStatus; +#endif } /* @@ -856,6 +914,7 @@ BluetoothA2dpManager::UpdateRegisterNotification(int aEventId, int aParam) { MOZ_ASSERT(NS_IsMainThread()); +#if ANDROID_VERSION > 17 NS_ENSURE_TRUE_VOID(sBtAvrcpInterface); btrc_register_notification_t param; @@ -885,6 +944,7 @@ BluetoothA2dpManager::UpdateRegisterNotification(int aEventId, int aParam) sBtAvrcpInterface->register_notification_rsp((btrc_event_id_t)aEventId, BTRC_NOTIFICATION_TYPE_INTERIM, ¶m); +#endif } void diff --git a/dom/network/interfaces/nsIMobileConnectionProvider.idl b/dom/network/interfaces/nsIMobileConnectionProvider.idl index 8299ccbe201..63396f46d73 100644 --- a/dom/network/interfaces/nsIMobileConnectionProvider.idl +++ b/dom/network/interfaces/nsIMobileConnectionProvider.idl @@ -35,7 +35,7 @@ interface nsIMobileConnectionListener : nsISupports * XPCOM component (in the content process) that provides the mobile * network information. */ -[scriptable, uuid(0e027520-dd87-461d-88a6-c3e46369c03c)] +[scriptable, uuid(55b8d918-8631-4d72-a9d7-f8c9536d6e6f)] interface nsIMobileConnectionProvider : nsISupports { /** @@ -48,6 +48,15 @@ interface nsIMobileConnectionProvider : nsISupports void unregisterMobileConnectionMsg(in unsigned long clientId, in nsIMobileConnectionListener listener); + /** + * These two fields require the 'mobilenetwork' permission. + */ + DOMString getLastKnownNetwork(in unsigned long clientId); + DOMString getLastKnownHomeNetwork(in unsigned long clientId); + + /** + * All fields below require the 'mobileconnection' permission. + */ nsIDOMMozMobileConnectionInfo getVoiceConnectionInfo(in unsigned long clientId); nsIDOMMozMobileConnectionInfo getDataConnectionInfo(in unsigned long clientId); DOMString getIccId(in unsigned long clientId); diff --git a/dom/network/src/MobileConnection.cpp b/dom/network/src/MobileConnection.cpp index dfe374bceac..a7420242aeb 100644 --- a/dom/network/src/MobileConnection.cpp +++ b/dom/network/src/MobileConnection.cpp @@ -133,8 +133,7 @@ MobileConnection::GetLastKnownNetwork(nsAString& aNetwork) return NS_OK; } - aNetwork = mozilla::Preferences::GetString("ril.lastKnownNetwork"); - return NS_OK; + return mProvider->GetLastKnownNetwork(mClientId, aNetwork); } NS_IMETHODIMP @@ -146,8 +145,7 @@ MobileConnection::GetLastKnownHomeNetwork(nsAString& aNetwork) return NS_OK; } - aNetwork = mozilla::Preferences::GetString("ril.lastKnownHomeNetwork"); - return NS_OK; + return mProvider->GetLastKnownHomeNetwork(mClientId, aNetwork); } // All fields below require the "mobileconnection" permission. diff --git a/dom/network/tests/marionette/manifest.ini b/dom/network/tests/marionette/manifest.ini index 59f7a4e3e73..8b4458643e7 100644 --- a/dom/network/tests/marionette/manifest.ini +++ b/dom/network/tests/marionette/manifest.ini @@ -19,3 +19,4 @@ disabled = Bug 808783 [test_call_barring_set_error.js] [test_call_barring_change_password.js] [test_mobile_set_radio.js] +[test_mobile_last_known_network.js] diff --git a/dom/network/tests/marionette/test_mobile_last_known_network.js b/dom/network/tests/marionette/test_mobile_last_known_network.js new file mode 100644 index 00000000000..3adb50694f4 --- /dev/null +++ b/dom/network/tests/marionette/test_mobile_last_known_network.js @@ -0,0 +1,47 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 30000; + +SpecialPowers.addPermission("mobilenetwork", true, document); + +let connection = navigator.mozMobileConnections[0]; +ok(connection instanceof MozMobileConnection, + "connection is instanceof " + connection.constructor); + + +function testLastKnownNetwork() { + log("testLastKnownNetwork: " + connection.lastKnownNetwork); + // The emulator's hard coded operatoer's mcc and mnc codes. + is(connection.lastKnownNetwork, "310-260"); + runNextTest(); +} + +function testLastKnownHomeNetwork() { + log("testLastKnownHomeNetwork: " + connection.lastKnownHomeNetwork); + // The emulator's hard coded icc's mcc and mnc codes. + is(connection.lastKnownHomeNetwork, "310-260"); + runNextTest(); +} + +let tests = [ + testLastKnownNetwork, + testLastKnownHomeNetwork +]; + +function runNextTest() { + let test = tests.shift(); + if (!test) { + cleanUp(); + return; + } + + test(); +} + +function cleanUp() { + SpecialPowers.removePermission("mobilenetwork", document); + finish(); +} + +runNextTest(); diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js index 73b4d2b680f..ec338a8007c 100644 --- a/dom/system/gonk/RILContentHelper.js +++ b/dom/system/gonk/RILContentHelper.js @@ -643,6 +643,18 @@ RILContentHelper.prototype = { * nsIMobileConnectionProvider */ + getLastKnownNetwork: function getLastKnownNetwork(clientId) { + return cpmm.sendSyncMessage("RIL:GetLastKnownNetwork", { + clientId: clientId + })[0]; + }, + + getLastKnownHomeNetwork: function getLastKnownHomeNetwork(clientId) { + return cpmm.sendSyncMessage("RIL:GetLastKnownHomeNetwork", { + clientId: clientId + })[0]; + }, + getVoiceConnectionInfo: function getVoiceConnectionInfo(clientId) { let context = this.getRilContext(clientId); return context && context.voiceConnectionInfo; diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index db221162346..fea52f0bc36 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -118,6 +118,11 @@ const RIL_IPC_MOBILECONNECTION_MSG_NAMES = [ "RIL:GetVoicePrivacyMode" ]; +const RIL_IPC_MOBILENETWORK_MSG_NAMES = [ + "RIL:GetLastKnownNetwork", + "RIL:GetLastKnownHomeNetwork" +]; + const RIL_IPC_ICCMANAGER_MSG_NAMES = [ "RIL:SendStkResponse", "RIL:SendStkMenuSelection", @@ -235,6 +240,9 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () { for (let msgname of RIL_IPC_MOBILECONNECTION_MSG_NAMES) { ppmm.addMessageListener(msgname, this); } + for (let msgname of RIL_IPC_MOBILENETWORK_MSG_NAMES) { + ppmm.addMessageListener(msgname, this); + } for (let msgName of RIL_IPC_ICCMANAGER_MSG_NAMES) { ppmm.addMessageListener(msgName, this); } @@ -251,6 +259,9 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () { for (let msgname of RIL_IPC_MOBILECONNECTION_MSG_NAMES) { ppmm.removeMessageListener(msgname, this); } + for (let msgname of RIL_IPC_MOBILENETWORK_MSG_NAMES) { + ppmm.removeMessageListener(msgname, this); + } for (let msgName of RIL_IPC_ICCMANAGER_MSG_NAMES) { ppmm.removeMessageListener(msgName, this); } @@ -375,6 +386,14 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () { } return null; } + } else if (RIL_IPC_MOBILENETWORK_MSG_NAMES.indexOf(msg.name) != -1) { + if (!msg.target.assertPermission("mobilenetwork")) { + if (DEBUG) { + debug("MobileNetwork message " + msg.name + + " from a content process with no 'mobilenetwork' privileges."); + } + return null; + } } else if (RIL_IPC_ICCMANAGER_MSG_NAMES.indexOf(msg.name) != -1) { if (!msg.target.assertPermission("mobileconnection")) { if (DEBUG) { @@ -1217,6 +1236,12 @@ RadioInterface.prototype = { case "RIL:GetRilContext": // This message is sync. return this.rilContext; + case "RIL:GetLastKnownNetwork": + // This message is sync. + return this._lastKnownNetwork; + case "RIL:GetLastKnownHomeNetwork": + // This message is sync. + return this._lastKnownHomeNetwork; case "RIL:GetAvailableNetworks": this.workerMessenger.sendWithIPCMessage(msg, "getAvailableNetworks"); break; @@ -1824,10 +1849,8 @@ RadioInterface.prototype = { // Update lastKnownNetwork if (message.mcc && message.mnc) { - try { - Services.prefs.setCharPref("ril.lastKnownNetwork", - message.mcc + "-" + message.mnc); - } catch (e) {} + this._lastKnownNetwork = message.mcc + "-" + message.mnc; + if (DEBUG) this.debug("_lastKnownNetwork: " + this._lastKnownNetwork); } // If the voice is unregistered, no need to send RIL:VoiceInfoChanged. @@ -2529,10 +2552,8 @@ RadioInterface.prototype = { // Update lastKnownHomeNetwork. if (message.mcc && message.mnc) { - try { - Services.prefs.setCharPref("ril.lastKnownHomeNetwork", - message.mcc + "-" + message.mnc); - } catch (e) {} + this._lastKnownHomeNetwork = message.mcc + "-" + message.mnc; + this.debug("_lastKnownHomeNetwork: " + this._lastKnownHomeNetwork); } // If spn becomes available, we should check roaming again. @@ -2660,6 +2681,12 @@ RadioInterface.prototype = { // Cell Broadcast settings values. _cellBroadcastSearchListStr: null, + // Operator's mcc-mnc. + _lastKnownNetwork: null, + + // ICC's mcc-mnc. + _lastKnownHomeNetwork: null, + handleSettingsChange: function handleSettingsChange(aName, aResult, aMessage) { // Don't allow any content processes to modify the setting // "time.clock.automatic-update.available" except for the chrome process. diff --git a/widget/gonk/nsAppShell.cpp b/widget/gonk/nsAppShell.cpp index 3933ee2381c..fcc47b47810 100644 --- a/widget/gonk/nsAppShell.cpp +++ b/widget/gonk/nsAppShell.cpp @@ -873,7 +873,7 @@ nsAppShell::Init() #ifdef MOZ_OMX_DECODER android::MediaResourceManagerService::instantiate(); #endif -#if ANDROID_VERSION >= 18 +#if ANDROID_VERSION >= 18 && (defined(MOZ_OMX_DECODER) || defined(MOZ_B2G_CAMERA)) android::FakeSurfaceComposer::instantiate(); #endif GonkPermissionService::instantiate();