audio policy: add recording app ops monitoring for system services
Allow audio recording app ops monitoring for system services.
Only audioserver UID and shell should be exempt from being silenced by
app ops.
Bug: 192638296
Test: run app that records audio, then $adb shell appops set <UID> 27 2
Test: atest GtsSuspendAppsTestCases:SuspendPackagesTest
Change-Id: Ibbe79add05e8f31175c2db7d43fe48af4ebd9d29
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index 5df5f1d..4d0e1f1 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -1442,8 +1442,8 @@
const AttributionSourceState& attributionSource, const audio_attributes_t& attr,
wp<AudioCommandThread> commandThread)
{
- if (isServiceUid(attributionSource.uid)) {
- ALOGV("not silencing record for service %s",
+ if (isAudioServerOrRootUid(attributionSource.uid)) {
+ ALOGV("not silencing record for audio or root source %s",
attributionSource.toString().c_str());
return nullptr;
}