This commit is contained in:
Ryan VanderMeulen 2014-05-16 15:26:00 -04:00
Родитель e4a25d432d 619acef8fd
Коммит 641a14a3df
22 изменённых файлов: 185 добавлений и 74 удалений

Просмотреть файл

@ -19,11 +19,11 @@
<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="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="d5800c36b2d5822fc3fe1899b9280401de466e1e"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="e5f4683183a1dec2cfdb21b76509819977e9d09c"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<!-- Stock Android things -->

Просмотреть файл

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
@ -128,7 +128,7 @@
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="c3ee0c875393607430086f942950d1b3f496ab0e"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="ccccdcecc0ed9cff6b2445748903809ece2e04f3"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="f121175e1c0613f7d5c39be84b5a6330d8d664a0"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="dd94b2e17a146cb782d71933d25dcaa9c060e6ce"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="e0972cffef81e3833a5dad03a338651ebe55135f"/>

Просмотреть файл

@ -15,9 +15,9 @@
<project name="platform_build" path="build" remote="b2g" revision="65fba428f8d76336b33ddd9e15900357953600ba">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

Просмотреть файл

@ -19,11 +19,11 @@
<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="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="d5800c36b2d5822fc3fe1899b9280401de466e1e"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="e5f4683183a1dec2cfdb21b76509819977e9d09c"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<!-- Stock Android things -->

Просмотреть файл

@ -18,8 +18,8 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<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="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
@ -119,7 +119,7 @@
<!-- Flame specific things -->
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="e8a318f7690092e639ba88891606f4183e846d3f"/>
<project name="device/qcom/common" path="device/qcom/common" revision="34ed8345250bb97262d70a052217a92e83444ede"/>
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="bbbeb3aeb0ae9f209eb8abe48a71f37e568b63af"/>
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="1b3322cfd1179ea11fa5083d600717b65e5923e6"/>
<project name="kernel/msm" path="kernel" revision="7158567fc83e7475f08db3adedc5df1ad6f54abd"/>
<project name="platform/bootable/recovery" path="bootable/recovery" revision="f2914eacee9120680a41463708bb6ee8291749fc"/>
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="4b7ae991637a216d745e154cd49b4db6ca55a19e"/>

Просмотреть файл

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "4393a8d719e7917f543cd8d906632c9b2164198e",
"revision": "7e5b2c297555985ac76b069361ff252fe176a018",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

Просмотреть файл

@ -15,8 +15,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

Просмотреть файл

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

Просмотреть файл

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

Просмотреть файл

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8a4baf82a131a7853cf7e7f9cf74253927b2f355"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

Просмотреть файл

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="799b0f8bb71bc1b944f90c117ab5d6be4837ba1f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="03c9b9a68af64b72779bede98759464d3beee863"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="17cc405ab6163528efe321e831bf0e72d1166a28"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3b2aeeb5af3083c2f6f4b44beae0b4802566d482"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

Просмотреть файл

