我尝试读取当前的 cpu 频率。经过一番研究,我发现了以下代码:
public String ReadCPUMhz2() throws IOException
{
String[] args = {"/system/bin/cat", "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"};
ProcessBuilder cmd;
cmd = new ProcessBuilder(args);
Process process = null;
process = cmd.start();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
StringBuilder log=new StringBuilder();
String line;
Log.d("test","aha");
while ((line = bufferedReader.readLine()) != null) {
log.append(line + "\n");
}
Log.d("test",log.toString());
return log.toString();
}
但这无济于事。Logcat 在 while 循环之前显示“aha”,但“log”似乎是空的。我看不出我做错了什么:s?
PS:抱歉英语不好。