【发布时间】:2013-11-21 07:18:37
【问题描述】:
我正在尝试获取命令“getprop | grep”的输出。
这是我的代码:
public static void propFinder(String Prop) {
try {
Process process = Runtime.getRuntime().exec("getprop | grep "+Prop);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
StringBuilder log=new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
log.append(line + "\n");
}
Log.e(TAG,log.toString());
} catch (IOException e) {
}
}
我想找出有关特定道具的信息。例如,“init.svc.sdcard”。
这是日志输出:
11-21 09:16:04.143: I/Choreographer(14514): Skipped 40 frames! The application may be doing too much work on its main thread.
11-21 09:16:05.583: E/PropFinder(14514): grep
忘了说,如果我只发出 getprop,我会得到一个很好的输出,但它是不完整的。 谷歌搜索,使用了我发现的所有发出命令的方法。都是一样的。
我不知道它是否有帮助,但我有可用的 roottools 库。 (尝试使用他们的方法,结果相同)。
【问题讨论】: