mt6735 播放音乐时闹钟响,此时来电话并挂断,闹钟和音乐同时响。
时间:10-02
整理:3721RD
点击:
[Audio App] 播放音乐时闹钟响,此时来电话并挂断,闹钟和音乐同时响。
[DESCRIPTION]
手机后台播放本地音乐或谷歌音乐,设定闹钟到规定时间响起,测试机来电通话后,辅助机挂断电话,闹钟和音乐同时响起。
[SOLUTION]
请按照如下方法进行修改:
php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\media\java\android\media\MediaFocusControl.java:
1、importpackages:
importcom.android.internal.telephony.ITelephony;
importandroid.os.ServiceManager;
2、增加获取当前PhoneCallState的方法getPhoneCallState():
privateintgetPhoneCallState(){
intphoneCallState=TelephonyManager.CALL_STATE_IDLE;
TelephonyManagertelephonyManager=(TelephonyManager)mContext.getSystEMService(Context.TELEPHONY_SERVICE);
ITelephonytelephonyService=ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVI
CE));
if(telephonyService!=null){
Log.w(TAG,"getPhoneCallState:mTelephonyService!=null");
try{
phoneCallState=telephonyService.getPreciseCallState();
Log.w(TAG,"getPhoneCallState:telephonyService.getPreciseCallState()="+phoneCallState);
}catch(RemoteExceptionex){
if(telephonyManager!=null){
phoneCallState=telephonyManager.getCallState();
Log.w(TAG,"getPhoneCallState:telephonyManager.getCallState()="+phoneCallState);
}
Log.w(TAG,"CatchexceptionwhengetPreciseCallState:ex="
+ex.getMessage());
}
}else{
Log.w(TAG,"getPhoneCallState:telephonyService==null");
if(telephonyManager!=null){
phoneCallState=telephonyManager.getCallState();
Log.w(TAG,"getPhoneCallState:telephonyManager.getCallState()="+phoneCallState);
}
}
Log.w(TAG,"getPhoneCallState:phoneCallState="+phoneCallState);
returnphoneCallState;
}
3、修改
privatebooleancanReassignAudioFocus(){
//focusrequestsarerejectedduringaphonecallorwhenthephoneisringing
//thisisequivalenttoIN_VOICE_COMM_FOCUS_IDhavingthefocus
if(!mFocusStack.isEmpty()&&mFocusStack.peek().hasSameCLIent(IN_VOICE_COMM_FOCUS_ID)){
returnfalse;
}
returntrue;
}
为
privatebooleancanReassignAudioFocus(){
//focusrequestsarerejectedduringaphonecallorwhenthephoneisringing
//thisisequivalenttoIN_VOICE_COMM_FOCUS_IDhavingthefocus
if(!mFocusStack.isEmpty()&&mFocusStack.peek().hasSameClient(IN_VOICE_COMM_FOCUS_ID)&&(getPhoneCallState(
)!=TelephonyManager.CALL_STATE_IDLE)){
Log.w(TAG,"canReassignAudioFocus:returnfalse");
returnfalse;
}
Log.w(TAG,"canReassignAudioFocus:returntrue");
returntrue;
}
附:开启音效,把音量调到最大,背景播放音乐, 前景拨拔号按键音, 拨号音会破音
音乐播放器开启音效,然后把音量侧键调到最大,背景播放一个音乐, 然后去拨拔号按键音, 拨
号音会破音请修改替换\audioflinger\Effects.cpp中AudioFlinger::EffectModule::process()这
个函数中如下一行Code: tempValue = out + in;替换为: int64_t out_tmp = out;
int64_t in_tmp = in; tempValue = out_tmp + in_tmp;如果ok,请打patch:ALPS01852339
[DESCRIPTION]
手机后台播放本地音乐或谷歌音乐,设定闹钟到规定时间响起,测试机来电通话后,辅助机挂断电话,闹钟和音乐同时响起。
[SOLUTION]
请按照如下方法进行修改:
php?mod=tag&id=6090" target="_blank" class="relatedlink">Frameworks\base\media\java\android\media\MediaFocusControl.java:
1、importpackages:
importcom.android.internal.telephony.ITelephony;
importandroid.os.ServiceManager;
2、增加获取当前PhoneCallState的方法getPhoneCallState():
privateintgetPhoneCallState(){
intphoneCallState=TelephonyManager.CALL_STATE_IDLE;
TelephonyManagertelephonyManager=(TelephonyManager)mContext.getSystEMService(Context.TELEPHONY_SERVICE);
ITelephonytelephonyService=ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVI
CE));
if(telephonyService!=null){
Log.w(TAG,"getPhoneCallState:mTelephonyService!=null");
try{
phoneCallState=telephonyService.getPreciseCallState();
Log.w(TAG,"getPhoneCallState:telephonyService.getPreciseCallState()="+phoneCallState);
}catch(RemoteExceptionex){
if(telephonyManager!=null){
phoneCallState=telephonyManager.getCallState();
Log.w(TAG,"getPhoneCallState:telephonyManager.getCallState()="+phoneCallState);
}
Log.w(TAG,"CatchexceptionwhengetPreciseCallState:ex="
+ex.getMessage());
}
}else{
Log.w(TAG,"getPhoneCallState:telephonyService==null");
if(telephonyManager!=null){
phoneCallState=telephonyManager.getCallState();
Log.w(TAG,"getPhoneCallState:telephonyManager.getCallState()="+phoneCallState);
}
}
Log.w(TAG,"getPhoneCallState:phoneCallState="+phoneCallState);
returnphoneCallState;
}
3、修改
privatebooleancanReassignAudioFocus(){
//focusrequestsarerejectedduringaphonecallorwhenthephoneisringing
//thisisequivalenttoIN_VOICE_COMM_FOCUS_IDhavingthefocus
if(!mFocusStack.isEmpty()&&mFocusStack.peek().hasSameCLIent(IN_VOICE_COMM_FOCUS_ID)){
returnfalse;
}
returntrue;
}
为
privatebooleancanReassignAudioFocus(){
//focusrequestsarerejectedduringaphonecallorwhenthephoneisringing
//thisisequivalenttoIN_VOICE_COMM_FOCUS_IDhavingthefocus
if(!mFocusStack.isEmpty()&&mFocusStack.peek().hasSameClient(IN_VOICE_COMM_FOCUS_ID)&&(getPhoneCallState(
)!=TelephonyManager.CALL_STATE_IDLE)){
Log.w(TAG,"canReassignAudioFocus:returnfalse");
returnfalse;
}
Log.w(TAG,"canReassignAudioFocus:returntrue");
returntrue;
}
附:开启音效,把音量调到最大,背景播放音乐, 前景拨拔号按键音, 拨号音会破音
音乐播放器开启音效,然后把音量侧键调到最大,背景播放一个音乐, 然后去拨拔号按键音, 拨
号音会破音请修改替换\audioflinger\Effects.cpp中AudioFlinger::EffectModule::process()这
个函数中如下一行Code: tempValue = out + in;替换为: int64_t out_tmp = out;
int64_t in_tmp = in; tempValue = out_tmp + in_tmp;如果ok,请打patch:ALPS01852339