ServiceUtilities: don't do RECORD_AUDIO check for system server
Only one system server seems to exist across multiple-users; however,
when the primary user is backgrounded, system server loses its
RECORD_AUDIO permission. Through a number of steps this prevents the
secondary user from starting any services that use the SoundTrigger HAL;
specifically, this was found because it prevents Oslo from functioning
when a secondary user is active.
Bug: 139839188
Test: Oslo use cases pass
Change-Id: Ia0dd5fd3b6992cb18279b81146b35ed040771245
Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com>
diff --git a/media/utils/ServiceUtilities.cpp b/media/utils/ServiceUtilities.cpp
index b824212..bc8fff6 100644
--- a/media/utils/ServiceUtilities.cpp
+++ b/media/utils/ServiceUtilities.cpp
@@ -63,7 +63,10 @@
uid_t uid, bool start) {
// Okay to not track in app ops as audio server is us and if
// device is rooted security model is considered compromised.
- if (isAudioServerOrRootUid(uid)) return true;
+ // system_server loses its RECORD_AUDIO permission when a secondary
+ // user is active, but it is a core system service so let it through.
+ // TODO(b/141210120): UserManager.DISALLOW_RECORD_AUDIO should not affect system user 0
+ if (isAudioServerOrSystemServerOrRootUid(uid)) return true;
// We specify a pid and uid here as mediaserver (aka MediaRecorder or StageFrightRecorder)
// may open a record track on behalf of a client. Note that pid may be a tid.