When the android phone is connected, the shutdown ringtone cannot be output from the outside

Source: Internet
Author: User

When the android phone is connected, the shutdown ringtone cannot be output from the outside
In the startOutput method of AudioMTKPolicyManager. cpp, add the following content after obtaining newDevic:
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 is managed by the same hw
// Module and has a current device selection that differs from selected device.
// In this case, the audio HAL must receive the new device selection so that 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 be 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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.