Bug 1100883: Replace most instances of |ToggleBtAck| with calls to |AcknowledgeToggleBt|, r=btian

|AcknowledgeToggleBt| completes a Bluetooth start or stop operation
in the context of |BluetoothService|; That was done by |ToggleBtAck|
before.

This patch replaces |ToggleBtAck| with calls to |AcknowledgeToggleBt|
in |BluetoothServiceBluedroid| for all the trivial cases.
This commit is contained in:
Thomas Zimmermann 2014-11-20 11:06:01 +01:00
Родитель e7b6dea79d
Коммит d305868eed
1 изменённых файлов: 7 добавлений и 30 удалений

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

@ -318,10 +318,7 @@ public:
BT_LOGR("BluetoothInterface::Enable failed: %d", aStatus);
nsRefPtr<nsRunnable> runnable = new BluetoothService::ToggleBtAck(false);
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
BT_WARNING("Failed to dispatch to main thread!");
}
BluetoothService::AcknowledgeToggleBt(false);
}
};
@ -394,10 +391,7 @@ public:
sBtInterface = nullptr;
nsRefPtr<nsRunnable> runnable = new BluetoothService::ToggleBtAck(false);
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
BT_WARNING("Failed to dispatch to main thread!");
}
BluetoothService::AcknowledgeToggleBt(false);
}
};
@ -413,10 +407,7 @@ BluetoothServiceBluedroid::StartGonkBluetooth()
if (bs->IsEnabled()) {
// Keep current enable status
nsRefPtr<nsRunnable> runnable = new BluetoothService::ToggleBtAck(true);
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
BT_WARNING("Failed to dispatch to main thread!");
}
BluetoothService::AcknowledgeToggleBt(true);
return NS_OK;
}
@ -436,10 +427,7 @@ public:
BT_LOGR("BluetoothInterface::Disable failed: %d", aStatus);
nsRefPtr<nsRunnable> runnable = new BluetoothService::ToggleBtAck(true);
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
BT_WARNING("Failed to dispatch to main thread!");
}
BluetoothService::AcknowledgeToggleBt(true);
}
};
@ -455,10 +443,7 @@ BluetoothServiceBluedroid::StopGonkBluetooth()
if (!bs->IsEnabled()) {
// Keep current enable status
nsRefPtr<nsRunnable> runnable = new BluetoothService::ToggleBtAck(false);
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
BT_WARNING("Failed to dispatch to main thread!");
}
BluetoothService::AcknowledgeToggleBt(false);
return NS_OK;
}
@ -518,11 +503,7 @@ BluetoothServiceBluedroid::StartInternal()
nsresult ret = StartGonkBluetooth();
if (NS_FAILED(ret)) {
nsRefPtr<nsRunnable> runnable =
new BluetoothService::ToggleBtAck(false);
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
BT_WARNING("Failed to dispatch to main thread!");
}
BluetoothService::AcknowledgeToggleBt(false);
BT_LOGR("Error");
}
@ -536,11 +517,7 @@ BluetoothServiceBluedroid::StopInternal()
nsresult ret = StopGonkBluetooth();
if (NS_FAILED(ret)) {
nsRefPtr<nsRunnable> runnable =
new BluetoothService::ToggleBtAck(true);
if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
BT_WARNING("Failed to dispatch to main thread!");
}
BluetoothService::AcknowledgeToggleBt(true);
BT_LOGR("Error");
}