Calculate redaction ranges on open
We used to calculate redaction ranges on first read, now we calculate
them on open if the caller is opening the file for read only. We also
now use direct_io when there are redaction ranges so that we don't read
cached content of a file. This helps us avoid the issue where an app
that should get a redacted version of the file reads the cached content
of the file that was read by an app that has access to the unredacted
version of the file.
We also now redact if the caller is MediaProvider (and we're opening for
read only) because if MediaProvider is going through FUSE then it means
it's opening a file on behalf of another app that called to it through
Binder.
Also remove getMimeType call from open and delete calls as it's
technically not need, because we can always direct those operations to
the files' table.
Fixes: 145353336
Bug: 145741852
Test: atest FuseDaemonHostTest
Change-Id: Ia390ab1622eb6c9cf9a8289899c968bdcb485320
4 files changed