Refactor some of that redaction logic
* Introduce IsoInterface#isSupportedMimeType to determine whether
IsoInterface can handle the given file based on its MIME type instead of
content-sniffing.
* Refactor getRedactionRanges to take file-path instead of FD, this way
we can use the path with isSupportedMimeType methods (for both EXIF and
ISO). This also allowed the removal of the additional getRedactionRanges
variant that takes a file stream. This should also help remove
the redundant warnings about EXIF interface not being able to parse
files.
* Address the bug where IsoInterface throws an exception (and fails the
read) when reading an empty file.
With all the above precautions, now we make getRedactionRanges throw
when an exception occurs, instead of just returning empty redaction
ranges (basically not redacting).
Bug: 142470150
Bug: 141356821
Test: ensure redaction on file path access still works
Test: atest MediaProviderTests CtsProviderTestCases # without FUSE
Change-Id: I924faca0a4359a5d8f5722ba745c4414683d62c5
5 files changed