Skip to content
This repository has been archived by the owner on Jul 23, 2023. It is now read-only.

Commit

Permalink
Improved management of the adb server
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorenzoantonelli committed Sep 25, 2020
1 parent 3d5c30d commit 0846868
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/lorenzoantonelli/tapdebloater/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ public static void main(String[] args) {

@Override
public void stop(){
new AdbUtils().removeTool();
MainController.shutdown();
AdbUtils temp=new AdbUtils();
temp.removeTool();
temp.killAdbServer();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public void initialize(){

scheduler.scheduleWithFixedDelay(currentApp,0,1,TimeUnit.SECONDS);
scheduler2.scheduleWithFixedDelay(installTool,0,2,TimeUnit.SECONDS);

utils.startAdbServer();
}

@FXML
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/lorenzoantonelli/tapdebloater/core/AdbUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ public AdbUtils(){
adbPath=(isWindows)? "adb.exe":((os.contains("mac"))?"./adb-macos":"./adb-linux");
}

/**
* Starts the adb server.
*/
public void startAdbServer(){
runShell(adbPath + " start-server");
}

/**
* Kills the adb server
*/
public void killAdbServer(){
runShell(adbPath+" kill-server");
}

/**
* Runs the shell command given in input and returns the result as a String.
* @param command the command to execute.
Expand Down

0 comments on commit 0846868

Please sign in to comment.