Adding IAudioControl#onDevicesToDuckChange
Introducing new API and parcelable for informing the HAL when to duck
audio for automotive targets.
Bug: 158242859
Test: atest VtsAidlHalAudioControlTest
Change-Id: I5799c556e338d768ea8010e1f035af8584a240dd
diff --git a/automotive/audiocontrol/aidl/default/AudioControl.cpp b/automotive/audiocontrol/aidl/default/AudioControl.cpp
index 5e09b4f..748947c 100644
--- a/automotive/audiocontrol/aidl/default/AudioControl.cpp
+++ b/automotive/audiocontrol/aidl/default/AudioControl.cpp
@@ -17,6 +17,7 @@
#include "AudioControl.h"
#include <aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.h>
+#include <aidl/android/hardware/automotive/audiocontrol/DuckingInfo.h>
#include <aidl/android/hardware/automotive/audiocontrol/IFocusListener.h>
#include <android-base/logging.h>
@@ -102,6 +103,27 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus AudioControl::onDevicesToDuckChange(
+ const std::vector<DuckingInfo>& in_duckingInfos) {
+ LOG(INFO) << "AudioControl::onDevicesToDuckChange";
+ for (const DuckingInfo& duckingInfo : in_duckingInfos) {
+ LOG(INFO) << "zone: " << duckingInfo.zoneId;
+ LOG(INFO) << "Devices to duck:";
+ for (auto& addressToDuck : duckingInfo.deviceAddressesToDuck) {
+ LOG(INFO) << addressToDuck;
+ }
+ LOG(INFO) << "Devices to unduck:";
+ for (auto& addressToUnduck : duckingInfo.deviceAddressesToUnduck) {
+ LOG(INFO) << addressToUnduck;
+ }
+ LOG(INFO) << "Usages holding focus:";
+ for (auto& usage : duckingInfo.usagesHoldingFocus) {
+ LOG(INFO) << usage;
+ }
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) {
if (numArgs == 0) {
return dumpsys(fd);
diff --git a/automotive/audiocontrol/aidl/default/AudioControl.h b/automotive/audiocontrol/aidl/default/AudioControl.h
index a77da3e..cf56947 100644
--- a/automotive/audiocontrol/aidl/default/AudioControl.h
+++ b/automotive/audiocontrol/aidl/default/AudioControl.h
@@ -18,6 +18,7 @@
#include <aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.h>
#include <aidl/android/hardware/automotive/audiocontrol/BnAudioControl.h>
+#include <aidl/android/hardware/automotive/audiocontrol/DuckingInfo.h>
namespace aidl::android::hardware::automotive::audiocontrol {
@@ -27,6 +28,8 @@
public:
ndk::ScopedAStatus onAudioFocusChange(const std::string& in_usage, int32_t in_zoneId,
AudioFocusChange in_focusChange) override;
+ ndk::ScopedAStatus onDevicesToDuckChange(
+ const std::vector<DuckingInfo>& in_duckingInfos) override;
ndk::ScopedAStatus registerFocusListener(
const shared_ptr<IFocusListener>& in_listener) override;
ndk::ScopedAStatus setBalanceTowardRight(float in_value) override;