android wechat earpiece silent

When the dual talk project sim card is inserted in card 2. The WeChat earpiece is silent;
the third-party APP will always set the audio_mode to incall when the earpiece answers the voice, regardless of whether the following is sim1 or sim2.
The speechdriver will set the modem_index fixedly according to the audio_mode, and will call MD1 fixedly.


Assuming that only sim2 is inserted, and sim1 is not inserted, there will be a problem that the MD is not ready, and the MD will not receive the CCCI message, resulting in no voice.




The state of MD1 and MD2 needs to be inferred. According to their state to open the corresponding MD.
The changed files and functions are: 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()
   ; ("%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. When close, the previous call design was incall corresponding MD1, incall_2 corresponding to MD2.
Now the third-party APP is fixed to set mode incall, and now it is to open MD2 . Therefore, an assert will occur when it is closed. Please close the assert, or change the assert condition.

.
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));

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324609867&siteId=291194637