Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b22f7d6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Route speaker via speaker and headset when tapping speaker button in NUI VM"

parents 328494b2 8392f80d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.media.AudioManager;
import android.net.Uri;
import android.provider.VoicemailContract;
import android.provider.VoicemailContract.Voicemails;
@@ -452,6 +453,19 @@ public final class NewVoicemailMediaPlayerView extends LinearLayout {
              "NewVoicemailMediaPlayer.speakerButtonListener",
              "speaker request for voicemailUri: %s",
              voicemailUri.toString());
          AudioManager audioManager =
              (AudioManager) getContext().getSystemService(AudioManager.class);
          audioManager.setMode(AudioManager.STREAM_MUSIC);
          if (audioManager.isSpeakerphoneOn()) {
            LogUtil.i(
                "NewVoicemailMediaPlayer.phoneButtonListener", "speaker was on, turning it off");
            audioManager.setSpeakerphoneOn(false);
          } else {
            LogUtil.i(
                "NewVoicemailMediaPlayer.phoneButtonListener", "speaker was off, turning it on");
            audioManager.setSpeakerphoneOn(true);
          }
          // TODO(uabdullah): Handle colors of speaker icon when speaker is on and off.
        }
      };