mt6735 蓝牙耳机播放音乐时候插入有线耳机后拔出,音乐会停止播放
时间:10-02
整理:3721RD
点击:
[Audio Common]蓝牙耳机播放音乐时候插入有线耳机后拔出,音乐会停止播放
[DESCRIPTION]
在MT6572平台上:
配对连接一个蓝牙耳机,然后使用音乐app播放歌曲,声音从蓝牙耳机传出,插入一个有线耳机后声音继续从蓝牙耳机播放,不会暂停,但是这时拔掉有线耳机,会暂停音乐播放。
[SOLUTION]
如果希望拔掉耳机时,音乐不会暂停,继续从蓝牙耳机输出,请在HeADSetObserver.java做如下修改,修改处有AAAA标识:
privatesynchronizedfinalvoidupdate(StringnewName,intnewState){
//Retainonlyrelevantbits
intheadsetState=newState&SUPPORTED_HEADSETS;
intnewOrOld=headsetState|mHeadsetState;
intdelay=0;
finalIActivityManageram=ActivityManagerNative.getDefault();
finalAudioManageraudioManager=(AudioManager)getSystEMService(Context.AUDIO_SERVICE);//AAAA
//rejectallsuspecttransitionsnlyacceptstatechangesfROM:
//-a:0heasetto1headset
//-b:1headsetto0headset
if(mHeadsetState==headsetState||((newOrOld&(newOrOld-1))!=0)){
return;
}
mHeadsetName=newName;
mPrevHeadsetState=mHeadsetState;
mHeadsetState=headsetState;
if(headsetState==0){
mHandler.postDelayed(newRunnable(){
publicvoidrun(){
if(!am.testIsSystemReady()){
Slog.w(TAG,"systemnotready...");
mHandler.postDelayed(this,100);
}
elseif(!audioManager.isbluetoothA2dpOn())//AAAA
{
Intentintent=newIntent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
Slog.w(TAG,"headsetBroADCast!...");
mContext.sendBroadcast(intent);
}
}
},100);
。
[DESCRIPTION]
在MT6572平台上:
配对连接一个蓝牙耳机,然后使用音乐app播放歌曲,声音从蓝牙耳机传出,插入一个有线耳机后声音继续从蓝牙耳机播放,不会暂停,但是这时拔掉有线耳机,会暂停音乐播放。
[SOLUTION]
如果希望拔掉耳机时,音乐不会暂停,继续从蓝牙耳机输出,请在HeADSetObserver.java做如下修改,修改处有AAAA标识:
privatesynchronizedfinalvoidupdate(StringnewName,intnewState){
//Retainonlyrelevantbits
intheadsetState=newState&SUPPORTED_HEADSETS;
intnewOrOld=headsetState|mHeadsetState;
intdelay=0;
finalIActivityManageram=ActivityManagerNative.getDefault();
finalAudioManageraudioManager=(AudioManager)getSystEMService(Context.AUDIO_SERVICE);//AAAA
//rejectallsuspecttransitionsnlyacceptstatechangesfROM:
//-a:0heasetto1headset
//-b:1headsetto0headset
if(mHeadsetState==headsetState||((newOrOld&(newOrOld-1))!=0)){
return;
}
mHeadsetName=newName;
mPrevHeadsetState=mHeadsetState;
mHeadsetState=headsetState;
if(headsetState==0){
mHandler.postDelayed(newRunnable(){
publicvoidrun(){
if(!am.testIsSystemReady()){
Slog.w(TAG,"systemnotready...");
mHandler.postDelayed(this,100);
}
elseif(!audioManager.isbluetoothA2dpOn())//AAAA
{
Intentintent=newIntent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
Slog.w(TAG,"headsetBroADCast!...");
mContext.sendBroadcast(intent);
}
}
},100);
。