@ -504,35 +504,32 @@ static btrc_callbacks_t sBtAvrcpCallbacks = {
* It is required to register a2dp callbacks before a2dp media task
* starts up.
*/
bool
BluetoothA2dpManager::Init()
// static
void
BluetoothA2dpManager::InitA2dpInterface()
{
const bt_interface_t* btInf = GetBluetoothInterface();
NS_ENSURE_TRUE(btInf, false);
NS_ENSURE_TRUE_VOID(btInf);
sBtA2dpInterface = (btav_interface_t *)btInf->
get_profile_interface(BT_PROFILE_ADVANCED_AUDIO_ID);
NS_ENSURE_TRUE(sBtA2dpInterface, false);
NS_ENSURE_TRUE_VOID(sBtA2dpInterface);
int ret = sBtA2dpInterface->init(&sBtA2dpCallbacks);
if (ret != BT_STATUS_SUCCESS) {
BT_LOGR("Warning: failed to init a2dp module");
return false;
}
#if ANDROID_VERSION > 17
sBtAvrcpInterface = (btrc_interface_t *)btInf->
get_profile_interface(BT_PROFILE_AV_RC_ID);
NS_ENSURE_TRUE(sBtAvrcpInterface, false);
NS_ENSURE_TRUE_VOID(sBtAvrcpInterface);
ret = sBtAvrcpInterface->init(&sBtAvrcpCallbacks);
if (ret != BT_STATUS_SUCCESS) {
BT_LOGR("Warning: failed to init avrcp module");
return false;
}
#endif
return true;
}
BluetoothA2dpManager::~BluetoothA2dpManager()
@ -602,12 +599,28 @@ BluetoothA2dpManager::Get()
// Create a new instance, register, and return
BluetoothA2dpManager* manager = new BluetoothA2dpManager();
NS_ENSURE_TRUE(manager->Init(), nullptr);
sBluetoothA2dpManager = manager;
return sBluetoothA2dpManager;
}
// static
void
BluetoothA2dpManager::DeinitA2dpInterface()
{
MOZ_ASSERT(NS_IsMainThread());
if (sBtA2dpInterface) {
sBtA2dpInterface->cleanup();
sBtA2dpInterface = nullptr;
}
#if ANDROID_VERSION > 17
if (sBtAvrcpInterface) {
sBtAvrcpInterface->cleanup();
sBtAvrcpInterface = nullptr;
}
#endif
}
void
BluetoothA2dpManager::HandleShutdown()
{
@ -623,7 +636,7 @@ BluetoothA2dpManager::Connect(const nsAString& aDeviceAddress,
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!aDeviceAddress.IsEmpty());
MOZ_ASSERT(aController && !mController);
MOZ_ASSERT(aController);
BluetoothService* bs = BluetoothService::Get();
if (!bs || sInShutdown) {

Просмотреть файл

@ -30,6 +30,8 @@ public:
};
static BluetoothA2dpManager* Get();
static void InitA2dpInterface();
static void DeinitA2dpInterface();
virtual ~BluetoothA2dpManager();
// A2DP-specific functions
@ -60,7 +62,6 @@ public:
private:
class SinkPropertyChangedHandler;
BluetoothA2dpManager();
bool Init();
void ResetA2dp();
void ResetAvrcp();

Просмотреть файл

@ -135,6 +135,26 @@ public:
}
};
class CleanupTask : public nsRunnable
{
public:
CleanupTask()
{ }
NS_IMETHOD
Run()
{
MOZ_ASSERT(NS_IsMainThread());
// Cleanup bluetooth interfaces after BT state becomes BT_STATE_OFF.
BluetoothHfpManager::DeinitHfpInterface();
BluetoothA2dpManager::DeinitA2dpInterface();
sBtInterface->cleanup();
return NS_OK;
}
};
/**
* Static callback functions
*/
@ -269,6 +289,10 @@ AdapterStateChangeCallback(bt_state_t aStatus)
sIsBtEnabled = (aStatus == BT_STATE_ON);
if (!sIsBtEnabled && NS_FAILED(NS_DispatchToMainThread(new CleanupTask()))) {
BT_WARNING("Failed to dispatch to main thread!");
}
nsRefPtr<nsRunnable> runnable =
new BluetoothService::ToggleBtAck(sIsBtEnabled);
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
@ -656,15 +680,29 @@ EnsureBluetoothHalLoad()
}
module->methods->open(module, BT_HARDWARE_MODULE_ID, &device);
sBtDevice = (bluetooth_device_t *)device;
NS_ENSURE_TRUE(sBtDevice, false);
sBtInterface = sBtDevice->get_bluetooth_interface();
NS_ENSURE_TRUE(sBtInterface, false);
return true;
}
static bool
EnableInternal()
{
int ret = sBtInterface->init(&sBluetoothCallbacks);
if (ret != BT_STATUS_SUCCESS) {
BT_LOGR("Error while setting the callbacks");
sBtInterface = nullptr;
return false;
}
return true;
// Register all the bluedroid callbacks before enable() get called
// It is required to register a2dp callbacks before a2dp media task starts up.
// If any interface cannot be initialized, turn on bluetooth core anyway.
BluetoothHfpManager::InitHfpInterface();
BluetoothA2dpManager::InitA2dpInterface();
return sBtInterface->enable();
}
static nsresult
@ -683,7 +721,7 @@ StartStopGonkBluetooth(bool aShouldEnable)
return NS_OK;
}
int ret = aShouldEnable ? sBtInterface->enable() : sBtInterface->disable();
int ret = aShouldEnable ? EnableInternal() : sBtInterface->disable();
NS_ENSURE_TRUE(ret == BT_STATUS_SUCCESS, NS_ERROR_FAILURE);
return NS_OK;
@ -727,11 +765,6 @@ BluetoothServiceBluedroid::BluetoothServiceBluedroid()
BT_LOGR("Error! Failed to load bluedroid library.");
return;
}
// Register all the bluedroid callbacks before enable() get called
// It is required to register a2dp callbacks before a2dp media task starts up.
BluetoothHfpManager::Get();
BluetoothA2dpManager::Get();
}
BluetoothServiceBluedroid::~BluetoothServiceBluedroid()

Просмотреть файл

