Skip to content

Commit 6811ec6

Browse files
committed
Enforce a minimum Android API level of 21 in VfsImplementationSaf.java
1 parent ac5c473 commit 6811ec6

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

libretro-common/vfs/saf/src/com/libretro/common/vfs/VfsImplementationSaf.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import android.content.ContentResolver;
2626
import android.database.Cursor;
2727
import android.net.Uri;
28+
import android.os.Build;
2829
import android.provider.DocumentsContract;
2930
import android.provider.DocumentsContract.Document;
3031

@@ -52,6 +53,8 @@ public final class VfsImplementationSaf
5253
*/
5354
public static int openSafFile(ContentResolver content, String tree, String path, boolean read, boolean write, boolean truncate)
5455
{
56+
if (Build.VERSION.SDK_INT < 21)
57+
return -1;
5558
boolean createdFile = false;
5659
while (true)
5760
{
@@ -126,6 +129,8 @@ else if (!read)
126129
*/
127130
public static boolean removeSafFile(ContentResolver content, String tree, String path)
128131
{
132+
if (Build.VERSION.SDK_INT < 21)
133+
return false;
129134
final Uri treeUri = Uri.parse(tree);
130135
try
131136
{
@@ -176,6 +181,8 @@ public static class SafStat
176181
*/
177182
public SafStat(ContentResolver content, String tree, String path, boolean includeSize)
178183
{
184+
if (Build.VERSION.SDK_INT < 21)
185+
return;
179186
final Uri treeUri = Uri.parse(tree);
180187
try
181188
{
@@ -246,6 +253,8 @@ public long getSize()
246253
*/
247254
public static int mkdirSaf(ContentResolver content, String tree, String path)
248255
{
256+
if (Build.VERSION.SDK_INT < 21)
257+
return -1;
249258
final Uri treeUri = Uri.parse(tree);
250259
final Path directoryPath;
251260
try
@@ -320,6 +329,8 @@ public static class SafDirectory implements Closeable
320329
*/
321330
public SafDirectory(ContentResolver content, String tree, String path)
322331
{
332+
if (Build.VERSION.SDK_INT < 21)
333+
return;
323334
final Uri treeUri = Uri.parse(tree);
324335
try
325336
{
@@ -355,6 +366,8 @@ public void close()
355366
*/
356367
public boolean readdir()
357368
{
369+
if (Build.VERSION.SDK_INT < 21)
370+
return false;
358371
if (cursor == null)
359372
return false;
360373
if (cursor.moveToNext())

0 commit comments

Comments
 (0)