Rust thermal HAL: module test build (dodge / OnePlus 13) What changed - android.hardware.thermal-service.qti rewritten in Rust: same name, rc service, VINTF fragment (IThermal V2), SELinux label, root user. Same sensors, thresholds and limits profile selection for sun (soc 618/639/705/706); other SoC tables dropped (none is built). - One netlink socket and thread for the kernel thermal sampling and event groups (was libnl, two sockets, two threads). Links only libbinder_ndk, liblog and libc. - Fixed from the C++: - at the top level of a sensor (e.g. skin at 90 C) the trip point was written as garbage (NaN cast to int, usually 0 C), so the zone tripped continuously; the trip now stays at the current threshold and reports the drop - zones were looked up by name prefix in arbitrary directory order, with a process-wide chdir; now exact name first, then the lowest numbered prefix match - one unreadable zone made getTemperatures return nothing; now only that zone is skipped - the netlink thread looked sensors up without the lock while new zones were added, and started before the cooling devices were known - trip events re-evaluated the severity with the previous reading; the zone is read now - the 5 unit hysteresis was applied to volts and amps (vbat at 3.2 V could never clear); vbat uses 0.1 V, ibat 0.5 A - the rc "on boot ... restart android.thermal-hal" named no service; removed (zones that appear later are picked up by the netlink zone-create event, as before) - Not merged into the power HAL process yet: that needs the power HAL's SELinux domain to serve IThermal with root sysfs/netlink access. Waiting for the user's decision. Sources (server1 ~/penguin-dodge, local, not pushed; any ROM built from this tree now includes this HAL) - vendor/qcom/opensource/thermal-hal 8e877d7 "thermal-hal: Rewrite the HAL in Rust" - Unit tests on the host: severity 5/5, netlink parsing 4/4. Device tests (config tables, zone matching) in the -test binary, not run yet. ARB: not applicable. Not a flashable zip; the test bind-mounts one file over /vendor until reboot. The rc edit is not covered by the swap (it only removes a dead action). How to test (root). Not tested on a device yet. 1. Copy this folder to the phone, e.g. /data/local/tmp/thermal-rust 2. Unit tests first: cp android.hardware.thermal-service.qti-test /data/local/tmp/ ; chmod 755 it; run it (as root, it reads sysfs). 3. su -c sh test-thermal-rust.sh Swaps the HAL (the framework reconnects by itself, no restart), saves dumpsys thermalservice before and after and must print "PASS: same sensors and thresholds". A MISMATCH can mean wrong thermal power-off levels: revert and report it. 4. su -c sh emul-thermal-rust.sh (about 30 s, CPUs may throttle meanwhile) Expected with the skin thresholds 48/49/50/60/61/90 C and 2 C hysteresis: emul 47000: mStatus=0 trip1 48000 emul 48500: mStatus=1 trip1 49000 hyst1 3000 emul 49500: mStatus=2 trip1 50000 hyst1 3000 emul 50500: mStatus=3 trip1 60000 hyst1 12000 emul 47000: mStatus=2 trip1 50000 hyst1 3000 (hysteresis holds MODERATE) emul 45000: mStatus=0 trip1 48000 5. su -c sh check-thermal-rust.sh after a few minutes of normal use. Rollback - Reboot, or: su -c sh revert-thermal-rust.sh - Last known-good ROM: https://unicorn.serverhive.in/saikiran/dodge/1811/g627/ Update 2026-11-18 15:20 IST (Yoga Claude): device-tested on OP13, PASS - thermal-hal 55acbe1: cooling devices registered after the HAL starts are now picked up (THERMAL_GENL_EVENT_CDEV_ADD). The 8 modem cooling devices register ~20 s after boot, so at boot both the old C++ and the first Rust build missed them (the old rc restart that should have caught them named no service). Severity logs no longer print the r# prefix. - test/revert scripts: bind before restarting. servicemanager restarts vendor.thermal-hal the moment it stops (declared IThermal interface), so the old order relaunched the C++ binary. - Device result: unit 11/11; framework sees the same sensors and thresholds as C++ (plus the 3 modem cooling devices the boot-time C++ missed); skin emulation 47-50.5-45 C gives the same status/trip/hysteresis as C++ at every step; no crash, no AVC from a clean start. - Not testable without a reboot: the late cooling-device add at boot (check dumpsys thermalservice for modem_*_dsc after flashing a ROM with this build). Service sha256 is now 4c160fd29c10c7b4799e9a37f991f7be3d9c781186776aaaece099e10da1b7a2.