Adb Command History
I need ADB command history similar to bash history. I need a history file to be created in the Android phone. Is there any such functionality? If not, can any one point me to the
Solution 1:
I changed the code in ADBD to implement the functionality. Modified file: system/core/adb/shell_service.cpp
boolSubprocess::ForkAndExec(std::string* error){
-----------
/* Writing the command to history file just before it is executed. */addToHistory(command_.c_str());
execle(_PATH_BSHELL, _PATH_BSHELL, "-c", command_.c_str(), nullptr, cenv.data());
-----------
}
voidaddToHistory(constchar * cmd){
FILE *fp = fopen("/data/adb_history.txt", "a");
if(NULL == fp)
{
printf("ERROR\n");
return;
}
fwrite(cmd, strlen(cmd), 1, fp);
fwrite("\n", 1, 1, fp);
fclose(fp);
return;
}
For now, it is working in superuser mode only.
Post a Comment for "Adb Command History"