Change who gets marked for the cost of transcoding

Since we now provide the ability to specify
EXTRA_MEDIA_CAPABILITIES_UID, the decision to transcode or not is based
on that uid. In such cases, it's not fair to mark the uid that called us
with the request for transcoding as the one causing the transform.

In normal cases, this change will have no effect, the calling app will
get marked as the one causing transcoding.
In cases where MediaDocumentsProvider or ExternalStorageProvider are
opening on behalf of another app (that cannot handle the modern format),
we use the uid of this app to mark as the one causing transcoding cost.
In cases where a modern app opens and shares the fd with a legacy app,
we want to mark the legacy app (transcoding actaully happened because of
the legacy app after all).
And finally, if a legacy app uses the EXTRA_MEDIA_CAPABILITIES_UID of
another legacy app, but reads the file itself, in such cases we want to
mark the first app itself, so as to prevent any abuse of this facility.

Therefore, we store and then pass the media capabilities uid via jni to
MediaProvider at the time of read. This allows us to make the correct
decision for all the cases mentioned above.

BUG: 176157500, 154734139
Test: manual
Change-Id: I8f2bd759685e884cb0565c2f677755583987cb78
7 files changed