Skip to content
Closed
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: 4 additions & 1 deletion services/core/java/com/android/server/am/AxPerfConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Comment on lines 92 to 96
Slog.i(TAG, "missing thermal config");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -453,7 +454,11 @@ private static int[] indexedValues(int count) {
}

private void publishMetadata(ArrayList<NodeControl> controls) {
ArrayMap<String, int[]> 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<String, int[]> cpuFreqs = new LinkedHashMap<>();
int[] gpuFreqs = null;
for (NodeControl control : controls) {
if (control.type == AxKernelControl.TYPE_CPU_MIN_FREQ) {
Expand All @@ -462,10 +467,11 @@ private void publishMetadata(ArrayList<NodeControl> controls) {
gpuFreqs = control.availableValues;
}
}
Settings.Secure.putIntForUser(mResolver, CPU_CLUSTER_COUNT_KEY, cpuFreqs.size(),
List<int[]> 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) {
Expand All @@ -474,7 +480,7 @@ private void publishMetadata(ArrayList<NodeControl> 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);
}
Expand Down