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

Commit 79a89ef4 authored by Ray Essick's avatar Ray Essick
Browse files

Suppress 'radio' processes to media.metrics

We suppress calls from radio processes (including the basic phone
process) to the media.metrics service. This had started happening
for a particular video telephony application that ran within phone
instead of as some separate app with its own user id.

We do this here to speed up when a radio process learns that it
can not log to media.metrics. The existing sepolicy restrictions
remain in place as a fallback. The use case that prompted this
was having issues with the 5-second timeout before we learned that
radio wasn't allowed access to the media.metrics process.

Bug: 37552329
Test: observe 'dumpsys media.metrics' and logcat
Change-Id: I1824aa35860bb91dd796856453c1897ec21b496c
parent 087f3af6
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <binder/IServiceManager.h>
#include <media/IMediaAnalyticsService.h>
#include <media/MediaAnalyticsItem.h>
#include <private/android_filesystem_config.h>

namespace android {

@@ -776,6 +777,24 @@ sp<IMediaAnalyticsService> MediaAnalyticsItem::getInstance() {
        return NULL;
    }

    // completely skip logging from certain UIDs. We do this here
    // to avoid the multi-second timeouts while we learn that
    // sepolicy will not let us find the service.
    // We do this only for a select set of UIDs
    // The sepolicy protection is still in place, we just want a faster
    // response from this specific, small set of uids.
    {
        uid_t uid = getuid();
        switch (uid) {
            case AID_RADIO:     // telephony subsystem, RIL
                return NULL;
                break;
            default:
                // let sepolicy deny access if appropriate
                break;
        }
    }

    {
        Mutex::Autolock _l(sInitMutex);
        const char *badness = "";