@ -395,8 +395,6 @@ BluetoothHfpManager::Init()
{
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_TRUE(InitHfpInterface(), false);
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
NS_ENSURE_TRUE(obs, false);
@ -430,11 +428,12 @@ BluetoothHfpManager::Init()
return true;
}
bool
// static
void
BluetoothHfpManager::InitHfpInterface()
{
const bt_interface_t* btInf = GetBluetoothInterface();
NS_ENSURE_TRUE(btInf, false);
NS_ENSURE_TRUE_VOID(btInf);
if (sBluetoothHfpInterface) {
sBluetoothHfpInterface->cleanup();
@ -443,13 +442,11 @@ BluetoothHfpManager::InitHfpInterface()
bthf_interface_t *interface = (bthf_interface_t *)
btInf->get_profile_interface(BT_PROFILE_HANDSFREE_ID);
NS_ENSURE_TRUE(interface, false);
NS_ENSURE_TRUE_VOID(interface);
NS_ENSURE_TRUE(BT_STATUS_SUCCESS ==
interface->init(&sBluetoothHfpCallbacks), false);
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS ==
interface->init(&sBluetoothHfpCallbacks));
sBluetoothHfpInterface = interface;
return true;
}
BluetoothHfpManager::~BluetoothHfpManager()
@ -468,9 +465,9 @@ BluetoothHfpManager::~BluetoothHfpManager()
}
hal::UnregisterBatteryObserver(this);
DeinitHfpInterface();
}
// static
void
BluetoothHfpManager::DeinitHfpInterface()
{
@ -1045,13 +1042,14 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
void
BluetoothHfpManager::UpdateDeviceCIND()
{
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS ==
sBluetoothHfpInterface->device_status_notification(
(bthf_network_state_t) mService,
(bthf_service_type_t) mRoam,
mSignal,
mBattChg));
if (sBluetoothHfpInterface) {
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS ==
sBluetoothHfpInterface->device_status_notification(
(bthf_network_state_t) mService,
(bthf_service_type_t) mRoam,
mSignal,
mBattChg));
}
}
uint32_t

Просмотреть файл

@ -84,6 +84,8 @@ public:
static BluetoothHfpManager* Get();
virtual ~BluetoothHfpManager();
static void InitHfpInterface();
static void DeinitHfpInterface();
bool ConnectSco();
bool DisconnectSco();
@ -134,8 +136,6 @@ private:
BluetoothHfpManager();
bool Init();
bool InitHfpInterface();
void DeinitHfpInterface();
void HandleShutdown();
void HandleVolumeChanged(const nsAString& aData);

Просмотреть файл

@ -35,6 +35,8 @@
USING_BLUETOOTH_NAMESPACE
using namespace mozilla;
using namespace mozilla::ipc;
using mozilla::TimeDuration;
using mozilla::TimeStamp;
namespace {
// Sending system message "bluetooth-opp-update-progress" every 50kb
@ -53,6 +55,10 @@ static const uint32_t kPutRequestHeaderSize = 6;
*/
static const uint32_t kPutRequestAppendHeaderSize = 5;
// The default timeout we permit to wait for SDP updating if we can't get
// service channel.
static const double kSdpUpdatingTimeoutMs = 3000.0;
StaticRefPtr<BluetoothOppManager> sBluetoothOppManager;
static bool sInShutdown = false;
}
@ -1546,9 +1552,17 @@ BluetoothOppManager::OnGetServiceChannel(const nsAString& aDeviceAddress,
if (aChannel < 0) {
if (mNeedsUpdatingSdpRecords) {
mNeedsUpdatingSdpRecords = false;
mLastServiceChannelCheck = TimeStamp::Now();
bs->UpdateSdpRecords(aDeviceAddress, this);
} else {
OnSocketConnectError(mSocket);
TimeDuration duration = TimeStamp::Now() - mLastServiceChannelCheck;
// Refresh SDP records until it gets valid service channel
// unless timeout is hit.
if (duration.ToMilliseconds() < kSdpUpdatingTimeoutMs) {
bs->UpdateSdpRecords(aDeviceAddress, this);
} else {
OnSocketConnectError(mSocket);
}
}
return;

Просмотреть файл

@ -215,6 +215,10 @@ private:
// is called.
nsRefPtr<BluetoothSocket> mRfcommSocket;
nsRefPtr<BluetoothSocket> mL2capSocket;
// This holds the time when OPP manager fail to get service channel and
// prepare to refresh SDP records.
mozilla::TimeStamp mLastServiceChannelCheck;
};
END_BLUETOOTH_NAMESPACE

Просмотреть файл

@ -227,8 +227,6 @@ NetworkManager.prototype = {
gNetworkService.removeHostRoutes(network.name);
gNetworkService.addHostRoute(network);
}
// Add extra host route. For example, mms proxy or mmsc.
this.setExtraHostRoute(network);
// Dun type is a special case where we add the default route to a
// secondary table.
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
@ -240,6 +238,12 @@ NetworkManager.prototype = {
gNetworkService.removeDefaultRoute(network);
this.setAndConfigureActive();
#ifdef MOZ_B2G_RIL
// Resolve and add extra host route. For example, mms proxy or mmsc.
// IMPORTANT: The offline state of DNSService will be set implicitly in
// setAndConfigureActive() by modifying Services.io.offline.
// Always setExtraHostRoute() after setAndConfigureActive().
this.setExtraHostRoute(network);
// Update data connection when Wifi connected/disconnected
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
for (let i = 0; i < this.mRil.numRadioInterfaces; i++) {
@ -684,7 +688,9 @@ NetworkManager.prototype = {
retval.push(hostnameIps.getNextAddrAsString());
debug("Found IP at: " + JSON.stringify(retval));
}
} catch (e) {}
} catch (e) {
debug("Failed to resolve '" + hostname + "', exception: " + e);
}
}
return retval;

