FP4: Restore Tct daemon
* Turns out, in addition to setting BT MAC address, light sensor calibration was being handled by tctd
* Without proper calibration, we get junk lux values making auto brightness go crazy
Change-Id: I13864c1aa1117234d33315b39536330d74bb6d61
diff --git a/proprietary-files.txt b/proprietary-files.txt
index 376c35b..356a50e 100644
--- a/proprietary-files.txt
+++ b/proprietary-files.txt
@@ -1102,6 +1102,11 @@
vendor/lib64/hw/vendor.qti.hardware.soter@1.0-impl.so
vendor/lib64/vendor.qti.hardware.soter@1.0.so
+# Tct Daemon
+vendor/bin/tctd
+vendor/etc/init/tctd.rc
+vendor/lib/libQSEEComAPI.so
+
# Thermal engine
vendor/bin/thermal-engine
vendor/etc/init/init_thermal-engine.rc
diff --git a/sepolicy/vendor/device.te b/sepolicy/vendor/device.te
index e178733..59f4c5d 100644
--- a/sepolicy/vendor/device.te
+++ b/sepolicy/vendor/device.te
@@ -1,2 +1,3 @@
type fpsensor_fp_device, dev_type;
+type traceability_block_device, dev_type;
type vl53l1_device, dev_type;
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 31ef9d4..136f727 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -9,9 +9,6 @@
# MAC (Bluetooth)
/mnt/vendor/persist/t2m_param(/.*)? u:object_r:persist_t2m_param_file:s0
-# Modem
-/dev/block/platform/soc/1d84000.ufshc/by-name/tunning u:object_r:vendor_modem_efs_partition_device:s0
-
# NFC
/dev/st21nfc u:object_r:nfc_device:s0
/vendor/bin/hw/android\.hardware\.nfc@1\.2-service.st u:object_r:hal_nfc_default_exec:s0
@@ -41,6 +38,13 @@
/sys/devices/virtual/misc/msm_wma/wakeup[0-9]+(/.*)? u:object_r:sysfs_wakeup:s0
/sys/devices/virtual/misc/msm_wmapro/wakeup[0-9]+(/.*)? u:object_r:sysfs_wakeup:s0
+# Partitions
+/dev/block/platform/soc/1d84000.ufshc/by-name/tunning u:object_r:vendor_modem_efs_partition_device:s0
+/dev/block/platform/soc/1d84000.ufshc/by-name/traceability u:object_r:traceability_block_device:s0
+
+# Tct Daemon
+/vendor/bin/tctd u:object_r:tctd_exec:s0
+
# Vibrator
/vendor/bin/hw/vendor\.qti\.hardware\.vibrator\.service\.FP4 u:object_r:hal_vibrator_default_exec:s0
diff --git a/sepolicy/vendor/hal_sensors_default.te b/sepolicy/vendor/hal_sensors_default.te
index 8f2a507..5064c42 100644
--- a/sepolicy/vendor/hal_sensors_default.te
+++ b/sepolicy/vendor/hal_sensors_default.te
@@ -1 +1,2 @@
allow hal_sensors_default sysfs_leds:file r_file_perms;
+get_prop(hal_sensors_default, vendor_tct_default_prop)
diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te
index ddd57dc..c81b85f 100644
--- a/sepolicy/vendor/property.te
+++ b/sepolicy/vendor/property.te
@@ -1 +1,2 @@
type vendor_t2m_sys_prop, property_type;
+type vendor_tct_default_prop, property_type;
diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts
index 0e67403..132ae19 100644
--- a/sepolicy/vendor/property_contexts
+++ b/sepolicy/vendor/property_contexts
@@ -1,5 +1,12 @@
# A2DP
-persist.vendor.bluetooth.a2dp. u:object_r:vendor_bluetooth_prop:s0
+persist.vendor.bluetooth.a2dp. u:object_r:vendor_bluetooth_prop:s0
+
+# Bluetooth MAC
+ro.vendor.t2m.btmac u:object_r:vendor_t2m_sys_prop:s0
+
+# Light Sensor Calibration
+ro.vendor.tct.backcaldata u:object_r:vendor_tct_default_prop:s0
+ro.vendor.tct.frontcaldata u:object_r:vendor_tct_default_prop:s0
# Serial Nums
vendor.t2m.camera_main.sn u:object_r:vendor_t2m_sys_prop:s0
diff --git a/sepolicy/vendor/tctd.te b/sepolicy/vendor/tctd.te
new file mode 100644
index 0000000..e34a0c3
--- /dev/null
+++ b/sepolicy/vendor/tctd.te
@@ -0,0 +1,16 @@
+type tctd, domain;
+type tctd_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(tctd);
+
+# Traceability
+allow tctd block_device:dir search;
+allow tctd traceability_block_device:blk_file rw_file_perms;
+
+# Bluetooth MAC
+allow tctd mnt_vendor_file:dir search;
+r_dir_file(tctd, persist_t2m_param_file)
+
+set_prop(tctd, vendor_t2m_sys_prop)
+
+# Light Sensor Calibration
+set_prop(tctd, vendor_tct_default_prop)
diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te
new file mode 100644
index 0000000..714f523
--- /dev/null
+++ b/sepolicy/vendor/vendor_init.te
@@ -0,0 +1 @@
+get_prop(vendor_init, vendor_t2m_sys_prop)