diff --git a/base.mk b/base.mk index 43f370718..2feb2b20c 100644 --- a/base.mk +++ b/base.mk @@ -201,3 +201,8 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ # AOSP overlays PRODUCT_PACKAGES += \ NavigationBarMode2ButtonOverlay + +# TimeKeep +PRODUCT_PACKAGES += \ + timekeep \ + TimeKeep diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index 7cfb2268a..6dff1e322 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -19,3 +19,6 @@ /efs u:object_r:efs_file:s0 /dev/smcinvoke u:object_r:smcinvoke_device:s0 + +#Timekeep +/system/bin/gsi_timekeep u:object_r:gsi_timekeep_exec:s0 diff --git a/sepolicy/property_contexts b/sepolicy/property_contexts new file mode 100644 index 000000000..ad0a920d0 --- /dev/null +++ b/sepolicy/property_contexts @@ -0,0 +1 @@ +persist.sys.timeadjust u:object_r:timekeep_prop:s0 diff --git a/sepolicy/qualcomm.te b/sepolicy/qualcomm.te index 2669694fc..397635212 100644 --- a/sepolicy/qualcomm.te +++ b/sepolicy/qualcomm.te @@ -28,3 +28,8 @@ allowxperm tee rpmb_device:blk_file ioctl { 0xb300-0xbfff }; attribute smcinvoke_device_29_0; type smcinvoke_device, dev_type; typeattribute smcinvoke_device smcinvoke_device_29_0; + +#Timekeep +type timekeep_prop, property_type; +allow system_app time_data_file:file rw_file_perms; +set_prop(system_app, timekeep_prop) diff --git a/sepolicy/timekeep.te b/sepolicy/timekeep.te new file mode 100644 index 000000000..7757f51ef --- /dev/null +++ b/sepolicy/timekeep.te @@ -0,0 +1,18 @@ +type gsi_timekeep, domain, domain_deprecated; +type gsi_timekeep_exec, exec_type, file_type; + +# Started by init +init_daemon_domain(gsi_timekeep) + +allow gsi_timekeep self:capability { + fowner + fsetid + sys_time + dac_override + dac_read_search +}; + +allow gsi_timekeep time_data_file:file create_file_perms; +allow gsi_timekeep time_data_file:dir create_dir_perms; + +set_prop(gsi_timekeep, timekeep_prop) diff --git a/timekeep.rc b/timekeep.rc new file mode 100644 index 000000000..458c97a7c --- /dev/null +++ b/timekeep.rc @@ -0,0 +1,21 @@ +#Timekeep +on boot + # Set system as owner of RTC node + chown system system /sys/class/rtc/rtc0/since_epoch + +on post-fs-data && property:persist.sys.qcom-timekeep=true + # Create folder for timekeep + mkdir /data/time 0770 system system + mkdir /data/vendor/time 0770 system system + chmod 0770 /data/time/ats_2 + chmod 0770 /data/vendor/time/ats_2 + start gsi_timekeep + +# Time service +service gsi_timekeep /system/bin/gsi_timekeep restore + class late_start + user system + group system + capabilities SYS_TIME + disabled + writepid /dev/cpuset/system-background/tasks diff --git a/vndk.rc b/vndk.rc index 4adfe9e98..27cf9fe84 100644 --- a/vndk.rc +++ b/vndk.rc @@ -70,3 +70,5 @@ on property:persist.sys.phh.restart_ril=true restart vendor.qcrild restart vendor.qcrild2 restart vendor.ril-daemon-mtk + +