playback: disable audio focus setting on api 31

Disable the ability to customize audio focus on Android 12 and up.

Android 12 automatically regulates audio streams even further than it
did in previous versions, to the point where the audio focus setting
no longer makes sense on that version. I may extend the removal to all
versions in the future.
This commit is contained in:
OxygenCobalt
2022-02-15 06:33:21 -07:00
parent 30ad7f99db
commit 5b57d77d02
6 changed files with 8 additions and 2 deletions
@@ -127,7 +127,6 @@ class PlaybackFragment : Fragment() {
}
binding.playbackLoop.setImageResource(resId)
binding.playbackLoop.isActivated = loopMode != LoopMode.NONE
}
playbackModel.position.observe(viewLifecycleOwner) { pos ->
@@ -20,6 +20,7 @@ package org.oxycblt.auxio.playback.system
import android.content.Context
import android.media.AudioManager
import android.os.Build
import androidx.core.math.MathUtils
import androidx.media.AudioAttributesCompat
import androidx.media.AudioFocusRequestCompat
@@ -233,7 +234,7 @@ class AudioReactor(
// --- INTERNAL AUDIO FOCUS ---
override fun onAudioFocusChange(focusChange: Int) {
if (!settingsManager.doAudioFocus) {
if (!settingsManager.doAudioFocus && Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
// Don't do audio focus if its not enabled
return
}
+1
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="enable_theme_settings">false</bool>
<bool name="enable_audio_focus_setting">false</bool>
</resources>
+1
View File
@@ -1,5 +1,6 @@
<?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>
+1
View File
@@ -82,6 +82,7 @@
app:defaultValue="true"
app:iconSpaceReserved="false"
app:key="KEY_AUDIO_FOCUS"
app:isPreferenceVisible="@bool/enable_audio_focus_setting"
app:summary="@string/set_focus_desc"
app:title="@string/set_focus" />