From 659655a91ae352243d5f11d7aefd5a52fa051149 Mon Sep 17 00:00:00 2001 From: Zarathos30 Date: Thu, 3 Sep 2026 20:09:36 +0200 Subject: [PATCH] fix the thermal config path and the cluster order AxPerfConfig only looked in /vendor/etc and /system/etc, while device/axion/common installs ax_perf_thermal.xml in /system_ext/etc, so no platform was parsing its thermal config. Read system_ext first, keeping the old paths as fallback. publishMetadata() indexed an ArrayMap keyed by group, which iterates by ascending key hashCode, so the published cluster order followed the hash of the group names instead of the config file. On a live POCO F7, ax_cpu_small_freqs holds the table of policy7. Use a LinkedHashMap. Change-Id: Ic50484d827acfe2ce5c0e4354cbd22db1c3f340f Signed-off-by: Zarathos30 --- .../java/com/android/server/am/AxPerfConfig.java | 5 ++++- .../server/kernel/AxKernelManagerService.java | 16 +++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/am/AxPerfConfig.java b/services/core/java/com/android/server/am/AxPerfConfig.java index 931d557bcd212..73faf89e4f5b1 100644 --- a/services/core/java/com/android/server/am/AxPerfConfig.java +++ b/services/core/java/com/android/server/am/AxPerfConfig.java @@ -35,6 +35,8 @@ public final class AxPerfConfig { + private static final String SYSTEM_EXT_THERMAL_CONFIG = + "/system_ext/etc/ax_perf_thermal.xml"; private static final String VENDOR_THERMAL_CONFIG = "/vendor/etc/ax_perf_thermal.xml"; private static final String SYSTEM_THERMAL_CONFIG = "/system/etc/ax_perf_thermal.xml"; private static final String ROOT_TAG = "perf-config"; @@ -88,7 +90,8 @@ public static AxAdvancedThermalMitigationConfig getAtmc() { private static synchronized void ensureLoaded() { if (sLoaded) return; sLoaded = true; - boolean loaded = loadFrom(VENDOR_THERMAL_CONFIG, ATMC_TAG) + boolean loaded = loadFrom(SYSTEM_EXT_THERMAL_CONFIG, ATMC_TAG) + || loadFrom(VENDOR_THERMAL_CONFIG, ATMC_TAG) || loadFrom(SYSTEM_THERMAL_CONFIG, ATMC_TAG); if (!loaded) { Slog.i(TAG, "missing thermal config"); diff --git a/services/core/java/com/android/server/kernel/AxKernelManagerService.java b/services/core/java/com/android/server/kernel/AxKernelManagerService.java index 1ccc9f13d1af1..228e5e016e8ba 100644 --- a/services/core/java/com/android/server/kernel/AxKernelManagerService.java +++ b/services/core/java/com/android/server/kernel/AxKernelManagerService.java @@ -37,6 +37,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Objects; import java.util.TreeSet; @@ -453,7 +454,11 @@ private static int[] indexedValues(int count) { } private void publishMetadata(ArrayList controls) { - ArrayMap cpuFreqs = new ArrayMap<>(); + // The config file declares the clusters from little to prime and the role of + // each published entry is derived from its index, so the order has to be the + // one of the file: ArrayMap iterates by ascending key hashCode instead, which + // publishes the clusters in an order unrelated to the config. + LinkedHashMap cpuFreqs = new LinkedHashMap<>(); int[] gpuFreqs = null; for (NodeControl control : controls) { if (control.type == AxKernelControl.TYPE_CPU_MIN_FREQ) { @@ -462,10 +467,11 @@ private void publishMetadata(ArrayList controls) { gpuFreqs = control.availableValues; } } - Settings.Secure.putIntForUser(mResolver, CPU_CLUSTER_COUNT_KEY, cpuFreqs.size(), + List clusters = new ArrayList<>(cpuFreqs.values()); + Settings.Secure.putIntForUser(mResolver, CPU_CLUSTER_COUNT_KEY, clusters.size(), UserHandle.USER_CURRENT); - for (int i = 0; i < cpuFreqs.size(); i++) { - int[] freqs = cpuFreqs.valueAt(i); + for (int i = 0; i < clusters.size(); i++) { + int[] freqs = clusters.get(i); Settings.Secure.putStringForUser(mResolver, clusterFreqsKey(i), join(freqs), UserHandle.USER_CURRENT); if (i == 0) { @@ -474,7 +480,7 @@ private void publishMetadata(ArrayList controls) { } else if (i == 1) { Settings.Secure.putStringForUser(mResolver, "ax_cpu_big_freqs", join(freqs), UserHandle.USER_CURRENT); - } else if (i == cpuFreqs.size() - 1) { + } else if (i == clusters.size() - 1) { Settings.Secure.putStringForUser(mResolver, "ax_cpu_prime_freqs", join(freqs), UserHandle.USER_CURRENT); }