audio flinger: rename Bluetooth latency mode APIs
Rename APIs controlling Bluetooth variable latency
after API review suggestions.
Bug: 257922898
Test: make
Merged-In: I517ad9c6aef14975c9e0a1a2703d1b17d638ea0e
Change-Id: I517ad9c6aef14975c9e0a1a2703d1b17d638ea0e
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index acbf3d0..0d16f47 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -2426,21 +2426,30 @@
return af->getSupportedLatencyModes(output, modes);
}
-status_t AudioSystem::setBluetoothLatencyModesEnabled(bool enabled) {
+status_t AudioSystem::setBluetoothVariableLatencyEnabled(bool enabled) {
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
if (af == nullptr) {
return PERMISSION_DENIED;
}
- return af->setBluetoothLatencyModesEnabled(enabled);
+ return af->setBluetoothVariableLatencyEnabled(enabled);
}
-status_t AudioSystem::supportsBluetoothLatencyModes(
+status_t AudioSystem::isBluetoothVariableLatencyEnabled(
+ bool *enabled) {
+ const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
+ if (af == nullptr) {
+ return PERMISSION_DENIED;
+ }
+ return af->isBluetoothVariableLatencyEnabled(enabled);
+}
+
+status_t AudioSystem::supportsBluetoothVariableLatency(
bool *support) {
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
if (af == nullptr) {
return PERMISSION_DENIED;
}
- return af->supportsBluetoothLatencyModes(support);
+ return af->supportsBluetoothVariableLatency(support);
}
class CaptureStateListenerImpl : public media::BnCaptureStateListener,
diff --git a/media/libaudioclient/IAudioFlinger.cpp b/media/libaudioclient/IAudioFlinger.cpp
index 29deb56..b3c9f07 100644
--- a/media/libaudioclient/IAudioFlinger.cpp
+++ b/media/libaudioclient/IAudioFlinger.cpp
@@ -837,17 +837,28 @@
return NO_ERROR;
}
-status_t AudioFlingerClientAdapter::setBluetoothLatencyModesEnabled(bool enabled) {
- return statusTFromBinderStatus(mDelegate->setBluetoothLatencyModesEnabled(enabled));
+status_t AudioFlingerClientAdapter::setBluetoothVariableLatencyEnabled(bool enabled) {
+ return statusTFromBinderStatus(mDelegate->setBluetoothVariableLatencyEnabled(enabled));
}
-status_t AudioFlingerClientAdapter::supportsBluetoothLatencyModes(bool* support) {
+status_t AudioFlingerClientAdapter::isBluetoothVariableLatencyEnabled(bool* enabled) {
+ if (enabled == nullptr) {
+ return BAD_VALUE;
+ }
+
+ RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(
+ mDelegate->isBluetoothVariableLatencyEnabled(enabled)));
+
+ return NO_ERROR;
+}
+
+status_t AudioFlingerClientAdapter::supportsBluetoothVariableLatency(bool* support) {
if (support == nullptr) {
return BAD_VALUE;
}
RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(
- mDelegate->supportsBluetoothLatencyModes(support)));
+ mDelegate->supportsBluetoothVariableLatency(support)));
return NO_ERROR;
}
@@ -1372,12 +1383,16 @@
return Status::ok();
}
-Status AudioFlingerServerAdapter::setBluetoothLatencyModesEnabled(bool enabled) {
- return Status::fromStatusT(mDelegate->setBluetoothLatencyModesEnabled(enabled));
+Status AudioFlingerServerAdapter::setBluetoothVariableLatencyEnabled(bool enabled) {
+ return Status::fromStatusT(mDelegate->setBluetoothVariableLatencyEnabled(enabled));
}
-Status AudioFlingerServerAdapter::supportsBluetoothLatencyModes(bool *support) {
- return Status::fromStatusT(mDelegate->supportsBluetoothLatencyModes(support));
+Status AudioFlingerServerAdapter::isBluetoothVariableLatencyEnabled(bool *enabled) {
+ return Status::fromStatusT(mDelegate->isBluetoothVariableLatencyEnabled(enabled));
+}
+
+Status AudioFlingerServerAdapter::supportsBluetoothVariableLatency(bool *support) {
+ return Status::fromStatusT(mDelegate->supportsBluetoothVariableLatency(support));
}
} // namespace android
diff --git a/media/libaudioclient/aidl/android/media/IAudioFlingerService.aidl b/media/libaudioclient/aidl/android/media/IAudioFlingerService.aidl
index 4e863b3..1111160 100644
--- a/media/libaudioclient/aidl/android/media/IAudioFlingerService.aidl
+++ b/media/libaudioclient/aidl/android/media/IAudioFlingerService.aidl
@@ -248,18 +248,23 @@
/**
* Requests if the implementation supports controlling the latency modes
- * over the Bleutooth A2DP or LE Audio links. If it does,
+ * over the Bluetooth A2DP or LE Audio links. If it does,
* setRequestedLatencyMode() and getSupportedLatencyModes() APIs can also be used
* for streams routed to Bluetooth and not just for the spatializer output.
*/
- boolean supportsBluetoothLatencyModes();
+ boolean supportsBluetoothVariableLatency();
/**
* Enables or disables the variable Bluetooth latency control mechanism in the
* audio framework and the audio HAL. This does not apply to the latency mode control
- * on the spatializer output with is a built-in feature.
+ * on the spatializer output as this is a built-in feature.
*/
- void setBluetoothLatencyModesEnabled(boolean enabled);
+ void setBluetoothVariableLatencyEnabled(boolean enabled);
+
+ /**
+ * Indicates if the variable Bluetooth latency control mechanism is enabled or disabled.
+ */
+ boolean isBluetoothVariableLatencyEnabled();
// When adding a new method, please review and update
// IAudioFlinger.h AudioFlingerServerAdapter::Delegate::TransactionCode
diff --git a/media/libaudioclient/include/media/AudioSystem.h b/media/libaudioclient/include/media/AudioSystem.h
index 1513831..3b7cc39 100644
--- a/media/libaudioclient/include/media/AudioSystem.h
+++ b/media/libaudioclient/include/media/AudioSystem.h
@@ -575,9 +575,11 @@
static status_t getSupportedLatencyModes(audio_io_handle_t output,
std::vector<audio_latency_mode_t>* modes);
- static status_t setBluetoothLatencyModesEnabled(bool enabled);
+ static status_t setBluetoothVariableLatencyEnabled(bool enabled);
- static status_t supportsBluetoothLatencyModes(bool *support);
+ static status_t isBluetoothVariableLatencyEnabled(bool *enabled);
+
+ static status_t supportsBluetoothVariableLatency(bool *support);
// A listener for capture state changes.
class CaptureStateListener : public virtual RefBase {
diff --git a/media/libaudioclient/include/media/IAudioFlinger.h b/media/libaudioclient/include/media/IAudioFlinger.h
index bb8fa36..36ee96b 100644
--- a/media/libaudioclient/include/media/IAudioFlinger.h
+++ b/media/libaudioclient/include/media/IAudioFlinger.h
@@ -367,9 +367,11 @@
virtual status_t getSupportedLatencyModes(audio_io_handle_t output,
std::vector<audio_latency_mode_t>* modes) = 0;
- virtual status_t setBluetoothLatencyModesEnabled(bool enabled) = 0;
+ virtual status_t setBluetoothVariableLatencyEnabled(bool enabled) = 0;
- virtual status_t supportsBluetoothLatencyModes(bool* support) = 0;
+ virtual status_t isBluetoothVariableLatencyEnabled(bool* enabled) = 0;
+
+ virtual status_t supportsBluetoothVariableLatency(bool* support) = 0;
};
/**
@@ -476,8 +478,9 @@
audio_latency_mode_t mode) override;
status_t getSupportedLatencyModes(
audio_io_handle_t output, std::vector<audio_latency_mode_t>* modes) override;
- status_t setBluetoothLatencyModesEnabled(bool enabled) override;
- status_t supportsBluetoothLatencyModes(bool* support) override;
+ status_t setBluetoothVariableLatencyEnabled(bool enabled) override;
+ status_t isBluetoothVariableLatencyEnabled(bool* enabled) override;
+ status_t supportsBluetoothVariableLatency(bool* support) override;
private:
const sp<media::IAudioFlingerService> mDelegate;
@@ -569,10 +572,12 @@
SET_DEVICE_CONNECTED_STATE = media::BnAudioFlingerService::TRANSACTION_setDeviceConnectedState,
SET_REQUESTED_LATENCY_MODE = media::BnAudioFlingerService::TRANSACTION_setRequestedLatencyMode,
GET_SUPPORTED_LATENCY_MODES = media::BnAudioFlingerService::TRANSACTION_getSupportedLatencyModes,
- SET_BLUETOOTH_LATENCY_MODES_ENABLED =
- media::BnAudioFlingerService::TRANSACTION_setBluetoothLatencyModesEnabled,
- SUPPORTS_BLUETOOTH_LATENCY_MODES =
- media::BnAudioFlingerService::TRANSACTION_supportsBluetoothLatencyModes,
+ SET_BLUETOOTH_VARIABLE_LATENCY_ENABLED =
+ media::BnAudioFlingerService::TRANSACTION_setBluetoothVariableLatencyEnabled,
+ IS_BLUETOOTH_VARIABLE_LATENCY_ENABLED =
+ media::BnAudioFlingerService::TRANSACTION_isBluetoothVariableLatencyEnabled,
+ SUPPORTS_BLUETOOTH_VARIABLE_LATENCY =
+ media::BnAudioFlingerService::TRANSACTION_supportsBluetoothVariableLatency,
};
protected:
@@ -698,8 +703,9 @@
int output, media::audio::common::AudioLatencyMode mode) override;
Status getSupportedLatencyModes(int output,
std::vector<media::audio::common::AudioLatencyMode>* _aidl_return) override;
- Status setBluetoothLatencyModesEnabled(bool enabled) override;
- Status supportsBluetoothLatencyModes(bool* support) override;
+ Status setBluetoothVariableLatencyEnabled(bool enabled) override;
+ Status isBluetoothVariableLatencyEnabled(bool* enabled) override;
+ Status supportsBluetoothVariableLatency(bool* support) override;
private:
const sp<AudioFlingerServerAdapter::Delegate> mDelegate;
};
diff --git a/media/libaudiohal/impl/DeviceHalHidl.h b/media/libaudiohal/impl/DeviceHalHidl.h
index 727e92f..3e33609 100644
--- a/media/libaudiohal/impl/DeviceHalHidl.h
+++ b/media/libaudiohal/impl/DeviceHalHidl.h
@@ -132,7 +132,7 @@
return INVALID_OPERATION;
}
- int32_t supportsBluetoothLatencyModes(bool* supports __unused) override {
+ int32_t supportsBluetoothVariableLatency(bool* supports __unused) override {
// TODO: Implement the HAL query when moving to AIDL HAL.
return INVALID_OPERATION;
}
diff --git a/media/libaudiohal/include/media/audiohal/DeviceHalInterface.h b/media/libaudiohal/include/media/audiohal/DeviceHalInterface.h
index 6379521..3858607 100644
--- a/media/libaudiohal/include/media/audiohal/DeviceHalInterface.h
+++ b/media/libaudiohal/include/media/audiohal/DeviceHalInterface.h
@@ -128,7 +128,7 @@
std::vector<media::audio::common::AudioMMapPolicyInfo> *policyInfos) = 0;
virtual int32_t getAAudioMixerBurstCount() = 0;
virtual int32_t getAAudioHardwareBurstMinUsec() = 0;
- virtual int32_t supportsBluetoothLatencyModes(bool* supports) = 0;
+ virtual int32_t supportsBluetoothVariableLatency(bool* supports) = 0;
// Update the connection status of an external device.
virtual status_t setConnectedState(const struct audio_port_v7 *port, bool connected) = 0;
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 7e1ca5f..4a8b678 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) \
// singleton for Binder Method Statistics for IAudioFlinger
static auto& getIAudioFlingerStatistics() {
@@ -1617,12 +1618,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;
}
}
@@ -1632,14 +1633,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;
}
@@ -2549,7 +2558,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);
}
@@ -2904,7 +2913,7 @@
if (thread->isMsdDevice()) {
thread->setDownStreamPatch(&patch);
}
- thread->setBluetoothLatencyModesEnabled(mBluetoothLatencyModesEnabled.load());
+ thread->setBluetoothVariableLatencyEnabled(mBluetoothLatencyModesEnabled.load());
return thread;
}
}
@@ -4601,8 +4610,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 19ff97c..cb303cf 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -299,9 +299,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);
status_t onTransactWrapper(TransactionCode code, const Parcel& data, uint32_t flags,
const std::function<status_t()>& delegate) override;
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 cab114b..9d51b5e 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -7435,9 +7435,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 8a29dbf..bb42f22 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -1086,7 +1086,7 @@
return INVALID_OPERATION;
}
- virtual status_t setBluetoothLatencyModesEnabled(bool enabled);
+ virtual status_t setBluetoothVariableLatencyEnabled(bool enabled);
protected:
// updated by readOutputParameters_l()