Merge "Audio focus: fix mapping of old requestAudioFocus to AudioFocusRequest" into oc-dev

This commit is contained in:
Jean-Michel Trivi
2017-05-01 19:50:38 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 1 deletions

View File

@@ -356,6 +356,20 @@ public final class AudioFocusRequest {
return this;
}
/**
* @hide
* Internal listener setter, no null checks on listener nor handler
* @param listener
* @param handler
* @return this {@code Builder} instance.
*/
@NonNull Builder setOnAudioFocusChangeListenerInt(
OnAudioFocusChangeListener listener, Handler handler) {
mFocusListener = listener;
mListenerHandler = handler;
return this;
}
/**
* Sets the listener called when audio focus changes after being requested with
* {@link AudioManager#requestAudioFocus(AudioFocusRequest)}, and until being abandoned

View File

@@ -2445,7 +2445,7 @@ public class AudioManager {
}
final AudioFocusRequest afr = new AudioFocusRequest.Builder(durationHint)
.setOnAudioFocusChangeListener(l, null /* no Handler for this legacy API */)
.setOnAudioFocusChangeListenerInt(l, null /* no Handler for this legacy API */)
.setAudioAttributes(requestAttributes)
.setAcceptsDelayedFocusGain((flags & AUDIOFOCUS_FLAG_DELAY_OK)
== AUDIOFOCUS_FLAG_DELAY_OK)