From c76e158c2717a386c3a98b1756892ecf9ed30460 Mon Sep 17 00:00:00 2001
From: Shubang <shubang@google.com>
Date: Wed, 29 Mar 2017 15:03:59 -0700
Subject: [PATCH] Add sepolicy for tv.input

Test: build, flash; adb shell lshal
Bug: 36562029
Change-Id: If8f6d8dbd99d31e6627fa4b7c1fd4faea3b75cf2
---
 private/system_server.te       | 1 +
 public/attributes              | 3 +++
 public/hal_tv_input.te         | 3 +++
 vendor/file_contexts           | 1 +
 vendor/hal_tv_input_default.te | 6 ++++++
 5 files changed, 14 insertions(+)
 create mode 100644 public/hal_tv_input.te
 create mode 100644 vendor/hal_tv_input_default.te

diff --git a/private/system_server.te b/private/system_server.te
index 5aae022bd..60331bd34 100644
--- a/private/system_server.te
+++ b/private/system_server.te
@@ -183,6 +183,7 @@ hal_client_domain(system_server, hal_power)
 hal_client_domain(system_server, hal_sensors)
 binder_call(system_server, hal_thermal)
 hal_client_domain(system_server, hal_thermal)
+hal_client_domain(system_server, hal_tv_input)
 binder_call(system_server, hal_usb)
 hal_client_domain(system_server, hal_usb)
 binder_call(system_server, hal_vibrator)
diff --git a/public/attributes b/public/attributes
index d9d123fd0..feb7624e2 100644
--- a/public/attributes
+++ b/public/attributes
@@ -211,6 +211,9 @@ attribute hal_telephony_server;
 attribute hal_thermal;
 attribute hal_thermal_client;
 attribute hal_thermal_server;
+attribute hal_tv_input;
+attribute hal_tv_input_client;
+attribute hal_tv_input_server;
 attribute hal_usb;
 attribute hal_usb_client;
 attribute hal_usb_server;
diff --git a/public/hal_tv_input.te b/public/hal_tv_input.te
new file mode 100644
index 000000000..5276ddfea
--- /dev/null
+++ b/public/hal_tv_input.te
@@ -0,0 +1,3 @@
+# HwBinder IPC from clients into server, and callbacks
+binder_call(hal_tv_input_client, hal_tv_input_server)
+binder_call(hal_tv_input_server, hal_tv_input_client)
diff --git a/vendor/file_contexts b/vendor/file_contexts
index 763a94582..ea0ef29f6 100644
--- a/vendor/file_contexts
+++ b/vendor/file_contexts
@@ -25,6 +25,7 @@
 /(vendor|system/vendor)/bin/hw/android\.hardware\.sensors@1\.0-service        u:object_r:hal_sensors_default_exec:s0
 /(vendor|system/vendor)/bin/hw/rild                                           u:object_r:rild_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.thermal@1\.0-service        u:object_r:hal_thermal_default_exec:s0
+/(vendor|system/vendor)/bin/hw/android\.hardware\.tv\.input@1\.0-service      u:object_r:hal_tv_input_default_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.usb@1\.0-service            u:object_r:hal_usb_default_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.vibrator@1\.0-service       u:object_r:hal_vibrator_default_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.vr@1\.0-service             u:object_r:hal_vr_default_exec:s0
diff --git a/vendor/hal_tv_input_default.te b/vendor/hal_tv_input_default.te
new file mode 100644
index 000000000..a97c1717b
--- /dev/null
+++ b/vendor/hal_tv_input_default.te
@@ -0,0 +1,6 @@
+type hal_tv_input_default, domain;
+hal_server_domain(hal_tv_input_default, hal_tv_input)
+
+type hal_tv_input_default_exec, exec_type, file_type;
+init_daemon_domain(hal_tv_input_default)
+
-- 
GitLab