title: Try to open a file referenced by another one on Android
body: <p>Imagine I'm openeing a file using the standard Intent.ACTION_OPEN_DOCUMENT like this</p>
  
  <pre><code>Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
  intent.setType("text/plain");
  ...
  startActivityForResult(intent, READ_REQUEST_CODE);
  </code></pre>
  
  <p>which performs as expected.</p>
  
  <p>In that files content, a file name is mentioned which I like to open without any user interaction (just exchange the file name of the intend result with the one read from the file). By doing this, I'll get an <code>java.lang.SecurityException: Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/document/primary%3ADownload%2Finc.txt from pid=..., uid=... requires android.permission.MANAGE_DOCUMENTS, or grantUriPermission()</code> by calling <code>getContentResolver().openInputStream(manipulatedUri)</code> which is weird as in the <code>AndroidManifest.xml</code> it is written as follows:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.MANAGE_DOCUMENTS" /&gt;
  </code></pre>
  
  <p>What it makes even more weird to me is the following: File A includes file name B. If I open it that way, it does not work. But, openening file B first (making it known to the systems ContentResolver instance?) and afterwards openening file A, the programatic load of file B works as expected even after app restart.</p>
  
  <p>Does anybody knows the reason for such a behavior?</p>
  
  <hr>
  
  <p>API Level 19 is used</p>