From cbf2e84ba7944b185d06de4c8a4cfdea0b5f56ed Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 14 Jan 2025 12:47:36 +0100 Subject: [PATCH 1/2] fix Signed-off-by: alperozturk --- .../owncloud/android/utils/PermissionUtil.kt | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt b/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt index e81ba03c0c8d..85ed98c44908 100644 --- a/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt +++ b/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt @@ -313,14 +313,24 @@ object PermissionUtil { */ @JvmStatic fun requestMediaLocationPermission(activity: Activity) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - if (!checkSelfPermission(activity, Manifest.permission.ACCESS_MEDIA_LOCATION)) { - ActivityCompat.requestPermissions( - activity, - arrayOf(Manifest.permission.ACCESS_MEDIA_LOCATION), - PERMISSIONS_MEDIA_LOCATION - ) - } + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + return + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && Environment.isExternalStorageManager()) { + return + } + + if (checkSelfPermission(activity, Manifest.permission.ACCESS_MEDIA_LOCATION)) { + return } + + ActivityCompat.requestPermissions( + activity, + arrayOf(Manifest.permission.ACCESS_MEDIA_LOCATION), + PERMISSIONS_MEDIA_LOCATION + ) + + } } From 75b20f84e0e23300d9c96b5a2fa83b8df98b1e5b Mon Sep 17 00:00:00 2001 From: alperozturk Date: Tue, 14 Jan 2025 12:49:35 +0100 Subject: [PATCH 2/2] remove empty lines Signed-off-by: alperozturk --- app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt b/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt index 85ed98c44908..3d35656655d7 100644 --- a/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt +++ b/app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt @@ -330,7 +330,5 @@ object PermissionUtil { arrayOf(Manifest.permission.ACCESS_MEDIA_LOCATION), PERMISSIONS_MEDIA_LOCATION ) - - } }