Merge "Set system time early to get more accurate timezones" into oc-dev
am: 7aa16dd070

Change-Id: I395e0b0c2c377439d9379ede6b8a825be40674fa
diff --git a/init.common.rc b/init.common.rc
index f4cc967..35b2803 100644
--- a/init.common.rc
+++ b/init.common.rc
@@ -136,6 +136,9 @@
     write /sys/block/dm-0/queue/read_ahead_kb 2048
     write /sys/block/dm-1/queue/read_ahead_kb 2048
 
+    # Start time daemon early so that the system time can be set early
+    start time_daemon
+
 on post-fs-data
     # We can start netd here before in is launched in common init.rc on zygote-start
     start netd
@@ -143,6 +146,8 @@
     start mid_sh
     # Restart qseecomd once we have /data/
     restart qseecomd
+    # Wait until the system time is set
+    wait_for_prop sys.time.set true
 
     # b/36601397 Setup debug folders for camera
     mkdir /data/vendor/camera 0770 camera camera
@@ -554,7 +559,7 @@
    socket thermal-recv-passive-client stream 0666 system system
 
 service time_daemon /vendor/bin/time_daemon
-   class late_start
+   class core
    user root
    group root
 
diff --git a/sepolicy/property.te b/sepolicy/property.te
index 9c8a064..8e8786b 100644
--- a/sepolicy/property.te
+++ b/sepolicy/property.te
@@ -7,3 +7,4 @@
 type cnss_diag_prop, property_type;
 type thermal_prop, property_type;
 type ramdump_prop, property_type;
+type sys_time_prop, property_type;
diff --git a/sepolicy/property_contexts b/sepolicy/property_contexts
index 85276c4..3a6b63e 100644
--- a/sepolicy/property_contexts
+++ b/sepolicy/property_contexts
@@ -12,3 +12,4 @@
 persist.sys.crash_rcu      u:object_r:ramdump_prop:s0
 sys.qcom.thermalcfg        u:object_r:thermal_prop:s0
 ctl.thermal-engine         u:object_r:thermal_prop:s0
+sys.time.set               u:object_r:sys_time_prop:s0
diff --git a/sepolicy/time.te b/sepolicy/time.te
index e821733..1b28d36 100644
--- a/sepolicy/time.te
+++ b/sepolicy/time.te
@@ -21,6 +21,9 @@
 
 allow time rtc_device:chr_file r_file_perms;
 
+# Set sys.time.set property
+set_prop(time, sys_time_prop)
+
 userdebug_or_eng(`
   allow time  diag_device:chr_file rw_file_perms;
 ')