From 3319d5ee16d6b90f1ce5137e9f650e4c38c975b3 Mon Sep 17 00:00:00 2001
From: dcashman <dcashman@google.com>
Date: Tue, 15 Nov 2016 10:05:55 -0800
Subject: [PATCH] Move hal_light to attribute.

HAL policy defines how the platform and a given HAL interact, but not how the
HAL is implemented.  This policy should be represented as an attribute that all
processes implementing the HAL can include.

Bug: 32123421
Test: Builds.
Change-Id: I17e5612c0835773c28e14f09e2ce7bdc3f210c15
---
 private/file_contexts        | 2 +-
 private/hal_light.te         | 2 --
 private/hal_light_default.te | 5 +++++
 public/attributes            | 3 +++
 public/hal_light.te          | 4 ----
 5 files changed, 9 insertions(+), 7 deletions(-)
 delete mode 100644 private/hal_light.te
 create mode 100644 private/hal_light_default.te

diff --git a/private/file_contexts b/private/file_contexts
index a341d7e86..f1d736d0e 100644
--- a/private/file_contexts
+++ b/private/file_contexts
@@ -227,7 +227,7 @@
 /system/bin/hw/android\.hardware\.boot@1\.0-service           u:object_r:hal_boot_exec:s0
 /system/bin/hw/android\.hardware\.graphics\.allocator@2\.0-service   u:object_r:hal_graphics_allocator_exec:s0
 /system/bin/hw/android\.hardware\.graphics\.composer@2\.1-service    u:object_r:hal_graphics_composer_exec:s0
-/system/bin/hw/android\.hardware\.light@2\.0-service          u:object_r:hal_light_exec:s0
+/system/bin/hw/android\.hardware\.light@2\.0-service          u:object_r:hal_light_default_exec:s0
 /system/bin/hw/android\.hardware\.memtrack@1\.0-service       u:object_r:hal_memtrack_exec:s0
 /system/bin/hw/android\.hardware\.nfc@1\.0-service            u:object_r:hal_nfc_exec:s0
 /system/bin/hw/android\.hardware\.power@1\.0-service          u:object_r:hal_power_exec:s0
diff --git a/private/hal_light.te b/private/hal_light.te
deleted file mode 100644
index 8c5f10833..000000000
--- a/private/hal_light.te
+++ /dev/null
@@ -1,2 +0,0 @@
-# may be started by init
-init_daemon_domain(hal_light)
diff --git a/private/hal_light_default.te b/private/hal_light_default.te
new file mode 100644
index 000000000..8ac8037b2
--- /dev/null
+++ b/private/hal_light_default.te
@@ -0,0 +1,5 @@
+type hal_light_default, hal_light, domain;
+type hal_light_default_exec, exec_type, file_type;
+
+# may be started by init
+init_daemon_domain(hal_light_default)
diff --git a/public/attributes b/public/attributes
index a846c3472..5b68eea00 100644
--- a/public/attributes
+++ b/public/attributes
@@ -113,3 +113,6 @@ attribute boot_control_hal;
 # postinstall. This includes the background daemon and the sideload tool from
 # recovery for A/B devices.
 attribute update_engine_common;
+
+# HALs
+attribute hal_light;
diff --git a/public/hal_light.te b/public/hal_light.te
index cdb36bbc1..af238dd72 100644
--- a/public/hal_light.te
+++ b/public/hal_light.te
@@ -1,7 +1,3 @@
-# light subsystem
-type hal_light, domain;
-type hal_light_exec, exec_type, file_type;
-
 # hwbinder access
 hwbinder_use(hal_light)
 
-- 
GitLab