From 54ef1fce4a71b1a9a5f669e67491ff0d8844a2f8 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 5 Aug 2011 16:15:59 +0200 Subject: [PATCH] Fix hack to workaround Galaxy S speaker/mic issue. --- src/org/linphone/LinphoneManager.java | 28 ++++++++++++++------------- submodules/linphone | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 6a2f14cef..20fa2897f 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -144,15 +144,12 @@ public final class LinphoneManager implements LinphoneCoreListener { private BroadcastReceiver mKeepAliveReceiver = new KeepAliveReceiver(); - private synchronized void routeAudioToSpeakerHelper(boolean speakerOn) { - LinphoneCall call = mLc.getCurrentCall(); - boolean paused = false; - if (call != null && call.getState() == State.StreamsRunning && Hacks.needPausingCallForSpeakers()) { - Log.d("Hack pausing call to have speaker=",speakerOn); - mLc.pauseCall(call); - paused = true; - } - + private native void hackSpeakerState(boolean speakerOn); + @SuppressWarnings("unused") + private static void sRouteAudioToSpeakerHelperHelper(boolean speakerOn) { + getInstance().routeAudioToSpeakerHelperHelper(speakerOn); + } + private void routeAudioToSpeakerHelperHelper(boolean speakerOn) { if (Hacks.needGalaxySAudioHack() || lpm.useGalaxySHack()) setAudioModeIncallForGalaxyS(); @@ -167,12 +164,17 @@ public final class LinphoneManager implements LinphoneCoreListener { } else { mAudioManager.setSpeakerphoneOn(speakerOn); } - - if (paused) { - Log.d("Hack resuming call to have speaker=",speakerOn); - mLc.resumeCall(call); + } + private synchronized void routeAudioToSpeakerHelper(boolean speakerOn) { + final LinphoneCall call = mLc.getCurrentCall(); + if (call != null && call.getState() == State.StreamsRunning && Hacks.needPausingCallForSpeakers()) { + Log.d("Hack to have speaker=",speakerOn," while on call"); + hackSpeakerState(speakerOn); + } else { + routeAudioToSpeakerHelperHelper(speakerOn); } } + public void routeAudioToSpeaker() { routeAudioToSpeakerHelper(true); diff --git a/submodules/linphone b/submodules/linphone index 743ef7d0c..68df42b29 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 743ef7d0cf511161ff4c2300315df775e601bae3 +Subproject commit 68df42b2924930043bbf466b0c6eab1409fb6c3e