Skip to content

When using an external SD Card in Android 15, there will be problems listing files in the directory #650

@yiharng

Description

@yiharng

Bug Report

Problem

The following code will cause an error in Android 15 when using an external SD Card

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function()
{
  window.resolveLocalFileSystemURL("file:///storage/0000-0000/Android/data/xxx.xxx.xxx.xxx/files",function(d)
  {
    d.createReader().readEntries(function(ok)
    {
       console.log("ok");
    },function(err)
    {
       console.log("err");
    });
  },errfunc);
},errfunc);

I modified FileUtils.java in the source code as shown below. After adding annotations, the program can run normally. However, this modification method is not ideal.

        } else if (action.equals("readEntries")) {
            threadhelper(new FileOp() {
                public void run(JSONArray args) throws FileNotFoundException, JSONException, MalformedURLException, IOException {
                    String directory = args.getString(0);
                    String nativeURL = resolveLocalFileSystemURI(directory).getString("nativeURL");
/*                    
                    if (needPermission(nativeURL, READ)) {
                        getReadPermission(rawArgs, ACTION_READ_ENTRIES, callbackContext);
                    } else {
*/                    
                        JSONArray entries = readEntries(directory);
                        callbackContext.success(entries);
//                    }
                }
            }, rawArgs, callbackContext);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions