[Android] Fix crash on API < 21 when opening the video control settings

Nicolas Pomepuy git at videolan.org
Thu Mar 6 14:19:45 UTC 2025


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Mar  6 14:09:51 2025 +0100| [a3b536b530056e2cc936ce6753b9c30660a5ea79] | committer: Nicolas Pomepuy

Fix crash on API < 21 when opening the video control settings

Fixes #3171

> https://code.videolan.org/videolan/vlc-android/commit/a3b536b530056e2cc936ce6753b9c30660a5ea79
---

 .../src/org/videolan/vlc/gui/preferences/PreferencesVideoControls.kt  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideoControls.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideoControls.kt
index 1be6d616d9..98caff20ae 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideoControls.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideoControls.kt
@@ -24,6 +24,7 @@ package org.videolan.vlc.gui.preferences
 
 import android.content.SharedPreferences
 import android.media.AudioManager
+import android.os.Build
 import android.os.Bundle
 import androidx.core.content.getSystemService
 import androidx.preference.CheckBoxPreference
@@ -49,7 +50,6 @@ import org.videolan.tools.Settings
 import org.videolan.tools.VIDEO_HUD_TIMEOUT
 import org.videolan.tools.coerceInOrDefault
 import org.videolan.vlc.R
-import org.videolan.vlc.gui.helpers.UiTools
 import org.videolan.vlc.gui.video.VideoPlayerActivity
 
 class PreferencesVideoControls : BasePreferenceFragment(), SharedPreferences.OnSharedPreferenceChangeListener  {
@@ -79,7 +79,7 @@ class PreferencesVideoControls : BasePreferenceFragment(), SharedPreferences.OnS
 
         updateHudTimeoutSummary()
         val audiomanager = requireActivity().getSystemService<AudioManager>()!!
-        if (audiomanager.isVolumeFixed) {
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP || audiomanager.isVolumeFixed) {
             audioBoostPref?.isChecked = false
             audioBoostPref?.isEnabled = false
             audioBoostPref?.summary = getString(R.string.system_volume_disabled, audioBoostPref?.summary)



More information about the Android mailing list