美文网首页
mt6735 [Audio Policy]如何做到在静音模式下音

mt6735 [Audio Policy]如何做到在静音模式下音

作者: 体感互动 | 来源:发表于2017-11-02 14:26 被阅读0次

1.请修改AudioService.; text-decoration-style: initial; text-decoration-color: initial;"face="新宋体">将:

if(mVoiceCapable){

mRingerModeAffectedStreams&=~(1<

}else{

mRingerModeAffectedStreams|=(1<

}

替换为:

mRingerModeAffectedStreams|=(1<

2.在AudioService.java的函数 public void adjustStreamVolume(int

streamType, int direction, int flags)中有如下这么一段code:

...

// If

either the client forces allowing ringer modes for this

adjustment,

// or the

stream type is one that is affected by ringer

modes

if

(((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0)

||

(streamTypeAlias == getMasterStreamType()))

{

int

ringerMode = getRingerMode();

// do not

vibrate if already in vibrate mode

...

请在这个if判断中按照如下方法增加一个判断条件改为:

...

// If

either the client forces allowing ringer modes for this

adjustment,

// or the

stream type is one that is affected by ringer

modes

if

(((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0)

||

(streamTypeAlias ==

getMasterStreamType())||

(streamType == AudioSystem.STREAM_MUSIC))

{

int

ringerMode = getRingerMode();

// do not

vibrate if already in vibrate mode

...

这样修改后的效果是:

1.当系统切到静音或者震动模式时,MUSIC的会被mute,如果此时调整music的音量:

Case

1:若当前处在静音模式,第一次调节music音量会切换到震动模式,music仍被mute;

case

2:若当前处在震动模式,第一次调大Music两会切换到normal

模式,music被unmute,可以调节音量;

case

3:若情景模式切换到outdoor模式,则音乐音量会被设定为最大音量;

2.当系统为normal

模式时,播放音乐的过程中,调低music的音量,当music的音量调到0level时,会首先将系统切换到震动模式,继续调低音量会切换到静音模式。

资料来源:MT6735  一牛网

相关文章

网友评论

      本文标题:mt6735 [Audio Policy]如何做到在静音模式下音

      本文链接:https://www.haomeiwen.com/subject/uywopxtx.html