CPU Info overlay update

Change-Id: Ifc83235f5f52925ec2056405361e6a44c1b4fe23
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
2026-01-01 18:15:43 +07:00
parent 8cd8b9c9ef
commit 9a9c50c943

View File

@@ -52,6 +52,7 @@ public class CPUInfoService extends Service {
private String[] mCurrLoad = null;
private int CPU_TEMP_DIVIDER = 1;
private int BATTERY_TEMP_DIVIDER = 10;
private String CPU_TEMP_SENSOR = "";
private String GPU_TEMP_SENSOR = "";
private String BATTERY_TEMP_SENSOR = "";
@@ -182,13 +183,17 @@ public class CPUInfoService extends Service {
}
private String getTemp(String rawTemp) {
return getTemp(rawTemp, CPU_TEMP_DIVIDER);
}
private String getTemp(String rawTemp, int divider) {
try {
float temp = Float.parseFloat(rawTemp);
if (temp > 10000) {
return String.format("%.2f", temp / 1000.0f);
}
if (CPU_TEMP_DIVIDER > 1) {
return String.format("%.2f", temp / CPU_TEMP_DIVIDER);
if (divider > 1) {
return String.format("%.2f", temp / divider);
} else {
return rawTemp;
}
@@ -226,7 +231,7 @@ public class CPUInfoService extends Service {
}
if(!mBatTemp.equals("0")) {
canvas.drawText("BAT: " + getTemp(mBatTemp) + " °C",
canvas.drawText("BAT: " + getTemp(mBatTemp, BATTERY_TEMP_DIVIDER) + " °C",
RIGHT-mPaddingRight-mMaxWidth, y-1, mOnlinePaint);
y += mFH;
}
@@ -260,7 +265,7 @@ public class CPUInfoService extends Service {
if(mFpsAvail) maxW = Math.max(maxW, (int)mOnlinePaint.measureText("FPS: " + mFps));
if(!mCpuTemp.equals("0")) maxW = Math.max(maxW, (int)mOnlinePaint.measureText("CPU: " + getTemp(mCpuTemp) + " °C"));
if(!mGpuTemp.equals("0")) maxW = Math.max(maxW, (int)mOnlinePaint.measureText("GPU: " + getTemp(mGpuTemp) + " °C"));
if(!mBatTemp.equals("0")) maxW = Math.max(maxW, (int)mOnlinePaint.measureText("BAT: " + getTemp(mBatTemp) + " °C"));
if(!mBatTemp.equals("0")) maxW = Math.max(maxW, (int)mOnlinePaint.measureText("BAT: " + getTemp(mBatTemp, BATTERY_TEMP_DIVIDER) + " °C"));
for(int i=0; i<mCurrFreq.length; i++){
String s = getCPUInfoString(i);