diff --git a/universal7885-common/Android.bp b/universal7885-common/Android.bp index 9515b25..5157a47 100644 --- a/universal7885-common/Android.bp +++ b/universal7885-common/Android.bp @@ -1,2 +1,3 @@ soong_namespace { + imports: ["hardware/google/interfaces"], } diff --git a/universal7885-common/configs/thermal_info_config.json b/universal7885-common/configs/thermal_info_config.json new file mode 100644 index 0000000..143689d --- /dev/null +++ b/universal7885-common/configs/thermal_info_config.json @@ -0,0 +1,103 @@ +{ + "Sensors": [ + { + "Name": "BIG", + "Type": "CPU", + "HotThreshold": [ + "NAN", + "NAN", + "NAN", + 91.0, + "NAN", + "NAN", + 115.0 + ], + "VrThreshold": "NAN", + "Multiplier": 0.001 + }, + { + "Name": "LITTLE", + "Type": "CPU", + "HotThreshold": [ + "NAN", + "NAN", + "NAN", + 91.0, + "NAN", + "NAN", + 115.0 + ], + "VrThreshold": "NAN", + "Multiplier": 0.001 + }, + { + "Name": "G3D", + "Type": "GPU", + "HotThreshold": [ + "NAN", + "NAN", + "NAN", + 91.0, + "NAN", + "NAN", + 115.0 + ], + "VrThreshold": "NAN", + "Multiplier": 0.001 + }, + { + "Name": "ac", + "Type": "USB_PORT", + "HotThreshold": [ + "NAN", + "NAN", + "NAN", + "NAN", + "NAN", + "60.0", + "NAN" + ], + "HotHysteresis": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 5.0, + 0.0 + ], + "VrThreshold": "NAN", + "Multiplier": 0.001, + "Monitor": true + }, + { + "Name": "battery", + "Type": "BATTERY", + "HotThreshold": [ + "NAN", + "NAN", + "NAN", + "NAN", + "NAN", + "NAN", + 60.0 + ], + "VrThreshold": "NAN", + "Multiplier": 0.001 + } + ], + "CoolingDevices": [ + { + "Name": "thermal-cpufreq-0", + "Type": "CPU" + }, + { + "Name": "thermal-cpufreq-1", + "Type": "CPU" + }, + { + "Name": "thermal-gpufreq-0", + "Type": "GPU" + } + ] +} diff --git a/universal7885-common/sepolicy/vendor/device.te b/universal7885-common/sepolicy/vendor/device.te index 536d9a8..d78cd1a 100644 --- a/universal7885-common/sepolicy/vendor/device.te +++ b/universal7885-common/sepolicy/vendor/device.te @@ -10,6 +10,7 @@ type gps_device, dev_type; # /dev/goodix_fp type goodix_device, dev_type; +type thermal_link_device, dev_type; # device.te type efs_block_device, dev_type; diff --git a/universal7885-common/sepolicy/vendor/file_contexts b/universal7885-common/sepolicy/vendor/file_contexts index b926022..5cb6245 100644 --- a/universal7885-common/sepolicy/vendor/file_contexts +++ b/universal7885-common/sepolicy/vendor/file_contexts @@ -223,6 +223,10 @@ /(vendor|system/vendor)/firmware(/.*)? u:object_r:vendor_firmware_file:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.power(@[0-9]\.[0-9])?-service\.samsung-libperfmgr u:object_r:hal_power_default_exec:s0 +# Thermal +/(vendor|system/vendor)/bin/hw/android\.hardware\.thermal@2\.0-service\.pixel u:object_r:hal_thermal_default_exec:s0 +/dev/thermal/(/.*)? u:object_r:thermal_link_device:s0 + # SamsungParts /(vendor|system/vendor)/bin/hw/vendor\.eureka\.hardware\.battery@1\.0-service u:object_r:hal_battery_default_exec:s0 /(vendor|system/vendor)/bin/hw/vendor\.eureka\.hardware\.flashlight@1\.0-service u:object_r:hal_flashlight_default_exec:s0 diff --git a/universal7885-common/sepolicy/vendor/hal_thermal_default.te b/universal7885-common/sepolicy/vendor/hal_thermal_default.te index 759bdb0..42ce07e 100644 --- a/universal7885-common/sepolicy/vendor/hal_thermal_default.te +++ b/universal7885-common/sepolicy/vendor/hal_thermal_default.te @@ -1,8 +1,11 @@ - -# /acct/tasks -allow hal_thermal_default cgroup:file getattr; - -# /sys/devices/virtual/thermal/ allow hal_thermal_default sysfs_thermal:dir r_dir_perms; -allow hal_thermal_default sysfs_thermal:file r_file_perms; -r_dir_file(hal_thermal_default, sysfs_virtual) +allow hal_thermal_default sysfs_thermal:file rw_file_perms; +allow hal_thermal_default sysfs_thermal:lnk_file r_file_perms; +allow hal_thermal_default thermal_link_device:dir r_dir_perms; +allow hal_thermal_default proc_stat:file r_file_perms; + +allow hal_thermal_default self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; + +hal_client_domain(hal_thermal_default, hal_power); + +get_prop(hal_thermal_default, vendor_thermal_prop) diff --git a/universal7885-common/sepolicy/vendor/property.te b/universal7885-common/sepolicy/vendor/property.te index a8e2bca..37901cc 100644 --- a/universal7885-common/sepolicy/vendor/property.te +++ b/universal7885-common/sepolicy/vendor/property.te @@ -18,3 +18,4 @@ vendor_internal_prop(rild_prop) vendor_internal_prop(vendor_secureos_prop) vendor_internal_prop(vendor_tzdaemon_prop) vendor_internal_prop(vendor_tztsdaemon_prop) +vendor_internal_prop(vendor_thermal_prop) diff --git a/universal7885-common/sepolicy/vendor/property_contexts b/universal7885-common/sepolicy/vendor/property_contexts index 61d7007..323d56b 100644 --- a/universal7885-common/sepolicy/vendor/property_contexts +++ b/universal7885-common/sepolicy/vendor/property_contexts @@ -51,6 +51,9 @@ vendor.wlbtd. u:object_r:vendor_wlbtd_prop:s0 # Wlan vendor.wlan. u:object_r:vendor_wlan_prop:s0 +# Thermal +vendor.thermal. u:object_r:vendor_thermal_prop:s0 + # Hwc hwc.exynos.vsync_mode u:object_r:vendor_hwc_prop:s0 diff --git a/universal7885-common/sepolicy/vendor/vendor_init.te b/universal7885-common/sepolicy/vendor/vendor_init.te index 53db827..861be9a 100644 --- a/universal7885-common/sepolicy/vendor/vendor_init.te +++ b/universal7885-common/sepolicy/vendor/vendor_init.te @@ -17,3 +17,6 @@ set_prop(vendor_init, persist_data_wda_prop) set_prop(vendor_init, persist_rmnet_prop) get_prop(vendor_init, system_prop) get_prop(vendor_init, vendor_radio_prop) + +allow vendor_init thermal_link_device:dir r_dir_perms; +allow vendor_init thermal_link_device:lnk_file r_file_perms; diff --git a/universal7885-common/universal7885-common.mk b/universal7885-common/universal7885-common.mk index 2922238..64799b2 100644 --- a/universal7885-common/universal7885-common.mk +++ b/universal7885-common/universal7885-common.mk @@ -274,10 +274,13 @@ PRODUCT_SOONG_NAMESPACES += \ hardware/google/pixel \ hardware/samsung/aidl/power-libperfmgr -# Thermal +# Thermal HAL PRODUCT_PACKAGES += \ - android.hardware.thermal@1.0-impl \ - android.hardware.thermal@1.0-service + android.hardware.thermal@2.0-service.pixel \ + thermal_symlinks + +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/configs/thermal_info_config.json:$(TARGET_COPY_OUT_VENDOR)/etc/thermal_info_config.json # Vibrator PRODUCT_PACKAGES += \