Fix AudioManager mode.
It shall be set to MODE_RINGTONE when playing the local ring, and MODE_IN_COMMUNICATION in Connected state. Before this commit MODE_IN_COMMUNICATION was only set for outgoing calls, not incoming, which is bad.
This commit is contained in:
parent
43fdbed648
commit
e45e8b8229
1 changed files with 7 additions and 6 deletions
|
@ -1204,6 +1204,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
|
|
||||||
if (state == State.Connected) {
|
if (state == State.Connected) {
|
||||||
if (mLc.getCallsNb() == 1) {
|
if (mLc.getCallsNb() == 1) {
|
||||||
|
//It is for incoming calls, because outgoing calls enter MODE_IN_COMMUNICATION immediately when they start.
|
||||||
|
//However, incoming call first use the MODE_RINGING to play the local ring.
|
||||||
|
setAudioManagerInCallMode();
|
||||||
mAudioManager.abandonAudioFocus(null);
|
mAudioManager.abandonAudioFocus(null);
|
||||||
requestAudioFocus(STREAM_VOICE_CALL);
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
}
|
}
|
||||||
|
@ -1214,10 +1217,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == State.OutgoingEarlyMedia) {
|
|
||||||
setAudioManagerInCallMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == State.CallEnd || state == State.Error) {
|
if (state == State.CallEnd || state == State.Error) {
|
||||||
if (mLc.getCallsNb() == 0) {
|
if (mLc.getCallsNb() == 0) {
|
||||||
Context activity = getContext();
|
Context activity = getContext();
|
||||||
|
@ -1257,6 +1256,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state == State.OutgoingInit) {
|
if (state == State.OutgoingInit) {
|
||||||
|
//Enter the MODE_IN_COMMUNICATION mode as soon as possible, so that ringback
|
||||||
|
//is heard normally in earpiece or bluetooth receiver.
|
||||||
setAudioManagerInCallMode();
|
setAudioManagerInCallMode();
|
||||||
requestAudioFocus(STREAM_VOICE_CALL);
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
startBluetooth();
|
startBluetooth();
|
||||||
|
@ -1375,8 +1376,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
routeAudioToSpeaker(); // Need to be able to ear the ringtone during the early media
|
routeAudioToSpeaker(); // Need to be able to ear the ringtone during the early media
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Hacks.needGalaxySAudioHack())
|
//if (Hacks.needGalaxySAudioHack())
|
||||||
mAudioManager.setMode(MODE_RINGTONE);
|
mAudioManager.setMode(MODE_RINGTONE);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ((mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE || mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) && mVibrator != null) {
|
if ((mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE || mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) && mVibrator != null) {
|
||||||
|
|
Loading…
Reference in a new issue