Set system time early to get more accurate timezones

Zygote reads the system time and caches the timezone information.
So start time_daemon early so that it can set the time before
zygote starts up and reads the time.

Bug: 62473512
Test: Manual: Check adb logs to ensure Zygote starts after system
              time is set.

Change-Id: I98fca37928e1822614f9fcb39869e664453a2c3e
This commit is contained in:
Naveen Kalla
2017-06-14 15:35:34 -07:00
parent bbc467932d
commit 2284c8495a
4 changed files with 11 additions and 1 deletions

View File

@@ -185,6 +185,9 @@ on late-fs
# Mount RW partitions which need run fsck
mount_all /vendor/etc/fstab.${ro.hardware} --late
# Start time daemon early so that the system time can be set early
start time_daemon
on post-fs
# set RLIMIT_MEMLOCK to 64MB
setrlimit 8 67108864 67108864
@@ -223,6 +226,8 @@ on post-fs-data
# Set indication (checked by vold) that we have finished this action
setprop vold.post_fs_data_done 1
# Wait until the system time is set
wait_for_prop sys.time.set true
# zygote need to be started after otapreopt which will be done on post-fs-data
on zygote-start
@@ -491,7 +496,7 @@ service qseecomd /vendor/bin/qseecomd
group root
service time_daemon /vendor/bin/time_daemon
class late_start
class core
user root
group root

View File

@@ -12,3 +12,4 @@ type wc_prop, property_type;
type thermal_prop, property_type;
type modem_diag_prop, property_type;
type tel_mon_prop, property_type;
type sys_time_prop, property_type;

View File

@@ -20,3 +20,4 @@ ctl.thermal-engine u:object_r:thermal_prop:s0
persist.sys.modem.diag. u:object_r:modem_diag_prop:s0
sys.modem.diag. u:object_r:modem_diag_prop:s0
persist.radio.enable_tel_mon u:object_r:tel_mon_prop:s0
sys.time.set u:object_r:sys_time_prop:s0

View File

@@ -13,6 +13,9 @@ allow time_daemon sysfs_soc:dir search;
allow time_daemon sysfs_soc:file r_file_perms;
allow time_daemon sysfs_msm_subsys:dir search;
# Set sys.time.set property
set_prop(time_daemon, sys_time_prop);
allow time_daemon persist_file:dir w_dir_perms;
allow time_daemon persist_file:file rw_file_perms;