sm8350-common: parts: Fix setting default thermal profile

When the app's default thermal profile was different from the standard
one, it resulted in not being able to set it back to the default mode.

Fixes 37a15544 ("sm8350-common: parts: Automatically determine thermal profile for apps")

Change-Id: I5029cfc72194a93f7ab693b6b6aa966066d7c3bf
This commit is contained in:
Adithya R 2024-09-13 16:19:09 +05:30 committed by DigiGoon
parent b22a046986
commit 8907b9860a

View file

@ -43,7 +43,7 @@ import java.util.Map;
public final class ThermalUtils {
private static final String THERMAL_CONTROL = "thermal_control";
private static final String THERMAL_CONTROL = "thermal_control_v2";
protected static final int STATE_DEFAULT = 0;
protected static final int STATE_BENCHMARK = 1;
@ -75,6 +75,7 @@ public final class ThermalUtils {
private static final String THERMAL_NAVIGATION = "thermal.navigation=";
private static final String THERMAL_STREAMING = "thermal.streaming=";
private static final String THERMAL_VIDEO = "thermal.video=";
private static final String THERMAL_DEFAULT = "thermal.default=";
private static final String THERMAL_SCONFIG = "/sys/class/thermal/thermal_message/sconfig";
@ -105,7 +106,7 @@ public final class ThermalUtils {
if (value == null || value.isEmpty()) {
value = THERMAL_BENCHMARK + ":" + THERMAL_BROWSER + ":" + THERMAL_CAMERA + ":" +
THERMAL_DIALER + ":" + THERMAL_GAMING + ":" + THERMAL_NAVIGATION + ":" +
THERMAL_STREAMING + ":" + THERMAL_VIDEO;
THERMAL_STREAMING + ":" + THERMAL_VIDEO + ":" + THERMAL_DEFAULT;
writeValue(value);
}
return value;
@ -142,10 +143,13 @@ public final class ThermalUtils {
case STATE_VIDEO:
modes[7] = modes[7] + packageName + ",";
break;
case STATE_DEFAULT:
modes[8] = modes[8] + packageName + ",";
break;
}
finalString = modes[0] + ":" + modes[1] + ":" + modes[2] + ":" + modes[3] + ":" +
modes[4] + ":" + modes[5] + ":" + modes[6] + ":" + modes[7];
modes[4] + ":" + modes[5] + ":" + modes[6] + ":" + modes[7] + ":" + modes[8];
writeValue(finalString);
}
@ -170,6 +174,8 @@ public final class ThermalUtils {
state = STATE_STREAMING;
} else if (modes[7].contains(packageName + ",")) {
state = STATE_VIDEO;
} else if (modes[8].contains(packageName + ",")) {
state = STATE_DEFAULT;
} else {
// derive a default state based on package name
state = getDefaultStateForPackage(packageName);