Skip to content

Commit

Permalink
Sound mode management fix in Android client
Browse files Browse the repository at this point in the history
Correct audio stream routing management in Android appears to be quite
tricky when bluetooth and wired headsets are taken in account. But now
it seems to be ok in general. The only drawback is that if headset is
disconnected then active server connection should be re-established to
restore proper audio mode.
  • Loading branch information
poretsky committed Jul 5, 2020
1 parent 0099067 commit 61c40e3
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1405,12 +1405,15 @@ public void onClick(DialogInterface dialog, int whichButton) {
return true;
}

@SuppressWarnings("deprecation")
private void adjustSoundSystem(SharedPreferences prefs) {
if (audioManager.isBluetoothA2dpOn())
return;
boolean voiceProcessing = prefs.getBoolean(Preferences.PREF_SOUNDSYSTEM_VOICEPROCESSING, false);
audioManager.setMode(voiceProcessing ?
AudioManager.MODE_IN_COMMUNICATION : AudioManager.MODE_NORMAL);
if (voiceProcessing)
audioManager.setSpeakerphoneOn(prefs.getBoolean(Preferences.PREF_SOUNDSYSTEM_SPEAKERPHONE, false));
audioManager.setSpeakerphoneOn(prefs.getBoolean(Preferences.PREF_SOUNDSYSTEM_SPEAKERPHONE, false) && !audioManager.isWiredHeadsetOn());
}

private void adjustMuteButton(ImageButton btn) {
Expand Down

0 comments on commit 61c40e3

Please sign in to comment.