Skip to content

Commit 13db9d6

Browse files
committed
cpu temp display test
1 parent 4d79aca commit 13db9d6

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

.github/workflows/attach_debug_apks_to_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ jobs:
7171
repo_token: ${{ secrets.GITHUB_TOKEN }}
7272
file: "**/*.apk"
7373
file_glob: true
74-
release_name: "v1.0.7-beta"
75-
tag: 1.0.7
74+
release_name: "v1.0.7b1-beta"
75+
tag: 1.0.7b1
7676
checksums: sha256,sha512,md5

app/src/main/java/com/termux/app/TermuxActivity.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,22 @@ public List<ProcessInfo> collectProcessorInfo(String tag) {
499499
return processInfoList.isEmpty() ? null : processInfoList;
500500
}
501501

502+
@Override
503+
public int readProcessInfoFileANumber() {
504+
String fileAPath = TERMUX_TMP_PREFIX_DIR_PATH + "/a"; // 更简洁的路径拼接
505+
506+
if (!file.exists() || !file.isFile()) {
507+
return -1;
508+
}
509+
510+
try (BufferedReader reader = new BufferedReader(new FileReader(fileAPath))) {
511+
String line = reader.readLine(); // 只读取第一行
512+
return line != null ? Integer.parseInt(line.trim()) : -1;
513+
} catch (IOException | NumberFormatException e) {
514+
return -1; // 统一错误返回
515+
}
516+
}
517+
502518
@Override
503519
public void setFloatBallMenu(boolean enableFloatBallMenu, boolean enableGlobalFloatBallMenu) {
504520
if (mFloatBallMenuClient != null) {

termux-x11/src/main/java/com/termux/x11/controller/winhandler/TaskManagerDialog.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,14 @@ private void updateCPUInfoView() {
202202
int avgClockSpeed = totalClockSpeed / clockSpeeds.length;
203203
TextView tvCPUTitle = findViewById(R.id.TVCPUTitle);
204204
byte cpuUsagePercent = (byte) (((float) avgClockSpeed / maxClockSpeed) * 100.0f);
205-
tvCPUTitle.setText("CPU (" + cpuUsagePercent + "%)");
205+
// tvCPUTitle.setText("CPU (" + cpuUsagePercent + "%)");
206+
// 读取文件a的数字
207+
int fileValue = readProcessInfoFileANumber();
208+
209+
// 设置标题(格式示例:"CPU (42%) [123]")
210+
tvCPUTitle.setText(
211+
"CPU (" + cpuUsagePercent + "%) [" + (fileValue != -1 ? fileValue : "N/A") + "]"
212+
);
206213
}
207214

208215
private void updateMemoryInfoView() {

0 commit comments

Comments
 (0)