Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timekeep for Qualcomm Devices #268

Open
wants to merge 8 commits into
base: android-11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,8 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
# AOSP overlays
PRODUCT_PACKAGES += \
NavigationBarMode2ButtonOverlay

# TimeKeep
PRODUCT_PACKAGES += \
timekeep \
TimeKeep
3 changes: 3 additions & 0 deletions sepolicy/file_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions sepolicy/property_contexts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
persist.sys.timeadjust u:object_r:timekeep_prop:s0
5 changes: 5 additions & 0 deletions sepolicy/qualcomm.te
Original file line number Diff line number Diff line change
Expand Up @@ -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)
18 changes: 18 additions & 0 deletions sepolicy/timekeep.te
Original file line number Diff line number Diff line change
@@ -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)
21 changes: 21 additions & 0 deletions timekeep.rc
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions vndk.rc
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@ on property:persist.sys.phh.restart_ril=true
restart vendor.qcrild
restart vendor.qcrild2
restart vendor.ril-daemon-mtk