Some fix for Bluetooth management

This commit is contained in:
Erwan Croze 2017-03-27 13:37:26 +02:00
parent 6b1fc72b5e
commit a79d71c70d
2 changed files with 46 additions and 52 deletions

View file

@ -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");
@ -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);
} }
} }