|
|
|
@ -25,6 +25,7 @@
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "Engine.h"
|
|
|
|
|
#include <android-base/macros.h>
|
|
|
|
|
#include <AudioPolicyManagerObserver.h>
|
|
|
|
|
#include <AudioPort.h>
|
|
|
|
|
#include <IOProfile.h>
|
|
|
|
@ -302,7 +303,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// when in call, DTMF and PHONE strategies follow the same rules
|
|
|
|
|
// FALL THROUGH
|
|
|
|
|
FALLTHROUGH_INTENDED;
|
|
|
|
|
|
|
|
|
|
case STRATEGY_PHONE:
|
|
|
|
|
// Force use of only devices on primary output if:
|
|
|
|
@ -343,7 +344,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
|
|
|
|
|
device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO;
|
|
|
|
|
if (device) break;
|
|
|
|
|
// if SCO device is requested but no SCO device is available, fall back to default case
|
|
|
|
|
// FALL THROUGH
|
|
|
|
|
FALLTHROUGH_INTENDED;
|
|
|
|
|
|
|
|
|
|
default: // FORCE_NONE
|
|
|
|
|
device = availableOutputDevicesType & AUDIO_DEVICE_OUT_HEARING_AID;
|
|
|
|
@ -416,7 +417,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
|
|
|
|
|
outputDeviceTypesToIgnore);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// FALL THROUGH
|
|
|
|
|
FALLTHROUGH_INTENDED;
|
|
|
|
|
|
|
|
|
|
case STRATEGY_ENFORCED_AUDIBLE:
|
|
|
|
|
// strategy STRATEGY_ENFORCED_AUDIBLE uses same routing policy as STRATEGY_SONIFICATION
|
|
|
|
@ -466,7 +467,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// The second device used for sonification is the same as the device used by media strategy
|
|
|
|
|
// FALL THROUGH
|
|
|
|
|
FALLTHROUGH_INTENDED;
|
|
|
|
|
|
|
|
|
|
case STRATEGY_ACCESSIBILITY:
|
|
|
|
|
if (strategy == STRATEGY_ACCESSIBILITY) {
|
|
|
|
@ -496,7 +497,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// For other cases, STRATEGY_ACCESSIBILITY behaves like STRATEGY_MEDIA
|
|
|
|
|
// FALL THROUGH
|
|
|
|
|
FALLTHROUGH_INTENDED;
|
|
|
|
|
|
|
|
|
|
// FIXME: STRATEGY_REROUTING follow STRATEGY_MEDIA for now
|
|
|
|
|
case STRATEGY_REROUTING:
|
|
|
|
@ -681,7 +682,7 @@ audio_devices_t Engine::getDeviceForInputSource(audio_source_t inputSource) cons
|
|
|
|
|
device = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// FALL THROUGH
|
|
|
|
|
FALLTHROUGH_INTENDED;
|
|
|
|
|
|
|
|
|
|
default: // FORCE_NONE
|
|
|
|
|
if (availableDeviceTypes & AUDIO_DEVICE_IN_WIRED_HEADSET) {
|
|
|
|
|