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);