playback: rework audio focus

Rework audio focus to rely on the native ExoPlayer implementation
instead of a custom implementation.

Previously, we avoided ExoPlayer's AudioFocus system as it never
played after a transient lost. A few versions later now through,
now it does, so we may as well switch to it. This does introduce
a bug where ReplayGain functionality will conflict with audio
focus, but I hope to eliminate this with #115 as I switch to
an AudioProcessor instead of a callback.
This commit is contained in:
OxygenCobalt
2022-03-27 11:51:58 -06:00
parent e54a58c612
commit b748d73abb
37 changed files with 33 additions and 175 deletions
@@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurface"
android:orientation="vertical"
tools:context=".settings.AboutFragment">
@@ -5,7 +5,6 @@
android:id="@+id/queue_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical">
<org.oxycblt.auxio.ui.EdgeAppBarLayout
@@ -5,7 +5,6 @@
android:id="@+id/settings_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical">
<org.oxycblt.auxio.ui.EdgeAppBarLayout
+1 -3
View File
@@ -2,10 +2,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurface">
android:layout_height="wrap_content">
<View
android:id="@+id/background"
@@ -81,8 +81,6 @@
<string name="set_alt_shuffle">تفضيل نشاط الخلط</string>
<string name="set_audio">صوتيات</string>
<string name="set_focus">تركيز الصوت</string>
<string name="set_focus_desc">ايقاف مؤقت عند تشغيل صوت آخر (كالمكالمات)</string>
<string name="set_replay_gain">صخب الصوت (تجريبي)</string>
<string name="set_off">اطفاء</string>
<string name="set_replay_gain_track">تفضيل المقطع</string>
-2
View File
@@ -65,8 +65,6 @@
<string name="set_alt_loop">"Preferovat akci režimu opakování"</string>
<string name="set_alt_shuffle">"Preferovat akci náhodného přehrávání"</string>
<string name="set_audio">"Zvuk"</string>
<string name="set_focus">"Zaměření zvuku"</string>
<string name="set_focus_desc">Pozastavit při přehrávání jiného zvuku (např. hovor)</string>
<string name="set_behavior">"Chování"</string>
<string name="set_song_mode">"Když je vybrána skladba"</string>
<string name="set_keep_shuffle">"Zapamatovat si náhodné přehrávání"</string>
-2
View File
@@ -71,8 +71,6 @@
<string name="set_alt_shuffle">Zufällig-Aktionstaste bevorzugen</string>
<string name="set_audio">Audio</string>
<string name="set_focus">Audiofokus</string>
<string name="set_focus_desc">Pausieren wenn andere Töne abspielt wird [Bsp. Anrufe]</string>
<string name="set_headset_autoplay">Kopfhörer automatische Wiedergabe</string>
<string name="set_headset_autoplay_desc">Beginne die Wiedergabe immer, wenn Kopfhörer verbunden sind (funktioniert nicht auf allen Geräten)</string>
<string name="set_replay_gain">ReplayGain (Experimentell)</string>
-2
View File
@@ -81,8 +81,6 @@
<string name="set_alt_shuffle">Preferir acción de mezcla</string>
<string name="set_audio">Sonido</string>
<string name="set_focus">Enfoque de sonido</string>
<string name="set_focus_desc">Pausar cuando se reproduce otro sonido (Ej: llamadas)</string>
<string name="set_replay_gain">ReplayGain (Experimental)</string>
<string name="set_off">Desactivado</string>
<string name="set_replay_gain_track">Por pista</string>
-1
View File
@@ -49,7 +49,6 @@
<string name="set_quality_covers">Ignorer le stockage des pochettes</string>
<string name="set_audio">Audio</string>
<string name="set_focus">Audio Focus</string>
<string name="set_behavior">Comportement</string>
-1
View File
@@ -40,7 +40,6 @@
<string name="set_accent">एक्सेंट</string>
<string name="set_audio">ऑडियो</string>
<string name="set_focus">ऑडियो फोकस</string>
<string name="set_behavior">चाल चलन</string>
-1
View File
@@ -48,7 +48,6 @@
<string name="set_quality_covers">A médiatár albumborítók figyelmen kívül hagyása</string>
<string name="set_audio">Hang</string>
<string name="set_focus">Hangfókusz</string>
<string name="set_behavior">Működés</string>
-1
View File
@@ -48,7 +48,6 @@
<string name="set_quality_covers">Abaikan sampul-sampul pada Media Penyimpanan</string>
<string name="set_audio">Audio</string>
<string name="set_focus">Fokus audio</string>
<string name="set_behavior">Perilaku</string>
<string name="set_keep_shuffle">Ingat putar acak</string>
-1
View File
@@ -49,7 +49,6 @@
<string name="set_quality_covers">Ignora le copertine del Media Store</string>
<string name="set_audio">Audio</string>
<string name="set_focus">Focus audio</string>
<string name="set_behavior">Comportamento</string>
<string name="set_keep_shuffle">Ricorda casuale</string>
-1
View File
@@ -47,7 +47,6 @@
<string name="set_quality_covers">미디어 스토어 앨범 커버 무시</string>
<string name="set_audio">오디오</string>
<string name="set_focus">오디오 포커스</string>
<string name="set_behavior">동작</string>
-2
View File
@@ -70,8 +70,6 @@
<string name="set_alt_shuffle">Voorkeur aan shuffle actie</string>
<string name="set_audio">Audio</string>
<string name="set_focus">Audiofocus</string>
<string name="set_focus_desc">Pauze wanneer andere audio speelt (ex. Gesprekken)</string>
<string name="set_behavior">Gedrag</string>
<string name="set_song_mode">Wanneer een liedje is geselecteerd</string>
-1
View File
@@ -48,7 +48,6 @@
<string name="set_quality_covers">Ignoruj okładki z Media Store</string>
<string name="set_audio">Dźwięk</string>
<string name="set_focus">Wyciszanie otoczenia</string>
<string name="set_behavior">Zachowanie</string>
@@ -48,7 +48,6 @@
<string name="set_quality_covers">Ignorar capas Media Store</string>
<string name="set_audio">Áudio</string>
<string name="set_focus">Foco do áudio</string>
<string name="set_behavior">Comportamento</string>
<string name="set_keep_shuffle">Memorizar aleatorização</string>
@@ -49,7 +49,6 @@
<string name="set_quality_covers">Ignorar capas Media Store</string>
<string name="set_audio">Áudio</string>
<string name="set_focus">Foco de áudio</string>
<string name="set_behavior">Comportamento</string>
<string name="set_keep_shuffle">Memorizar aleatorização</string>
-1
View File
@@ -49,7 +49,6 @@
<string name="set_quality_covers">Ignoră coperțile Media Store</string>
<string name="set_audio">Audio</string>
<string name="set_focus">Concentrare audio</string>
<string name="set_behavior">Comportament</string>
-2
View File
@@ -81,8 +81,6 @@
<string name="set_alt_shuffle">Режим перемешивания</string>
<string name="set_audio">Звук</string>
<string name="set_focus">Аудио-фокус</string>
<string name="set_focus_desc">Ставить на паузу при звонках</string>
<string name="set_replay_gain">ReplayGain (экспериментально)</string>
<string name="set_off">Выкл.</string>
<string name="set_replay_gain_track">По треку</string>
-1
View File
@@ -48,7 +48,6 @@
<string name="set_quality_covers">Medya Deposu albüm kapağını yoksay</string>
<string name="set_audio">Ses</string>
<string name="set_focus">Ses odaklama</string>
<string name="set_behavior">Tercihler</string>
-1
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="enable_theme_settings">false</bool>
<bool name="enable_audio_focus_setting">false</bool>
</resources>
@@ -80,8 +80,6 @@
<string name="set_alt_shuffle">偏好随机播放操作</string>
<string name="set_audio">音频</string>
<string name="set_focus">音频焦点</string>
<string name="set_focus_desc">有其它音频播放(比如电话)时暂停</string>
<string name="set_headset_autoplay">自动播放</string>
<string name="set_headset_autoplay_desc">连接至耳机时总是自动播放(并非在所有设备上都有用)</string>
<string name="set_replay_gain">回放增益(实验性)</string>
@@ -47,7 +47,6 @@
<string name="set_quality_covers">忽略音訊檔內嵌的專輯封面</string>
<string name="set_audio">音訊</string>
<string name="set_focus">音頻焦點</string>
<string name="set_behavior">行為</string>
<string name="set_keep_shuffle">記住隨機播放</string>
-1
View File
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="enable_theme_settings">true</bool>
<bool name="enable_audio_focus_setting">true</bool>
<integer name="recycler_spans">1</integer>
</resources>
-2
View File
@@ -80,8 +80,6 @@
<string name="set_alt_shuffle">Prefer shuffle action</string>
<string name="set_audio">Audio</string>
<string name="set_focus">Audio focus</string>
<string name="set_focus_desc">Pause when other audio plays (ex. Calls)</string>
<string name="set_headset_autoplay">Headset autoplay</string>
<string name="set_headset_autoplay_desc">Always start playing when a headset is connected (may not work on all devices)</string>
<string name="set_replay_gain">ReplayGain (Experimental)</string>
-8
View File
@@ -78,14 +78,6 @@
app:layout="@layout/item_header"
app:title="@string/set_audio">
<org.oxycblt.auxio.settings.pref.M3SwitchPreference
app:defaultValue="true"
app:iconSpaceReserved="false"
app:isPreferenceVisible="@bool/enable_audio_focus_setting"
app:key="KEY_AUDIO_FOCUS"
app:summary="@string/set_focus_desc"
app:title="@string/set_focus" />
<org.oxycblt.auxio.settings.pref.M3SwitchPreference
app:defaultValue="false"
app:iconSpaceReserved="false"