Просмотреть файл

@ -52,7 +52,7 @@ static int64_t kAccessUnitTimeoutUs = 10000000ll;
// If no access units arrive for the first 10 secs after starting the
// stream, assume none ever will and signal EOS or switch transports.
static int64_t kStartupTimeoutUs = 10000000ll;
static int64_t kPlayTimeoutUs = 10000000ll;
static int64_t kDefaultKeepAliveTimeoutUs = 60000000ll;
@ -109,6 +109,7 @@ struct RtspConnectionHandler : public AHandler {
kWhatEOS = 'eos!',
kWhatSeekDiscontinuity = 'seeD',
kWhatNormalPlayTimeMapping = 'nptM',
kWhatTryTCPInterleaving = 'ttiL',
};
RtspConnectionHandler(
@ -140,7 +141,8 @@ struct RtspConnectionHandler : public AHandler {
mReceivedFirstRTPPacket(false),
mSeekable(false),
mKeepAliveTimeoutUs(kDefaultKeepAliveTimeoutUs),
mKeepAliveGeneration(0) {
mKeepAliveGeneration(0),
mNumPlayTimeoutsPending(0) {
mNetLooper->setName("rtsp net");
mNetLooper->start(false /* runOnCallingThread */,
false /* canCallJava */,
@ -703,9 +705,17 @@ struct RtspConnectionHandler : public AHandler {
} else {
msg->setInt32("isSeekable", 0);
}
// Notify the Rtsp Controller that we are ready to play.
// Notify RTSPSource that we are ready to play.
msg->setInt32("what", kWhatConnected);
msg->post();
// Notify RTSPSource that we are trying TCP interleaving and
// ready to play again.
if (mTryTCPInterleaving) {
sp<AMessage> msgTryTcp = mNotify->dup();
msgTryTcp->setInt32("what", kWhatTryTCPInterleaving);
msgTryTcp->post();
}
} else {
sp<AMessage> reply = new AMessage('disc', id());
reply->setInt32("result", result);
@ -748,8 +758,9 @@ struct RtspConnectionHandler : public AHandler {
parsePlayResponse(response);
sp<AMessage> timeout = new AMessage('tiou', id());
timeout->post(kStartupTimeoutUs);
timeout->post(kPlayTimeoutUs);
mPausePending = false;
mNumPlayTimeoutsPending++;
}
}
@ -1133,6 +1144,20 @@ struct RtspConnectionHandler : public AHandler {
case 'tiou':
{
CHECK(mNumPlayTimeoutsPending >= 1);
mNumPlayTimeoutsPending--;
// If there are more than one pending 'tiou' messages in the
// queue, we ignore the preceding ones and only handle the last
// one.
// This check is necessary when we fail back to using RTP
// interleaved in the existing RTSP connection. It prevents from
// aboring a connection that is trying to transport RTP over
// TCP.
if (mNumPlayTimeoutsPending > 0) {
// Do nothing. We only handle the last 'tiou' message.
return;
}
if (!mReceivedFirstRTCPPacket) {
if (mReceivedFirstRTPPacket && !mTryFakeRTCP) {
LOGW("We received RTP packets but no RTCP packets, "
@ -1353,6 +1378,7 @@ private:
bool mSeekable;
int64_t mKeepAliveTimeoutUs;
int32_t mKeepAliveGeneration;
int32_t mNumPlayTimeoutsPending;
Vector<TrackInfo> mTracks;

Просмотреть файл

@ -471,6 +471,22 @@ void RTSPSource::onMessageReceived(const sp<AMessage> &msg) {
break;
}
case RtspConnectionHandler::kWhatTryTCPInterleaving:
{
// By default, we will request to deliver RTP over UDP. If the play
// request timed out and we didn't receive any RTP packet, we will
// fail back to use RTP interleaved in the existing RTSP/TCP
// connection. And in this case, we have to explicitly perform
// another play event to request the server to start streaming
// again.
int64_t playTimeUs;
if (!msg->findInt64("timeUs", &playTimeUs)) {
playTimeUs = 0;
}
performPlay(playTimeUs);
break;
}
default:
TRESPASS();
}