Fix wrong FUSE-JNI uid and tid
1. During open, the uid used in the struct handle should be the uid
received from MediaProvider over JNI. This allows correct attribution
of the transcoding task
2. During lookup, the tid field was ommitted when calling into
Java. This caused the tid field to be populated with garbage and
mPendingOpenInfo cache was never hit
Test: atest TranscodeTest
Bug: 174655855
Change-Id: I4ffd3c94191d2f86d0ecbda495ef671be841f252
diff --git a/jni/FuseDaemon.cpp b/jni/FuseDaemon.cpp
index 6be7b16..c5dd232 100755
--- a/jni/FuseDaemon.cpp
+++ b/jni/FuseDaemon.cpp
@@ -1142,7 +1142,7 @@
}
int keep_cache = 1;
- handle* h = create_handle_for_node(fuse, io_path, fd, req->ctx.uid, node,
+ handle* h = create_handle_for_node(fuse, io_path, fd, result->uid, node,
result->redaction_info.release(), &keep_cache);
fi->fh = ptr_to_id(h);
fi->keep_cache = keep_cache;
diff --git a/jni/MediaProviderWrapper.cpp b/jni/MediaProviderWrapper.cpp
index 99fe081..40570ad 100644
--- a/jni/MediaProviderWrapper.cpp
+++ b/jni/MediaProviderWrapper.cpp
@@ -486,7 +486,8 @@
ScopedLocalRef<jstring> j_path(env, env->NewStringUTF(path.c_str()));
ScopedLocalRef<jobject> j_res_file_lookup_object(
- env, env->CallObjectMethod(media_provider_object_, mid_file_lookup_, j_path.get(), uid));
+ env, env->CallObjectMethod(media_provider_object_, mid_file_lookup_, j_path.get(), uid,
+ tid));
if (CheckForJniException(env)) {
return nullptr;