Keep ParcelFileDescriptor alive and call Close() when done When native code writes to a Content-URI file opened by Java code, it must keep the ParcelFileDescriptor alive and call Close() when done in order to correctly communicate with any ContentProvider which has a close listener on the PFD. Previously, when calling ParcelFileDescriptor.detachFd(), any listening provider would be notified that the file has closed. In the case of the DownloadProvider, it considers that the file has finished writing at that point, and it will stat() the file and update its database with the current file size. This creates a race condition where writes by the native code will update the file on disk, but the provider and any apps such as DocsUI may show the file empty or smaller than it really is. Bug: 413207407 Change-Id: Ie29a002c2669ccdcb0b082845855330ad6455ddd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6508685 Commit-Queue: Joel Hockey <joelhockey@chromium.org> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/main@{#1456759}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.