media.extractor pass client uid for attribution
media.extractor runs as as a centralized service, have it use the
client's uid for attribution of who requested the extraction.
Bug: 129191926
Test: boot, dumpsys media.metrics
diff --git a/media/libstagefright/RemoteMediaExtractor.cpp b/media/libstagefright/RemoteMediaExtractor.cpp
index b0ce688..29c3a35 100644
--- a/media/libstagefright/RemoteMediaExtractor.cpp
+++ b/media/libstagefright/RemoteMediaExtractor.cpp
@@ -18,6 +18,7 @@
#define LOG_TAG "RemoteMediaExtractor"
#include <utils/Log.h>
+#include <binder/IPCThreadState.h>
#include <media/stagefright/InterfaceUtils.h>
#include <media/MediaAnalyticsItem.h>
#include <media/MediaSource.h>
@@ -51,6 +52,11 @@
if (MEDIA_LOG) {
mAnalyticsItem = MediaAnalyticsItem::create(kKeyExtractor);
+ // we're in the extractor service, we want to attribute to the app
+ // that invoked us.
+ int uid = IPCThreadState::self()->getCallingUid();
+ mAnalyticsItem->setUid(uid);
+
// track the container format (mpeg, aac, wvm, etc)
size_t ntracks = extractor->countTracks();
mAnalyticsItem->setCString(kExtractorFormat, extractor->name());