Revert "Revert "audio policy: implement routing policy for USB docking s...""
This reverts commit 73b6c9635f86ef64cd6c74d82327c12b0255f80f.
Bug: 197584191
Test: make
Change-Id: Id587c2a554a32a138be7a388460554f1664bcffa
diff --git a/services/audiopolicy/engine/common/src/EngineBase.cpp b/services/audiopolicy/engine/common/src/EngineBase.cpp
index 150a9a8..7a06206 100644
--- a/services/audiopolicy/engine/common/src/EngineBase.cpp
+++ b/services/audiopolicy/engine/common/src/EngineBase.cpp
@@ -71,7 +71,10 @@
audio_policy_dev_state_t state)
{
audio_devices_t deviceType = devDesc->type();
- if ((deviceType != AUDIO_DEVICE_NONE) && audio_is_output_device(deviceType)) {
+ if ((deviceType != AUDIO_DEVICE_NONE) && audio_is_output_device(deviceType)
+ && deviceType != AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) {
+ // USB dock does not follow the rule of last removable device connected wins.
+ // It is only used if no removable device is connected or if set as preferred device
mLastRemovableMediaDevices.setRemovableMediaDevices(devDesc, state);
}
diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
index 4c3d92c..dc34a38 100644
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -272,7 +272,8 @@
devices = availableOutputDevices.getFirstDevicesFromTypes(
getLastRemovableMediaDevices());
if (!devices.isEmpty()) break;
- devices = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_EARPIECE);
+ devices = availableOutputDevices.getFirstDevicesFromTypes({
+ AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, AUDIO_DEVICE_OUT_EARPIECE});
} break;
case STRATEGY_SONIFICATION:
@@ -364,7 +365,8 @@
AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET);
}
if (devices2.isEmpty()) {
- devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_SPEAKER);
+ devices2 = availableOutputDevices.getFirstDevicesFromTypes({
+ AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, AUDIO_DEVICE_OUT_SPEAKER});
}
DeviceVector devices3;
if (strategy == STRATEGY_MEDIA) {