Skip to content

Commit

Permalink
Adding new AudioManager Android API
Browse files Browse the repository at this point in the history
As eurekasource has moved to using Android O sdk, exposing the new
requestAudioFocus() and abandonAudioFocusRequest() in CastAudioManager.

Bug: 7942044
Test: Verified that request focus and ducking still works.
Change-Id: I60f4109c635dd1047db24071868e2084ec98d169
Reviewed-on: https://chromium-review.googlesource.com/1144520
Commit-Queue: Shyamsundar Parthasarathy <shyamsundarp@chromium.org>
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576934}
  • Loading branch information
shyam authored and Commit Bot committed Jul 20, 2018
1 parent 318233c commit ed6f1b5
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

package org.chromium.chromecast.shell;

import android.annotation.SuppressLint;
import android.content.Context;
import android.media.AudioFocusRequest;
import android.media.AudioManager;
import android.os.Build;

Expand Down Expand Up @@ -105,14 +107,22 @@ public void releaseStreamMuteIfNecessary(int streamType) {
}
}

// TODO(sanfin): Use the AudioFocusRequest version on O and above.
@SuppressLint("NewApi")
public int requestAudioFocus(AudioFocusRequest focusRequest) {
return mAudioManager.requestAudioFocus(focusRequest);
}

@SuppressWarnings("deprecation")
public int requestAudioFocus(
AudioManager.OnAudioFocusChangeListener l, int streamType, int durationHint) {
return mAudioManager.requestAudioFocus(l, streamType, durationHint);
}

// TODO(sanfin): Use the AudioFocusRequest version on O and above.
@SuppressLint("NewApi")
public int abandonAudioFocusRequest(AudioFocusRequest focusRequest) {
return mAudioManager.abandonAudioFocusRequest(focusRequest);
}

@SuppressWarnings("deprecation")
public int abandonAudioFocus(AudioManager.OnAudioFocusChangeListener l) {
return mAudioManager.abandonAudioFocus(l);
Expand Down

0 comments on commit ed6f1b5

Please sign in to comment.