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
diff --git a/jni/node-inl.h b/jni/node-inl.h
index 99960ed..8a97496 100644
--- a/jni/node-inl.h
+++ b/jni/node-inl.h
@@ -41,8 +41,14 @@
 namespace fuse {
 
 struct handle {
-    explicit handle(int fd, const RedactionInfo* ri, bool cached, bool passthrough, uid_t uid)
-        : fd(fd), ri(ri), cached(cached), passthrough(passthrough), uid(uid) {
+    explicit handle(int fd, const RedactionInfo* ri, bool cached, bool passthrough, uid_t uid,
+                    uid_t transforms_uid)
+        : fd(fd),
+          ri(ri),
+          cached(cached),
+          passthrough(passthrough),
+          uid(uid),
+          transforms_uid(transforms_uid) {
         CHECK(ri != nullptr);
     }
 
@@ -51,6 +57,7 @@
     const bool cached;
     const bool passthrough;
     const uid_t uid;
+    const uid_t transforms_uid;
 
     ~handle() { close(fd); }
 };