RootTools
RootTools copied to clipboard
commandOutput not being executed
public Boolean getState(int number) {
final String[] response = new String[1];
Log.d("GET1", "num: "+number);
Command getStateCmd = new Command(0, "cat /sys/devices/system/cpu/cpu" + number + "/online") {
@Override
public void commandOutput(int id, String line) {
response[0] = line;
Log.d("GET2", "line: "+line);
super.commandOutput(id, line);
}
@Override
public void commandCompleted(int id, int exitcode) {
Log.d("GET2", "exitcode: " + exitcode);
super.commandCompleted(id, exitcode);
}
@Override
public void commandTerminated(int id, String reason) {
Log.d("GET2", "reason: " + reason);
super.commandTerminated(id, reason);
}
};
try {
RootTools.getShell(true).add(getStateCmd);
}catch (IOException | RootDeniedException | TimeoutException ex) {
ex.printStackTrace();
}
Log.d("GET3", "response: "+response[0]);
Logcat returns:
03-20 23:22:26.679 32757-32757/? D/GET1: num: 1
03-20 23:22:37.564 32757-32757/? D/GET3: response: null
It looks like that none of command* methods being executed.