Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cfd15dd3 authored by Chung-yih Wang's avatar Chung-yih Wang
Browse files

Fix the IN_CALL mode issue.

If the sip call is on-holding, we should not set the audio to
MODE_NORMAL, or it will affect the audio if there is an active pstn
call.

Change-Id: If1bcba952617bf8427bc9e2d64d483ba1ee37370
parent 567722ee
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -191,11 +191,8 @@ public interface SipAudioCall {
     */
     */
    void continueCall() throws SipException;
    void continueCall() throws SipException;


    /** Puts the device to in-call mode. */
    void setInCallMode();

    /** Puts the device to speaker mode. */
    /** Puts the device to speaker mode. */
    void setSpeakerMode();
    void setSpeakerMode(boolean speakerMode);


    /** Toggles mute. */
    /** Toggles mute. */
    void toggleMute();
    void toggleMute();
+10 −11
Original line number Original line Diff line number Diff line
@@ -485,16 +485,9 @@ public class SipAudioCallImpl extends SipSessionAdapter
        return mMuted;
        return mMuted;
    }
    }


    public synchronized void setInCallMode() {
    public synchronized void setSpeakerMode(boolean speakerMode) {
        ((AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE))
        ((AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE))
                .setSpeakerphoneOn(false);
                .setSpeakerphoneOn(speakerMode);
        ((AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE))
                .setMode(AudioManager.MODE_NORMAL);
    }

    public synchronized void setSpeakerMode() {
        ((AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE))
                .setSpeakerphoneOn(true);
    }
    }


    public void sendDtmf(int code) {
    public void sendDtmf(int code) {
@@ -587,8 +580,15 @@ public class SipAudioCallImpl extends SipSessionAdapter
                    Log.d(TAG, "   not sending");
                    Log.d(TAG, "   not sending");
                    audioStream.setMode(RtpStream.MODE_RECEIVE_ONLY);
                    audioStream.setMode(RtpStream.MODE_RECEIVE_ONLY);
                }
                }
            } else {
                /* The recorder volume will be very low if the device is in
                 * IN_CALL mode. Therefore, we have to set the mode to NORMAL
                 * in order to have the normal microphone level.
                 */
                ((AudioManager) mContext.getSystemService
                        (Context.AUDIO_SERVICE))
                        .setMode(AudioManager.MODE_NORMAL);
            }
            }
            setInCallMode();


            AudioGroup audioGroup = new AudioGroup();
            AudioGroup audioGroup = new AudioGroup();
            audioStream.join(audioGroup);
            audioStream.join(audioGroup);
@@ -614,7 +614,6 @@ public class SipAudioCallImpl extends SipSessionAdapter
                mRtpSession = null;
                mRtpSession = null;
            }
            }
        }
        }
        setInCallMode();
    }
    }


    private int getLocalMediaPort() {
    private int getLocalMediaPort() {