In the Startoutput method of AudioMTKPolicyManager.cpp, it is added after Newdevic gets:
if (stream==audiosystem::boot) Newdevice|=audio_device_out_speaker;
status_t audiomtkpolicymanager::startoutput (audio_io_handle_t output,
Audiosystem::stream_type Stream,
int session)
{
ALOGD ("startoutput () output%d, stream%d, session%d", output, stream, session);
......
if (outputdesc->mrefcount[stream] = = 1) {
audio_devices_t newdevice = Getnewdevice (output, false/*fromcache*/);
Routing_strategy strategy = Getstrategy (stream);
BOOL Shouldwait = (strategy = = strategy_sonification) | |
(strategy = = strategy_sonification_respectful);
uint32_t WAITMS = 0;
BOOL force = FALSE;
if (stream==audiosystem::boot) Newdevice|=audio_device_out_speaker;
for (size_t i = 0; i < moutputs.size (); i++) {
Audiooutputdescriptor *desc = Moutputs.valueat (i);
if (desc! = Outputdesc) {
Force a device change if any other output are managed by the same HW
module and have a current device selection this differs from selected device.
The audio HAL must receive the new device selection so it can
Change the device currently selected by the other active output.
if (Outputdesc->shareshwmodulewith (DESC) &&
Desc->device ()! = Newdevice) {
force = true;
}
Wait for audio on other active outputs to is presented when starting
A notification so that audio focus effect can propagate.
uint32_t latency = desc->latency ();
if (shouldwait && desc->isactive (Latency * 2) && (Waitms < latency)) {
Waitms = latency;
}
}
}
......
}
return no_error;
}
The shutdown ringtone cannot be output from the speaker when the Android phone is switched on