diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6e46afc01..c0beb16f9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ + android:maxSdkVersion="29" /> Unit) { val request = PermissionRequestBuilder().apply(builder).build() - if (permission == Manifest.permission.WRITE_EXTERNAL_STORAGE && Build.VERSION.SDK_INT >= 29) { - // We do not need external rw on 29+ + if (permission == WRITE_EXTERNAL_STORAGE && Build.VERSION.SDK_INT >= 30) { + // We do not need external rw on 30+ request.onSuccess() return } @@ -64,7 +64,7 @@ abstract class BaseActivity : AppCompatActivity() { } fun withExternalRW(builder: PermissionRequestBuilder.() -> Unit) { - withPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, builder = builder) + withPermission(WRITE_EXTERNAL_STORAGE, builder = builder) } override fun onRequestPermissionsResult( diff --git a/app/src/main/java/com/topjohnwu/magisk/core/utils/MediaStoreUtils.kt b/app/src/main/java/com/topjohnwu/magisk/core/utils/MediaStoreUtils.kt index d28f9b880..f50da38cd 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/utils/MediaStoreUtils.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/utils/MediaStoreUtils.kt @@ -66,8 +66,8 @@ object MediaStoreUtils { } private fun queryFile(displayName: String): UriFile? { - if (Build.VERSION.SDK_INT < 29) { - // Before official general purpose MediaStore API exists, fallback to file based I/O + if (Build.VERSION.SDK_INT < 30) { + // Fallback to file based I/O pre Android 11 val parent = File(Environment.getExternalStorageDirectory(), relativePath) parent.mkdirs() return LegacyUriFile(File(parent, displayName))