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
diff --git a/media/libmediametrics/MediaAnalyticsItem.cpp b/media/libmediametrics/MediaAnalyticsItem.cpp
index 229e747..43881b3 100644
--- a/media/libmediametrics/MediaAnalyticsItem.cpp
+++ b/media/libmediametrics/MediaAnalyticsItem.cpp
@@ -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 @@
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 = "";