Improve IO performance during redaction

Previously, we forced all IO requiring redaction to bypass the kernel
page cache with direct IO. This can cause very slow performance even
via ContentResolver access. Manual meausurements show that decoding a
4MB image bitmap can take up to 5s.

Now, we change the policy for who accesses the page cache, it's now
first come first served.

If an app requiring redaction opens a file, it uses the page
cache. While, the fd stays open, subsequent redacting-requiring opens
will use the page cache but non-redacting-requiring opens will use
direct IO and have degraded performance. The equivalent policy applies
if an app *not* requiring redaction opens first.

Bug: 168429452
Test: atest ScopedStorageHostTest#testMetaDataRedaction
Change-Id: I6eb1903ee22b8d713fe792ad8fef457a140e91f1
2 files changed