Avoid querying the db during getoriginalMediaFormatFileDescriptor

Querying the db can ANR the system as per the following trace:

at android.provider.MediaStore.getOriginalMediaFormatFileDescriptor
at android.media.MediaPlayer.setDataSource
at android.media.Ringtone.setUri
at android.media.Ringtone.setAudioAttributes

To avoid this, instead of checking if the file is a modern format,
we instead check if the file supports transcoding. This can be
misleading for legacy video files in DCIM/Camera because we'd end up
returning a similar fd as the input fd. This however does not violate
the API contract.

Test: atest TranscodeTest
Bug: 187690359
Change-Id: Id89599fa6a75a81cb3fb825af51e12ff90e00018
2 files changed