android电话接通状态下,关机铃声无法从外放输出
2014-09-04 08:47
141 查看
AudioMTKPolicyManager.cpp的startOutput方法中,将在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;
}
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;
}
相关文章推荐
- android电话接通状态下,关机铃声无法从外放输出
- android监听用户的拨打电话的状态
- android之通过phoneStateListener监听电话状态改变
- ubuntu 包管理之“:E: 读错误 - read (5: 输入/输出错误) E: 无法解析或打开软件包的列表或是状态文件。”的解决
- android 电话状态的监听(来电和去电)
- 举例说明在android中用PhoneStateListener监听手机电话状态与用发送邮件来通知来电电话的号码
- android:查询数据库 指定列 指定列名 并输出查询结果(如查询电话本,SMS的ContentResolver提供的)
- android 电话状态的监听
- android 2.1 监听电话状态并自动接听来电
- Android接电话流程、Phone来电过程、phone上层来电话解析 接通电话
- android 2.1 监听电话状态并自动接听来电
- android logcat 无法正常输出
- android之通过phoneStateListener监听电话状态改变
- android 电话接通时震动
- 监听android电话呼叫状态
- Android中通过来电转移实现“电话已关机”,“此号码已停机”等
- Android游戏中获取电话的状态来进行游戏的暂停和继续
- android 2.1 监听电话状态并自动接听来电
- android 电话状态的监听(来电和去电)
- android 电话状态的监听(来电和去电)