From ffe31a01aee23b928d332b1308584638cc17e580 Mon Sep 17 00:00:00 2001 From: uabdullah Date: Fri, 22 Jun 2018 13:03:39 -0700 Subject: Reset speaker mode when done with VVM Tab Bug: 110530781,78281972 Test: N/A PiperOrigin-RevId: 201729044 Change-Id: Id00e8e3e4ee89b846bce78f4a29d5e6f26384e0c --- .../android/dialer/app/calllog/VisualVoicemailCallLogFragment.java | 6 ++++++ .../android/dialer/app/voicemail/VoicemailPlaybackPresenter.java | 3 +++ 2 files changed, 9 insertions(+) (limited to 'java/com') diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java index 930edd186..5575cacc5 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java @@ -127,6 +127,12 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment { public void onPause() { voicemailPlaybackPresenter.onPause(); voicemailErrorManager.onPause(); + // Necessary to reset the speaker when leaving otherwise the platform will still remain in + // speaker mode + AudioManager audioManager = getContext().getSystemService(AudioManager.class); + if (audioManager.isSpeakerphoneOn()) { + audioManager.setSpeakerphoneOn(false); + } super.onPause(); } diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java index 6d1728f34..6fc8d23e3 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java +++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.Intent; import android.database.ContentObserver; import android.database.Cursor; +import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.AsyncTask; @@ -207,6 +208,8 @@ public class VoicemailPlaybackPresenter position = savedInstanceState.getInt(CLIP_POSITION_KEY, 0); isPlaying = savedInstanceState.getBoolean(IS_PLAYING_STATE_KEY, false); isSpeakerphoneOn = savedInstanceState.getBoolean(IS_SPEAKERPHONE_ON_KEY, false); + AudioManager audioManager = activity.getSystemService(AudioManager.class); + audioManager.setSpeakerphoneOn(isSpeakerphoneOn); } if (mediaPlayer == null) { -- cgit v1.2.3