private boolean blockUntilFileReady(Uri fileUri) {
        CountDownLatch latch;
        synchronized (sLatchMapLock) {
            if (!sFilesInSerialization.contains(fileUri)) return true;
            if (sUriLatchMap.containsKey(fileUri)) {
                latch = sUriLatchMap.get(fileUri);
            } else {
                latch = new CountDownLatch(1);
                sUriLatchMap.put(fileUri, latch);
            }
        }
        try {
            latch.await();
        } catch (InterruptedException e) {
            Log.e(TAG, "Interrupt waiting for file: " + fileUri.toString());
            return false;
        }
        return true;
    }
Grant the read permission to a list of {@link Uri} sent through a {@link Intent}.
@param intent The sending Intent which holds a list of Uri.
@param uris A list of Uri generated by generateUri(Context, Bitmap, String, int,
            List<String>).
@param context The context requests to grant the permission.
customtabs/src/android/support/customtabs/browseractions/BrowserServiceFileProvider.java