audio flinger: rename Bluetooth latency mode APIs
Rename APIs controlling Bluetooth variable latency
after API review suggestions.
Bug: 257922898
Test: make
Change-Id: I517ad9c6aef14975c9e0a1a2703d1b17d638ea0e
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 33ccf32..d3453f5 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -231,8 +231,9 @@
BINDER_METHOD_ENTRY(setDeviceConnectedState) \
BINDER_METHOD_ENTRY(setRequestedLatencyMode) \
BINDER_METHOD_ENTRY(getSupportedLatencyModes) \
-BINDER_METHOD_ENTRY(setBluetoothLatencyModesEnabled) \
-BINDER_METHOD_ENTRY(supportsBluetoothLatencyModes) \
+BINDER_METHOD_ENTRY(setBluetoothVariableLatencyEnabled) \
+BINDER_METHOD_ENTRY(isBluetoothVariableLatencyEnabled) \
+BINDER_METHOD_ENTRY(supportsBluetoothVariableLatency) \
BINDER_METHOD_ENTRY(getSoundDoseInterface) \
// singleton for Binder Method Statistics for IAudioFlinger
@@ -1669,12 +1670,12 @@
return thread->getSupportedLatencyModes(modes);
}
-status_t AudioFlinger::setBluetoothLatencyModesEnabled(bool enabled) {
+status_t AudioFlinger::setBluetoothVariableLatencyEnabled(bool enabled) {
Mutex::Autolock _l(mLock);
status_t status = INVALID_OPERATION;
for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
// Success if at least one PlaybackThread supports Bluetooth latency modes
- if (mPlaybackThreads.valueAt(i)->setBluetoothLatencyModesEnabled(enabled) == NO_ERROR) {
+ if (mPlaybackThreads.valueAt(i)->setBluetoothVariableLatencyEnabled(enabled) == NO_ERROR) {
status = NO_ERROR;
}
}
@@ -1684,14 +1685,22 @@
return status;
}
-status_t AudioFlinger::supportsBluetoothLatencyModes(bool* support) {
+status_t AudioFlinger::isBluetoothVariableLatencyEnabled(bool *enabled) {
+ if (enabled == nullptr) {
+ return BAD_VALUE;
+ }
+ *enabled = mBluetoothLatencyModesEnabled.load();
+ return NO_ERROR;
+}
+
+status_t AudioFlinger::supportsBluetoothVariableLatency(bool* support) {
if (support == nullptr) {
return BAD_VALUE;
}
Mutex::Autolock _l(mLock);
*support = false;
for (size_t i = 0; i < mAudioHwDevs.size(); i++) {
- if (mAudioHwDevs.valueAt(i)->supportsBluetoothLatencyModes()) {
+ if (mAudioHwDevs.valueAt(i)->supportsBluetoothVariableLatency()) {
*support = true;
break;
}
@@ -2614,7 +2623,7 @@
if (bool supports = false;
- dev->supportsBluetoothLatencyModes(&supports) == NO_ERROR && supports) {
+ dev->supportsBluetoothVariableLatency(&supports) == NO_ERROR && supports) {
flags = static_cast<AudioHwDevice::Flags>(flags |
AudioHwDevice::AHWD_SUPPORTS_BT_LATENCY_MODES);
}
@@ -2992,7 +3001,7 @@
if (thread->isMsdDevice()) {
thread->setDownStreamPatch(&patch);
}
- thread->setBluetoothLatencyModesEnabled(mBluetoothLatencyModesEnabled.load());
+ thread->setBluetoothVariableLatencyEnabled(mBluetoothLatencyModesEnabled.load());
return thread;
}
}
@@ -4697,8 +4706,9 @@
case TransactionCode::SET_AUDIO_HAL_PIDS:
case TransactionCode::SET_VIBRATOR_INFOS:
case TransactionCode::UPDATE_SECONDARY_OUTPUTS:
- case TransactionCode::SET_BLUETOOTH_LATENCY_MODES_ENABLED:
- case TransactionCode::SUPPORTS_BLUETOOTH_LATENCY_MODES: {
+ case TransactionCode::SET_BLUETOOTH_VARIABLE_LATENCY_ENABLED:
+ case TransactionCode::IS_BLUETOOTH_VARIABLE_LATENCY_ENABLED:
+ case TransactionCode::SUPPORTS_BLUETOOTH_VARIABLE_LATENCY: {
if (!isServiceUid(IPCThreadState::self()->getCallingUid())) {
ALOGW("%s: transaction %d received from PID %d unauthorized UID %d",
__func__, code, IPCThreadState::self()->getCallingPid(),
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 16ad964..6dd1cda 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -305,9 +305,11 @@
virtual status_t getSupportedLatencyModes(audio_io_handle_t output,
std::vector<audio_latency_mode_t>* modes);
- virtual status_t setBluetoothLatencyModesEnabled(bool enabled);
+ virtual status_t setBluetoothVariableLatencyEnabled(bool enabled);
- virtual status_t supportsBluetoothLatencyModes(bool* support);
+ virtual status_t isBluetoothVariableLatencyEnabled(bool* enabled);
+
+ virtual status_t supportsBluetoothVariableLatency(bool* support);
virtual status_t getSoundDoseInterface(const sp<media::ISoundDoseCallback>& callback,
sp<media::ISoundDose>* soundDose);
diff --git a/services/audioflinger/AudioHwDevice.h b/services/audioflinger/AudioHwDevice.h
index 0e840a6..1749f3f 100644
--- a/services/audioflinger/AudioHwDevice.h
+++ b/services/audioflinger/AudioHwDevice.h
@@ -66,7 +66,7 @@
return (0 != (mFlags & AHWD_IS_INSERT));
}
- bool supportsBluetoothLatencyModes() const {
+ bool supportsBluetoothVariableLatency() const {
return (0 != (mFlags & AHWD_SUPPORTS_BT_LATENCY_MODES));
}
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index e6d38cc..9598ed9 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -7602,9 +7602,9 @@
return NO_ERROR;
}
-status_t AudioFlinger::PlaybackThread::setBluetoothLatencyModesEnabled(bool enabled) {
+status_t AudioFlinger::PlaybackThread::setBluetoothVariableLatencyEnabled(bool enabled) {
if (mOutput == nullptr || mOutput->audioHwDev == nullptr
- || !mOutput->audioHwDev->supportsBluetoothLatencyModes()) {
+ || !mOutput->audioHwDev->supportsBluetoothVariableLatency()) {
return INVALID_OPERATION;
}
mBluetoothLatencyModesEnabled.store(enabled);
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 247c609..1f0f13a 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -1102,7 +1102,7 @@
return INVALID_OPERATION;
}
- virtual status_t setBluetoothLatencyModesEnabled(bool enabled);
+ virtual status_t setBluetoothVariableLatencyEnabled(bool enabled);
void startMelComputation(const sp<audio_utils::MelProcessor>& processor);
void stopMelComputation();