Allow QXDM logs access.

Address the following non-permissive denials:
<12>[  780.089260] type=1400 audit(1407741420.810:209): avc: denied { write } for pid=4807 comm="roid.qxdmlogger" name="rundiag" dev="mmcblk0p37" ino=1081346 scontext=u:r:platform_app:s0 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=0
<12>[  780.123801] type=1400 audit(1407741420.840:210): avc: denied { setattr } for pid=4828 comm="chmod" name="rundiag" dev="mmcblk0p37" ino=1081346 scontext=u:r:platform_app:s0 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=0
<12>[  780.183492] type=1400 audit(1407741420.900:211): avc: denied { write } for pid=4807 comm="roid.qxdmlogger" name="diag_logs" dev="mmcblk0p37" ino=1081345 scontext=u:r:platform_app:s0 tcontext=u:object_r:system_data_file:s0 tclass=dir permissive=0

Bug: 16934316
Change-Id: Ifd2d5b3ae29d070816295dee9368730f81511be7
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 6af3bc5..9a3b376 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -107,6 +107,7 @@
         mdm_helper.te \
         mediaserver.te \
         netmgrd.te \
+        platform_app.te \
         qmux.te \
         rild.te \
         sensors.te \
diff --git a/sepolicy/file.te b/sepolicy/file.te
index 8a9bf7d..227a297 100644
--- a/sepolicy/file.te
+++ b/sepolicy/file.te
@@ -6,4 +6,6 @@
 type sensors_socket, file_type;
 type thermald_socket, file_type;
 
-type sysfs_rmnet, fs_type, sysfs_type;
\ No newline at end of file
+type sysfs_rmnet, fs_type, sysfs_type;
+
+type diag_logs, file_type, data_file_type;
\ No newline at end of file
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index c3a95b8..22e6e13 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -1,4 +1,5 @@
 /data/cam_socket[23]           u:object_r:camera_socket:s0
+/data/diag_logs(/.*)?          u:object_r:diag_logs:s0
 /data/misc/radio(/.*)?         u:object_r:radio_data_file:s0
 /data/nfc(/.*)?                u:object_r:nfc_data_file:s0
 
diff --git a/sepolicy/platform_app.te b/sepolicy/platform_app.te
new file mode 100644
index 0000000..94ba0be
--- /dev/null
+++ b/sepolicy/platform_app.te
@@ -0,0 +1,5 @@
+userdebug_or_eng(`
+  # qxdmlogger access to /data/diag_logs.
+  allow platform_app diag_logs:dir rw_dir_perms;
+  allow platform_app diag_logs:file create_file_perms;
+')
\ No newline at end of file