From e91740a58890ec758d055925db2e702c0e9a40bf Mon Sep 17 00:00:00 2001
From: Mikhail Naganov <mnaganov@google.com>
Date: Thu, 22 Dec 2016 09:26:41 -0800
Subject: [PATCH] Allow hal_audio to set scheduling policy for its threads

Audio HAL server needs to set SCHED_FIFO scheduling policy
for its threads that communicate with FastMixer threads of
AudioFlinger that use the same scheduler.

Bug: 30222631
Change-Id: I405a69d097a6bfed455e3483365b27c4004e1063
---
 public/hal_audio.te     | 4 ++++
 public/system_server.te | 1 +
 2 files changed, 5 insertions(+)

diff --git a/public/hal_audio.te b/public/hal_audio.te
index b40427cd3..ca8fe523f 100644
--- a/public/hal_audio.te
+++ b/public/hal_audio.te
@@ -1,5 +1,7 @@
 hwbinder_use(hal_audio)
+binder_use(hal_audio)
 binder_call(hal_audio, audioserver)
+binder_call(hal_audio, system_server)
 
 allow hal_audio ion_device:chr_file r_file_perms;
 
@@ -15,6 +17,8 @@ r_dir_file(hal_audio, proc)
 allow hal_audio audio_device:dir r_dir_perms;
 allow hal_audio audio_device:chr_file rw_file_perms;
 
+allow hal_audio scheduling_policy_service:service_manager find;
+
 # Needed on some devices for playing audio on paired BT device,
 # but seems appropriate for all devices.
 unix_socket_connect(hal_audio, bluetooth, bluetooth)
diff --git a/public/system_server.te b/public/system_server.te
index c0802e8d4..6bbe9913c 100644
--- a/public/system_server.te
+++ b/public/system_server.te
@@ -91,6 +91,7 @@ allow system_server { appdomain ephemeral_app }:process { sigkill signal };
 # Set scheduling info for apps.
 allow system_server { appdomain ephemeral_app }:process { getsched setsched };
 allow system_server audioserver:process { getsched setsched };
+allow system_server hal_audio:process { getsched setsched };
 allow system_server cameraserver:process { getsched setsched };
 allow system_server mediaserver:process { getsched setsched };
 allow system_server bootanim:process { getsched setsched };
-- 
GitLab