summaryrefslogtreecommitdiff
path: root/audio/core/all-versions/default/Device.cpp
diff options
context:
space:
mode:
authorMikhail Naganov <mnaganov@google.com>2022-01-31 22:40:16 +0000
committerMikhail Naganov <mnaganov@google.com>2022-01-31 22:43:51 +0000
commit533f78f411b4e9c5156d6b252c99415df9441cb1 (patch)
tree287fdf204408962319c3e77d30ef7ef6ed9b0ad2 /audio/core/all-versions/default/Device.cpp
parent01035edde106dc4c6f0b2098c4ee7b1f8debec4c (diff)
audio: Add IDevice.setConnectedState_7_1 method
This is an updated version of IDevice.setConnectedState which accepts a full AudioPort so that additional data like extra audio descriptors can be passed to the audio HAL. Bug: 211601178 Test: atest VtsHalAudioV7_1TargetTest Change-Id: Id746caa32122dabfb83feb5b515bed7717bcb67c
Diffstat (limited to 'audio/core/all-versions/default/Device.cpp')
-rw-r--r--audio/core/all-versions/default/Device.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp
index ac5a3ba8ef..ca8c03df36 100644
--- a/audio/core/all-versions/default/Device.cpp
+++ b/audio/core/all-versions/default/Device.cpp
@@ -616,6 +616,21 @@ Return<void> Device::updateAudioPatch(int32_t previousPatch,
#endif
+#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
+Return<Result> Device::setConnectedState_7_1(const AudioPort& devicePort, bool connected) {
+ if (version() >= AUDIO_DEVICE_API_VERSION_3_2 &&
+ mDevice->set_device_connected_state_v7 != nullptr) {
+ audio_port_v7 halPort;
+ if (status_t status = HidlUtils::audioPortToHal(devicePort, &halPort); status != NO_ERROR) {
+ return analyzeStatus("audioPortToHal", status);
+ }
+ return analyzeStatus("set_device_connected_state_v7",
+ mDevice->set_device_connected_state_v7(mDevice, &halPort, connected));
+ }
+ return Result::NOT_SUPPORTED;
+}
+#endif
+
} // namespace implementation
} // namespace CPP_VERSION
} // namespace audio