android 微信听筒无声
第三方APP在听筒接听语音时会固定去设audio_mode为incall,而不会去管以下是sim1还是sim2在位。
而speechdriver这边会依据audio_mode会固定的去设定modem_index,会固定将MD1 call起来。
假设是仅仅插sim2,不插sim1,就会存在报MD 没有ready的问题,MD不会收到CCCI消息,会导致没有语音。
须要去推断MD1和MD2的状态。在依据他们的状态去开启相应的MD。
改动的文件和函数为:SpeechDriverFactory.cpp
status_t SpeechDriverFactory::SetActiveModemIndexByAudioMode(int mode)
{
status_t return_status = NO_ERROR;
status_t FLAG_MD1 ;status_t FLAG_MD2 ;
FLAG_MD1=mSpeechDriver1->CheckModemIsReady();
FLAG_MD2=mSpeechDriver2->CheckModemIsReady();
ALOGD("%s() mode(%d) FLAG_MD1(%d) FLAG_MD2(%d) !!", __FUNCTION__, mode,FLAG_MD1,FLAG_MD2);
switch (mode) {
case AUDIO_MODE_IN_CALL:
if(FLAG_MD1==1)
return_status = SetActiveModemIndex(MODEM_1);
else if((FLAG_MD1==0)&&(FLAG_MD2==1))
return_status = SetActiveModemIndex(MODEM_2);
break;
case AUDIO_MODE_IN_CALL_2:
return_status = SetActiveModemIndex(MODEM_2);
break;
default:
ALOGE("%s() mode(%d) is neither MODE_IN_CALL nor MODE_IN_CALL_2!!", __FUNCTION__, mode);
return_status = INVALID_OPERATION;
break;
}
return return_status;
}
2.在close的时候,之前打电话设计都是incall相应MD1,incall_2相应MD2.
眼下第三方APP这边是固定去设mode incall,如今是去打开的MD2。所以在关闭的时候会发生assert的情况,请关闭该assert,或者改动assert条件。
.
SpeechPhoneCallController.cpp
status_t SpeechPhoneCallController::CloseModemSpeechControlFlow(const audio_mode_t audio_mode)
{
Mutex::Autolock _l(mLock);
ALOGD("+%s(), audio_mode = %d", __FUNCTION__, audio_mode);
const modem_index_t modem_index = mSpeechDriverFactory->GetActiveModemIndex();
ALOGD("+%s(), audio_mode = %d , modem_index = %d ", __FUNCTION__, audio_mode, modem_index);
//ASSERT((modem_index == MODEM_1 && audio_mode == AUDIO_MODE_IN_CALL) ||
// (modem_index == MODEM_2 && audio_mode == AUDIO_MODE_IN_CALL_2));