gts3l-common: perf: Import perfd from lge_msm8996-common

As our power HAL only can work when if perfd exists, we have to import this
binary from another device.

Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
This commit is contained in:
Deokgyu Yang 2022-02-21 09:29:59 +09:00
parent 615fa58f40
commit 21dcb08866
19 changed files with 129 additions and 4 deletions

View file

@ -784,6 +784,9 @@ vendor/lib/libqti-perfd.so|2a2077cf455d5a6b03c0bb2b6eeca554ee28a363
vendor/lib/libqti-perfd-client.so|a4a6da47ee26fcd5116c514f7fed15b91306aea3
vendor/lib/libqti-util.so|d65f3ef240cebea73bd1ba8b1132a7e639aa05bb
# Perf (perfd) - from LineageOS/android_device_lge_msm8996-common
vendor/bin/perfd|fa726c3874918611457dfb17d47f6f8c9aa8bdc7
# Power-off charging
bin/lpm
lib64/libmaet.so

View file

@ -334,10 +334,12 @@ on post-fs-data
setprop vold.post_fs_data_done 1
#Create PERFD deamon related dirs
mkdir /data/vendor/perfd 0770 root system
chmod 2770 /data/vendor/perfd
rm /data/vendor/perfd/default_values
# Create PERFD deamon related dirs
mkdir /data/misc/perfd 0755 root system
chmod 2755 /data/misc/perfd
mkdir /data/system/perfd 0770 root system
rm /data/system/perfd/default_values
chmod 2770 /data/system/perfd
#Create IOP deamon related dirs
mkdir /data/vendor/iop 0700 root system

View file

@ -465,6 +465,12 @@ service vendor.energy-awareness /vendor/bin/energy-awareness
group system
oneshot
service vendor.perfd /vendor/bin/perfd
class main
user root
group root system
writepid /dev/cpuset/system-background/tasks
#service vendor.hvdcp_opti /system/vendor/bin/hvdcp_opti
# class main
# user root

View file

@ -1,3 +1,9 @@
# communicate with perfd
allow cameraserver mpctl_data_file:dir search;
allow cameraserver mpctl_data_file:sock_file write;
allow cameraserver mpctl_socket:dir search;
allow cameraserver mpctl_socket:sock_file write;
allow cameraserver csc_prop:file { getattr open read };
allow cameraserver hal_perf_default:binder call;

View file

@ -1,4 +1,5 @@
# data
type perfd_data_file, file_type, core_data_file_type, data_file_type;
type camera_socket, file_type, core_data_file_type, data_file_type;
type biometrics_vendor_data_file, data_file_type, file_type;
type vendor_audiopcm_data_file, data_file_type, file_type;
@ -53,6 +54,7 @@ type sysfs_camera_writable, fs_type, sysfs_type;
type sysfs_fpc, fs_type, sysfs_type;
type sysfs_lcd_writable, fs_type, sysfs_type;
type sysfs_mdnie_writable, fs_type, sysfs_type;
type sysfs_power_management, fs_type, sysfs_type;
type sysfs_sec_keypad, fs_type, sysfs_type;
type sysfs_tsp, fs_type, sysfs_type;
type sysfs_wifi, fs_type, sysfs_type;

View file

@ -176,11 +176,17 @@
/(vendor|system/vendor)/bin/hw/android\.hardware\.health@2\.0-service\.samsung u:object_r:hal_health_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.keymaster@4\.0-service\.samsung u:object_r:hal_keymaster_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.light@2\.0-service\.samsung u:object_r:hal_light_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.power@1\.1-service.gts3l u:object_r:hal_power_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.usb@1\.2-service-qti u:object_r:hal_usb_default_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.livedisplay@2\.0-service\.gts3l u:object_r:hal_lineage_livedisplay_sysfs_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.touch@1\.0-service\.gts3l u:object_r:hal_lineage_touch_default_exec:s0
/(vendor|system/vendor)/bin/hw/vendor\.samsung\.hardware\.miscpower@1\.0-service u:object_r:hal_power_default_exec:s0
# perfd
/(vendor|system/vendor)/bin/perfd u:object_r:perfd_exec:s0
/data/misc/perfd(/.*)? u:object_r:perfd_data_file:s0
/data/system/perfd(/.*)? u:object_r:perfd_data_file:s0
# Rootfs
/firmware(/.*)? u:object_r:firmware_file:s0
/firmware_mnt(/.*)? u:object_r:firmware_file:s0

View file

@ -1,3 +1,8 @@
# communicate with perfd
allow hal_audio perfd:unix_stream_socket connectto;
allow hal_audio perfd_data_file:dir search;
allow hal_audio perfd_data_file:sock_file write;
allow hal_audio_default hal_bluetooth_a2dp_hwservice:hwservice_manager { add find };
allow hal_audio_default sysfs_audio_writable:file r_file_perms;

View file

@ -1,3 +1,8 @@
# communicate with perfd
allow hal_camera perfd_data_file:dir search;
allow hal_camera perfd:unix_stream_socket connectto;
allow hal_camera perfd_data_file:sock_file write;
allow hal_camera_default camera_data_file:sock_file write;
allow hal_camera_default csc_prop:file { getattr open read };

View file

@ -0,0 +1,4 @@
# communicate with perfd
allow hal_drm perfd_data_file:dir search;
allow hal_drm perfd:unix_stream_socket connectto;
allow hal_drm perfd_data_file:sock_file write;

View file

@ -0,0 +1,4 @@
# communicate with perfd
allow hal_graphics_composer_default perfd:unix_stream_socket connectto;
allow hal_graphics_composer_default perfd_data_file:dir search;
allow hal_graphics_composer_default perfd_data_file:sock_file write;

