title: Error android.system.ErrnoException: open failed: EACCES (Permission denied) How to solve the issue?
body: <p>I have the below function which worked recently until I upgrade to API 32. Now the code seems to be incompatible for API 32. it is aborting the execution at line saying file not found.</p>
  <pre><code>'FileOutputStream fileOutputStream = new FileOutputStream(file);' // going to exception 
  </code></pre>
  <p><em><strong>java.io.FileNotFoundException: /storage/emulated/0/Download/TnpVM==.jpg:
  open failed: EACCES (Permission denied)
  android.system.ErrnoException: open failed: EACCES (Permission denied)
  /storage/emulated/0/Download/TnpVM==.jpg: open failed: EACCES (Permission denied)</strong></em></p>
  <pre><code>public void onResponse(Call&lt;ResponseBody&gt; call, Response&lt;ResponseBody&gt; response) {
                          try {
                              String fileName = response.headers().get(&quot;content-disposition&quot;).split(&quot;filename=&quot;)[1];
                              File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
                              File file = new File(path, fileName);
                              InputStream inputStream = response.body().byteStream();
                              FileOutputStream fileOutputStream = new FileOutputStream(file);
                              IOUtils.copyStream(inputStream, fileOutputStream);
                              fileOutputStream.close();
                              subscriber.onNext(new LocalFile(file.getAbsolutePath(), response.headers().get(&quot;content-type&quot;)));
                          }
                          catch (Exception ex){
                              subscriber.onError(ex.getCause());
                          }
                      }
  </code></pre>
  <p>Any idea on how to solve this issue?</p>