title: Can't get any files from the downloads directory
body: <p>I am trying to build a simple gallery that shows all images from a certain directory <code>downloads/mCustomDir</code>.</p>
  
  <p>But even without trying to access this custom directory, and just trying to access the general downloads directory, I am getting no files back even though I know that there are files there.
  There seems to be a lot of changes in how to access storage in the last few months and a lot of things deprecated, so I am having a hard time understanding how to access these files properly.</p>
  
  <p>This is my function:</p>
  
  <pre><code>private fun loadSavedImages(dir: File?) {
      if (dir != null) {
          if (dir.exists()) {
              val files = dir.listFiles()
              if (files != null) {
                  val allPhotos = mutableListOf&lt;File&gt;()
                  Log.d("filesListSize", files.size.toString())
  
                  for (file in files) {
                      val absolutePath = file.absolutePath
  
                      val extension = absolutePath.substring(absolutePath.lastIndexOf("."))
                      if (acceptedExtensions.contains(extension)) {
                          allPhotos.add(file)
                      }
                  }
                  allPhotosViewModel.photosList.postValue(allPhotos)
              }
          }
      }
  }
  </code></pre>
  
  <p>Which I can on <code>onResume</code>:</p>
  
  <pre><code>override fun onResume() {
      super.onResume()
  
      if (hasNoPermissions(this)) {
          requestPermission(this, permissions)
      } else {
          if (isExternalStorageReadable()) {
              runOnUiThread {
                  loadSavedImages(getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS))
              }
          }
      }
  }
  </code></pre>
  
  <p>Bus the log keeps printing that the size of the files array is 0.</p>
  
  <p>When I use <code>Environment.getExternalStoragePublicDirectory</code> it works fine but it is deprecated and I'd rather it build by the best current standards.</p>