Fix PreviewDataProvider previewType and firstFileInfo timeout logic

Execute time-critical operations within `withTimeoutOrNull` function on
a different task launched from a separate scope. The separate scope is
need as, according to structural concurrency principals, `withTimeout`,
upon timeout, canceling all its child jobs and completes only when all
of them complete. The core of the logic we're wrapping with the timeout
are ContentProvider calls which are not cancellable (and the whole
operation can be canceled in some intermediate points between the
calls).
Calling them from another scope allows us just abandon them on timeout
which is OK as we run the logic once anyway (and cache the results).

Bug: 295985906
Test: Use the ShareTest app with metadata timeout and media type
disguise option.
Test: Integration tests.

Change-Id: I922142385804abd78c2ad880d88d416d78155800
2 files changed