Disable MediaMetrics for the HotwordDetectionService.
HotwordDetectionService is an isolated service which ordinarily cannot
access the audio system due to selinux restrictions on isolated
processes. To bypass those restrictions, the AudioFlinger binder is
being passed from the system server to the HotwordDetectionService.
(I86ac0820fd72676db4740658ffd096df3d20d30e)
To allow reading audio, accesses to the MediaMetrics service must also
be handled. Instead of similarly passing the MediaMetrics binder, we
take the simpler approach of just disabling the service there for now.
Bug: 190011174
Test: manual - sample app can read audio (with a few other wip changes)
Change-Id: I740b4f5acb88821197e3c4023a4032babd48ec5a
diff --git a/media/libmediametrics/MediaMetricsItem.cpp b/media/libmediametrics/MediaMetricsItem.cpp
index a8350ea..d597a4d 100644
--- a/media/libmediametrics/MediaMetricsItem.cpp
+++ b/media/libmediametrics/MediaMetricsItem.cpp
@@ -308,6 +308,17 @@
switch (uid) {
case AID_RADIO: // telephony subsystem, RIL
return false;
+ default:
+ // Some isolated processes can access the audio system; see
+ // AudioSystem::setAudioFlingerBinder (currently only the HotwordDetectionService). Instead
+ // of also allowing access to the MediaMetrics service, it's simpler to just disable it for
+ // now.
+ // TODO(b/190151205): Either allow the HotwordDetectionService to access MediaMetrics or
+ // make this disabling specific to that process.
+ if (uid >= AID_ISOLATED_START && uid <= AID_ISOLATED_END) {
+ return false;
+ }
+ break;
}
int enabled = property_get_int32(Item::EnabledProperty, -1);