Update PlaybackHandler.java

This commit is contained in:
Doozy 2022-05-05 15:13:01 +03:00
parent 37aa73879c
commit f86c30c608

View file

@ -36,6 +36,8 @@ class PlaybackHandler extends Handler {
@NonNull private final WeakReference<MusicService> mService;
private float currentDuckVolume = 1.0f;
private boolean sFocusEnabled = PreferenceUtil.INSTANCE.isAudioFocusEnabled();
PlaybackHandler(final MusicService service, @NonNull final Looper looper) {
super(looper);
@ -146,7 +148,10 @@ class PlaybackHandler extends Handler {
case AudioManager.AUDIOFOCUS_LOSS:
// Lost focus for an unbounded amount of time: stop playback and release media playback
boolean isAudioFocusEnabled = PreferenceUtil.INSTANCE.isAudioFocusEnabled();
if (!isAudioFocusEnabled) {
service.forcePause();
}
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: