[Android] Fix a permission state in the dialog for Android 12

Nicolas Pomepuy git at videolan.org
Mon Nov 25 11:07:02 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Nov 25 11:24:10 2024 +0100| [a3c8b604b2cd88fbdc2e0796fb43b18dfcf49aec] | committer: Duncan McNamara

Fix a permission state in the dialog for Android 12

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

 .../src/org/videolan/vlc/gui/dialogs/PermissionListDialog.kt       | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PermissionListDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PermissionListDialog.kt
index 4cdb0d586f..027ced2f4a 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PermissionListDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/PermissionListDialog.kt
@@ -40,6 +40,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDE
 import kotlinx.coroutines.launch
 import org.videolan.resources.AndroidDevices
 import org.videolan.resources.SCHEME_PACKAGE
+import org.videolan.resources.util.isExternalStorageManager
 import org.videolan.tools.dp
 import org.videolan.tools.setGone
 import org.videolan.tools.setInvisible
@@ -193,7 +194,7 @@ class PermissionListDialog : VLCBottomSheetDialogFragment() {
         }
 
         binding.manageAllPermsCheck.setOnClickListener {
-            if (Permissions.hasAnyFileFineAccess(requireActivity())) {
+            if (!Permissions.hasAllAccess(requireActivity()) && Permissions.hasAnyFileFineAccess(requireActivity())) {
                 (it as RadioButton).isChecked = false
                 binding.manageMediaPermsCheck.background  = ContextCompat.getDrawable(requireActivity(), R.drawable.rounded_corners_permissions_warning)
                 showWarning()
@@ -221,10 +222,10 @@ class PermissionListDialog : VLCBottomSheetDialogFragment() {
         }
 
         binding.manageMediaPermsCheck.setOnClickListener {
-            if (Permissions.hasAnyFileFineAccess(requireActivity())) {
+            if (!isExternalStorageManager() && Permissions.hasAnyFileFineAccess(requireActivity())) {
                 Permissions.showAppSettingsPage(requireActivity())
                 (it as RadioButton).isChecked = false
-            } else if (Permissions.canReadStorage(requireActivity())) {
+            } else if (!isExternalStorageManager() && Permissions.canReadStorage(requireActivity())) {
                 Permissions.showAppSettingsPage(requireActivity())
                 (it as RadioButton).isChecked = false
             } else if (Permissions.hasAllAccess(requireActivity())) {



More information about the Android mailing list