Enabling Bluetooth if available before ringback
This commit is contained in:
parent
aec92a3c50
commit
86795d0b0a
1 changed files with 16 additions and 11 deletions
|
@ -1099,6 +1099,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.d("[AudioManager] Mode: MODE_IN_COMMUNICATION");
|
Log.d("[AudioManager] Mode: MODE_IN_COMMUNICATION");
|
||||||
|
|
||||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1192,20 +1193,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
if (state == State.OutgoingInit) {
|
if (state == State.OutgoingInit) {
|
||||||
setAudioManagerInCallMode();
|
setAudioManagerInCallMode();
|
||||||
requestAudioFocus(STREAM_VOICE_CALL);
|
requestAudioFocus(STREAM_VOICE_CALL);
|
||||||
|
startBluetooth();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == State.StreamsRunning) {
|
if (state == State.StreamsRunning) {
|
||||||
if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
startBluetooth();
|
||||||
BluetoothManager.getInstance().routeAudioToBluetooth();
|
|
||||||
// Hack to ensure the bluetooth route is really used
|
|
||||||
mHandler.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
BluetoothManager.getInstance().routeAudioToBluetooth();
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mIncallWakeLock == null) {
|
if (mIncallWakeLock == null) {
|
||||||
mIncallWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "incall");
|
mIncallWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "incall");
|
||||||
}
|
}
|
||||||
|
@ -1218,6 +1210,19 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void startBluetooth() {
|
||||||
|
if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
||||||
|
BluetoothManager.getInstance().routeAudioToBluetooth();
|
||||||
|
// Hack to ensure the bluetooth route is really used
|
||||||
|
mHandler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
BluetoothManager.getInstance().routeAudioToBluetooth();
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void callStatsUpdated(final LinphoneCore lc, final LinphoneCall call, final LinphoneCallStats stats) {}
|
public void callStatsUpdated(final LinphoneCore lc, final LinphoneCall call, final LinphoneCallStats stats) {}
|
||||||
|
|
||||||
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
||||||
|
|
Loading…
Reference in a new issue