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;

}

android电话接通状态下,关机铃声无法从外放输出的更多相关文章

  1. android源码环境下用mmm/mm编译模块,输出编译log到文件的方法

    android源码环境下用mmm/mm编译模块,输出编译log到文件的方法 1,在android目录下直接用mmm命令编译, log信息保存在android目录下 mmm packages/apps/ ...

  2. [cocos2d-x·解Bug]关于cocos2d-x游戏在android锁屏状态下播放Bgm的解决方法

    最近<宠物联萌>在三星App上发布遇到一个问题:如果用户在锁定屏幕时解锁解到一半时取消解锁,这时用cocos2d-x开发的游戏就会出现游戏Bgm会恢复播放,但手机屏幕仍然是锁屏状态的Bug ...

  3. Android锁屏状态下弹出activity

    在接收消息广播的onReceive里.跳转到你要显示的界面.如: Intent intent = new Intent(arg0,MainActivity.class); intent.addFlag ...

  4. Android锁屏状态下弹出activity,如新版qq的锁屏消息提示

    在接收消息广播的onReceive里,跳转到你要显示的界面.如: Intent intent = new Intent(arg0,MainActivity.class); intent.addFlag ...

  5. android 控件在不同状态下的内容样式与背景样式

    1 控件内容(如字体颜色)在不同状态下有不同的表现色ref:http://developer.android.com/guide/topics/resources/color-list-resourc ...

  6. 登录锁定状态下Win7关机技巧总结

    登录锁定状态下Win7关机技巧总结 一般在锁定状态都是有个关闭电脑的图标的.但是如果你的系统没有,那么怎么样关机呢,所谓的锁定状态通常是指电脑在登录界面,具体的实现如下,感兴趣的朋友可以参考下 现在大 ...

  7. Android菜鸟的成长笔记(15)—— Android中的状态保存探究(下)

    原文:Android菜鸟的成长笔记(15)-- Android中的状态保存探究(下) 在上一篇中我们简单了解关于Android中状态保存的过程和原理,这一篇中我们来看一下在系统配置改变的情况下保存数据 ...

  8. 如何解决win10关机状态下,按键盘会自动开机的问题

    关机状态下按下键盘会自动开机,是因为所装的系统默认设置了快速启动功能 下面是关闭快速启动的方法: 步骤一: 在win10桌面右击,点击显示设置 步骤二: 电源和睡眠-->其他电源设置 步骤三: ...

  9. $Android自定义控件在不同状态下的属性

    在写代码的时候,有时候需要控件在不同状态下显示不同的外观,比如在按钮按下的时候要变颜色,EditText获取焦点时候边框要变颜色等.那么下面就来梳理一下这些是怎么实现的. (一)按钮按下时候变颜色 1 ...

随机推荐

  1. js中判断按键的方法

    // 通过证件号码查询人员基本信息,响应回车事件的js函数, $('#sfwwsss [name="AAC002"]').keydown(function(event) { var ...

  2. c# 流程控制

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  3. Kqueue与epoll机制

    首先介绍阻塞与非阻塞:阻塞是个什么概念呢?比如某个时候你在等快递,但是你不知道快递什么时候过来,而且你没有别的事可以干(或者说接下来的事要等快递来了才能做):那么你可以去睡觉了,因为你知道快递把货送来 ...

  4. OC中的类型强制转换

    在Objective-C中,以数字格式组成的字符串经常需要转换为NSNumber对象后再使用.例如有一个字符串对象@"111.22",需要转为NSNumber对象,最简单的方法就是 ...

  5. The reference to entity "characterEncoding" must end with the ';' delimiter

    数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...

  6. GCC -Wall

    官网:http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Warning-Options.html#Warning-Options3.8 Options to Re ...

  7. POJ 1472 Coins (多重背包+滚动数组)

    Coins Time Limit: 3000MS Memory Limit: 30000K Total Submissions: 25827 Accepted: 8741 Description Pe ...

  8. 怎样在VirtualBox 虚拟机中挂载共享目录

    啊.好长时间没写博客了.近期有点忙~~ 不得不说 VirtualBox 对于一些不想装非常多个系统又非常想实验新系统的人来说确实是神器: 哈哈.个人还是比較爱玩这些个各种各样的Linux 发型版的,可 ...

  9. COM组件

    COM组件   COM component(COM组件)是微软公司为了计算机工业的软件生产更加符合人类的行为方式开发的一种新的软件开发技术.在COM构架下,人们可以开发出各种各样的功能专一的组件,然后 ...

  10. CentOS下配置多个Tomcat同时运行 本篇文章来源于 Linux公社网站(www.linuxidc.com)

    原文地址:http://blog.csdn.net/tjcyjd/article/details/46553361 版权声明:本文为博主原创文章,未经博主允许不得转载. 同一服务器部署多个tomcat ...