diff options
-rw-r--r-- | src/com/android/incallui/VideoCallPresenter.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/incallui/VideoCallPresenter.java b/src/com/android/incallui/VideoCallPresenter.java index 19ad3f4c..373cf625 100644 --- a/src/com/android/incallui/VideoCallPresenter.java +++ b/src/com/android/incallui/VideoCallPresenter.java @@ -544,10 +544,15 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi // If the speaker is explicitly disabled then do not enable it. if (SystemProperties.getInt(PROPERTY_IMS_AUDIO_OUTPUT, IMS_AUDIO_OUTPUT_DEFAULT) != IMS_AUDIO_OUTPUT_DISABLE_SPEAKER) { - Log.d(this, "Routing audio to speaker"); - mPreVideoAudioMode = AudioModeProvider.getInstance().getAudioMode(); - TelecomAdapter.getInstance().setAudioRoute(AudioState.ROUTE_SPEAKER); + int currentAudioMode = AudioModeProvider.getInstance().getAudioMode(); + if (!isAudioRouteEnabled(currentAudioMode, + AudioState.ROUTE_BLUETOOTH | AudioState.ROUTE_WIRED_HEADSET)) { + mPreVideoAudioMode = currentAudioMode; + + Log.d(this, "Routing audio to speaker"); + TelecomAdapter.getInstance().setAudioRoute(AudioState.ROUTE_SPEAKER); + } } } @@ -886,6 +891,10 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi ui.setDisplayVideoSize(size.x, size.y); } + private static boolean isAudioRouteEnabled(int audioRoute, int audioRouteMask) { + return ((audioRoute & audioRouteMask) != 0); + } + /** * Defines the VideoCallUI interactions. */ |