From 51df227dec139aafd454449ca8e379ea8216bcee Mon Sep 17 00:00:00 2001
From: Riley Andrews <riandrews@google.com>
Date: Tue, 17 Jun 2014 14:30:14 -0700
Subject: [PATCH] Give healthd permission to write sys properties to allow
 quick boot from charger mode.

Property being set: sys.boot_from_charger_mode. If healthd attempts to write
this property without the policy changes we get the following audit message:

[   45.751195] type=1400 audit(1403556447.444:7): avc:  denied  { write } for pid=99 comm="charger" name="property_service" dev="tmpfs" ino=3229 scontext=u:r:healthd:s0 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0

These changes are needed to support the following system/core commit:
faster booting from charger mode
* Ieec4494d929e92806e039f834d78b9002afd15c4

Change-Id: I9f198cd73c7b2f1e372c3793dc2b8d5ef26b3a0f
---
 healthd.te | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/healthd.te b/healthd.te
index 08472ccd8..9832ac479 100644
--- a/healthd.te
+++ b/healthd.te
@@ -32,5 +32,9 @@ allow healthd ashmem_device:chr_file execute;
 allow healthd self:process execmem;
 allow healthd proc_sysrq:file rw_file_perms;
 allow healthd self:capability sys_boot;
-
 allow healthd healthd_service:service_manager add;
+
+# Healthd needs to tell init to continue the boot
+# process when running in charger mode.
+unix_socket_connect(healthd, property, init)
+allow healthd system_prop:property_service set;
-- 
GitLab