Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74300e0e authored by Ray Essick's avatar Ray Essick
Browse files

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
parent b893fcd9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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 @@ RemoteMediaExtractor::RemoteMediaExtractor(
    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());