From 1f77d5e1152976321a3bdbe8843992f8cb061bb1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 14 Jun 2020 16:22:53 +0200 Subject: [PATCH] pass selected audio device to proximity sensor toggle --- .../eu/siacs/conversations/ui/RtpSessionActivity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index a11f5b053..23a743eda 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -280,9 +280,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe this.mProximityWakeLock = null; } } - - private void putProximityWakeLockInProperState() { - if (requireRtpConnection().getAudioManager().getSelectedAudioDevice() == AppRTCAudioManager.AudioDevice.EARPIECE) { + + private void putProximityWakeLockInProperState(final AppRTCAudioManager.AudioDevice audioDevice) { + if (audioDevice == AppRTCAudioManager.AudioDevice.EARPIECE) { acquireProximityWakeLock(); } else { releaseProximityWakeLock(); @@ -1037,7 +1037,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe } else if (END_CARD.contains(endUserState)) { Log.d(Config.LOGTAG, "onAudioDeviceChanged() nothing to do because end card has been reached"); } else { - putProximityWakeLockInProperState(); + putProximityWakeLockInProperState(selectedAudioDevice); } } catch (IllegalStateException e) { Log.d(Config.LOGTAG, "RTP connection was not available when audio device changed");