View file

@ -1,3 +1,6 @@
allow hal_perf_default post_boot_prop:file r_file_perms;
allow hal_perf_default proc_sched:file rw_file_perms;
allow hal_perf_default self:capability kill;
allow hal_perf_default self:capability dac_override;
@ -9,4 +12,6 @@ allow hal_perf_default init:unix_stream_socket connectto;
allow hal_perf_default vendor_default_prop:property_service set;
set_prop(hal_perf_default, vendor_freq_prop)
set_prop(hal_perf_default, vendor_mpctl_prop)
get_prop(hal_perf_default, sec_camera_prop)

View file

@ -0,0 +1 @@
allow hal_perf_default_exec post_boot_prop:file r_file_perms;

View file

@ -1,5 +1,11 @@
add_hwservice(hal_power_default, hal_miscpower_hwservice)
# communicate with perfd
allow hal_power perfd:unix_stream_socket connectto;
allow hal_power perfd_data_file:dir search;
allow hal_power perfd_data_file:sock_file write;
allow hal_power debugfs:file r_file_perms;
allow hal_power_default sysfs_devices_system_cpu:file rw_file_perms;
allow hal_power_default sysfs_batteryinfo:dir r_dir_perms;

9
sepolicy/mediacodec.te Normal file
View file

@ -0,0 +1,9 @@
# communicate with perfd
allow mediacodec perfd:unix_stream_socket connectto;
allow mediacodec perfd_data_file:dir search;
allow mediacodec perfd_data_file:sock_file write;
allow mediacodec mpctl_data_file:dir search;
allow mediacodec mpctl_data_file:sock_file write;
allow mediacodec mpctl_socket:dir search;
allow mediacodec mpctl_socket:sock_file write;

View file

@ -1 +1,7 @@
# communicate with perfd
allow mediadrmserver mpctl_data_file:dir search;
allow mediadrmserver mpctl_data_file:sock_file write;
allow mediadrmserver mpctl_socket:dir search;
allow mediadrmserver mpctl_socket:sock_file write;
allow mediaserver exported_camera_prop:file { open read getattr };

51
sepolicy/perfd.te Normal file
View file

@ -0,0 +1,51 @@
type perfd, domain;
type perfd_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(perfd)
allow perfd cgroup:file r_file_perms;
allow perfd cameraserver:process signull;
# files in /data/misc/perfd and /data/system/perfd
typeattribute perfd data_between_core_and_vendor_violators;
allow perfd perfd_data_file:dir create_dir_perms;
allow perfd perfd_data_file:dir create_dir_perms;
allow perfd perfd_data_file:{ file sock_file } create_file_perms;
allow perfd proc:file rw_file_perms;
allow perfd proc_sched:file r_file_perms;
# read access /sys
r_dir_file(perfd, sysfs_type)
# normally write is not granted to the default "sysfs" label.
# In this case, perfd needs access to files in /sys that are
# commonly created and destroyed. When the kernel creates them,
# they are created with the default label "sysfs". For robustness,
# allow perfd to write to "sysfs" to ensure it can optimally
# tune the power/cpu settings.
allow perfd sysfs:file write;
allow perfd sysfs_msm_perf:file write;
##allow perfd sysfs_msm_subsys:file write;
allow perfd sysfs_devices_system_cpu:file write;
allow perfd sysfs_power_management:file write;
allow perfd mpctl_data_file:dir rw_dir_perms;
allow perfd mpctl_data_file:file create_file_perms;
allow perfd mpctl_data_file:sock_file write;
allow perfd proc_sched:file w_file_perms;
allow perfd gpu_device:chr_file rw_file_perms;
allow perfd vendor_freq_prop:file { read getattr open };
allow perfd sysfs_lib:file { write };
allow perfd sysfs_msm_power:file w_file_perms;
allow perfd sysfs_cpu_boost:file w_file_perms;
allow perfd sysfs_devfreq:file w_file_perms;
allow perfd sysfs_kgsl:file w_file_perms;
# perfd uses kill(pid, 0) to determine if a process exists.
# Determining if a process exists does not require the kill capability
# since a permission denied indicates the process exists.
dontaudit perfd self:capability kill;

View file

@ -4,6 +4,7 @@ type ina_status_prop, property_type;
type receiver_error_prop, property_type;
type sec_camera_prop, property_type, file_type;
type sec_cnss_diag_prop, property_type;
type post_boot_prop, property_type;
type tzdaemon_prop, property_type;
type vendor_factory_prop, property_type;
type vendor_members_prop, property_type;

View file

@ -34,6 +34,7 @@ ro.vendor.radio. u:object_r:vendor_radio_prop:s0
service.camera. u:object_r:sec_camera_prop:s0
sys.audio.rotation u:object_r:exported_system_prop:s0
sys.cameramode. u:object_r:sec_camera_prop:s0
sys.post_boot. u:object_r:post_boot_prop:s0
system.camera.CC. u:object_r:sec_camera_prop:s0
vendor.bluetooth_fw_ver u:object_r:vendor_bluetooth_prop:s0
vendor.npu.usr_drv.log_mask u:object_r:sec_camera_prop:s0

View file

@ -19,6 +19,8 @@ allow vendor_init system_data_file:dir { add_name create setattr write };
allow vendor_init tombstone_data_file:dir getattr;
allow vendor_init emmcblk_device:blk_file getattr;
allow vendor_init perfd_data_file:dir { create search setattr getattr open read ioctl write add_name remove_name rmdir relabelfrom };
set_prop(vendor_init, camera_prop)
set_prop(vendor_init, config_prop)
set_prop(vendor_init, csc_prop)