Add hammerhead-specific selinux policy for device driver

Change-Id: I3ca7ff2f678153e20d9835cc85206b927fcc0b15
diff --git a/init.hammerhead_fp.rc b/init.hammerhead_fp.rc
index ae0f750..b11a525 100644
--- a/init.hammerhead_fp.rc
+++ b/init.hammerhead_fp.rc
@@ -18,5 +18,6 @@
     chown system system /dev/fpc1020
     chmod 660 /dev/fpc1020
 
-on post-fs-data
-    mkdir /data/fpc_tpl 770 system system
+service fingerprintd /system/bin/fingerprintd
+    class late_start
+    user system
diff --git a/sepolicy-hammerhead_fp/device.te b/sepolicy-hammerhead_fp/device.te
index c291129..bb3e905 100644
--- a/sepolicy-hammerhead_fp/device.te
+++ b/sepolicy-hammerhead_fp/device.te
@@ -1,2 +1,2 @@
 # Fingerprint device
-type fpc1020, dev_type;
+type fpc1020_device, dev_type;
diff --git a/sepolicy-hammerhead_fp/file.te b/sepolicy-hammerhead_fp/file.te
new file mode 100644
index 0000000..effa0eb
--- /dev/null
+++ b/sepolicy-hammerhead_fp/file.te
@@ -0,0 +1,2 @@
+# sysfs directory file
+type sysfs_fingerprintd, fs_type, sysfs_type;
diff --git a/sepolicy-hammerhead_fp/file_contexts b/sepolicy-hammerhead_fp/file_contexts
index c3a8614..84c569e 100644
--- a/sepolicy-hammerhead_fp/file_contexts
+++ b/sepolicy-hammerhead_fp/file_contexts
@@ -1,2 +1,2 @@
 # Fingerprint device
-/dev/fpc1020   u:object_r:fpc1020:s0
+/dev/fpc1020 u:object_r:fpc1020_device:s0
diff --git a/sepolicy-hammerhead_fp/fingerprintd.te b/sepolicy-hammerhead_fp/fingerprintd.te
new file mode 100644
index 0000000..f51e8bb
--- /dev/null
+++ b/sepolicy-hammerhead_fp/fingerprintd.te
@@ -0,0 +1,3 @@
+# Fingerprint device
+allow fingerprintd fpc1020_device:chr_file rw_file_perms;
+allow fingerprintd sysfs:file rw_file_perms;
diff --git a/sepolicy-hammerhead_fp/system_server.te b/sepolicy-hammerhead_fp/system_server.te
deleted file mode 100644
index 077a58a..0000000
--- a/sepolicy-hammerhead_fp/system_server.te
+++ /dev/null
@@ -1,2 +0,0 @@
-# Fingerprint device
-allow system_server fpc1020:chr_file rw_file_perms;