incorrect merge

This commit is contained in:
Koen Rabaey 2014-04-22 22:46:36 +02:00
parent 95b44b493a
commit e2aeb0af70

View file

@ -14,20 +14,29 @@ import android.media.AudioManager;
*
* @author genly
*/
public class AudioFocusHelperImpl implements AudioManager.OnAudioFocusChangeListener, AudioFocusHelper {
private static final Log log = PlatformUtil.getLog(AudioFocusHelperImpl.class);
public class AudioFocusHelperImpl implements AudioManager.OnAudioFocusChangeListener, AudioFocusHelper
{
private static final Log log = PlatformUtil.getLog(AudioFocusHelperImpl.class);
@Override
public boolean requestFocus(Context context, int streamType) {
AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus(this, streamType,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
}
@Override
public boolean requestFocus(Context context, int streamType)
{
AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if (((OsmandApplication) context.getApplicationContext()).getSettings().INTERRUPT_MUSIC.get())
{
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus(this, streamType, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
}
else
{
return true;
}
}
@Override
public boolean abandonFocus(Context context, int streamType) {
AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if (((OsmandApplication)context.getApplicationContext()).getSettings().INTERRUPT_MUSIC.get())
@Override
public boolean abandonFocus(Context context, int streamType)
{
AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if (((OsmandApplication) context.getApplicationContext()).getSettings().INTERRUPT_MUSIC.get())
{
return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.abandonAudioFocus(this);
}
@ -35,13 +44,14 @@ public class AudioFocusHelperImpl implements AudioManager.OnAudioFocusChangeList
{
return true;
}
}
}
@Override
public void onAudioFocusChange(int focusChange) {
// Basically we ignore audio focus changes. There's not much we can do when we have interrupted audio
// for our speech, and we in turn get interrupted. Ignore it until a scenario comes up which gives us
// reason to change this strategy.
log.error("MediaCommandPlayerImpl.onAudioFocusChange(): Unexpected audio focus change: " + focusChange);
}
@Override
public void onAudioFocusChange(int focusChange)
{
// Basically we ignore audio focus changes. There's not much we can do when we have interrupted audio
// for our speech, and we in turn get interrupted. Ignore it until a scenario comes up which gives us
// reason to change this strategy.
log.error("MediaCommandPlayerImpl.onAudioFocusChange(): Unexpected audio focus change: " + focusChange);
}
}