Some fix for Bluetooth management
This commit is contained in:
parent
6b1fc72b5e
commit
a79d71c70d
2 changed files with 46 additions and 52 deletions
|
@ -1203,7 +1203,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
// Brighten screen for at least 10 seconds
|
// Brighten screen for at least 10 seconds
|
||||||
if (mLc.getCallsNb() == 1) {
|
if (mLc.getCallsNb() == 1) {
|
||||||
requestAudioFocus(STREAM_RING);
|
requestAudioFocus(STREAM_RING);
|
||||||
BluetoothManager.getInstance().disableBluetoothSCO(); // Just in case
|
|
||||||
|
|
||||||
ringingCall = call;
|
ringingCall = call;
|
||||||
startRinging();
|
startRinging();
|
||||||
|
@ -1218,10 +1217,12 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
if (mLc.getCallsNb() == 1) {
|
if (mLc.getCallsNb() == 1) {
|
||||||
//It is for incoming calls, because outgoing calls enter MODE_IN_COMMUNICATION immediately when they start.
|
//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.
|
//However, incoming call first use the MODE_RINGING to play the local ring.
|
||||||
|
if(call.getDirection() == CallDirection.Incoming) {
|
||||||
setAudioManagerInCallMode();
|
setAudioManagerInCallMode();
|
||||||
mAudioManager.abandonAudioFocus(null);
|
mAudioManager.abandonAudioFocus(null);
|
||||||
requestAudioFocus(STREAM_VOICE_CALL);
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Hacks.needSoftvolume()) {
|
if (Hacks.needSoftvolume()) {
|
||||||
Log.w("Using soft volume audio hack");
|
Log.w("Using soft volume audio hack");
|
||||||
|
@ -1232,7 +1233,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
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();
|
||||||
if (mAudioFocused){
|
if (mAudioFocused) {
|
||||||
int res = mAudioManager.abandonAudioFocus(null);
|
int res = mAudioManager.abandonAudioFocus(null);
|
||||||
Log.d("Audio focus released a bit later: " + (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
|
Log.d("Audio focus released a bit later: " + (res == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? "Granted" : "Denied"));
|
||||||
mAudioFocused = false;
|
mAudioFocused = false;
|
||||||
|
@ -1293,13 +1294,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
public void startBluetooth() {
|
public void startBluetooth() {
|
||||||
if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
||||||
BluetoothManager.getInstance().routeAudioToBluetooth();
|
BluetoothManager.getInstance().routeAudioToBluetooth();
|
||||||
// Hack to ensure the bluetooth route is really used
|
|
||||||
mHandler.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
BluetoothManager.getInstance().routeAudioToBluetooth();
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue