我正在尝试在cd /sys/class/power_supply/battery && cat uevent
中执行ADB SHELL
命令,并在信息中编织ArrayList
。但是,它无法工作,返回空。虽然当我执行ls
替换cd /sys/class/power_supply/battery && cat uevent
时,ArrayList
会被填充。虽然可以使用terminal
应用轻松访问该路径!
有什么问题?
ArrayList<String> info = new ArrayList<>();
try {
Process process = Runtime.getRuntime().exec("adb shell");
process.waitFor();
process = Runtime.getRuntime().exec("cd /sys/class/power_supply/battery && cat uevent");
BufferedReader buf = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line=buf.readLine())!=null) {
info.add(line);
}
} catch (Exception e) {
}
Log.i("INFORMATION",info.toString());
}