Skip to content
Snippets Groups Projects
Commit d7ced859 authored by Matthias Goebl's avatar Matthias Goebl
Browse files

added intent to stop dropbear daemon by calling...

added intent to stop dropbear daemon by calling br.com.bott.droidsshd.system.DroidSSHdService with the content "stop"
(so KebabApps' Llama can start/stop the service depending on location profiles)
parent 23091495
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -78,6 +78,12 @@ public class DroidSSHdService extends Service{
}
private void handleStart(Intent intent, int flags, int startId) {
String data = intent.getDataString();
if ( data != null && data.contentEquals("stop") ) {
handleStop();
return;
}
setUpPidFileWatchdog(Base.getDropbearTmpDirPath());
if (serviceHandler!=null) {
serviceHandler.post(new updateDaemonStatus());
Loading
Loading
@@ -98,6 +104,28 @@ public class DroidSSHdService extends Service{
}
private void handleStop() {
if ((Base.getDropbearDaemonStatus()==Base.DAEMON_STATUS_STARTED) ||
Base.getDropbearDaemonStatus()==Base.DAEMON_STATUS_STARTING) {
if (Base.debug) {
Log.d(TAG, "handleStop called, stopping dropbear daemon");
}
Base.setDropbearDaemonStatus(Base.DAEMON_STATUS_STOPPING);
int pid = Util.getDropbearPidFromPidFile(Base.getDropbearPidFilePath());
if(Base.debug) {
Log.d(TAG, "stopDropbear() killing pid " + pid);
Log.d(TAG, "dropbearDaemonStatus = Base.DAEMON_STATUS_STOPPING");
}
String cmd = "kill -2 " + pid;
//Util.doRun(cmd, Base.runDaemonAsRoot(), mLogviewHandler);
Util.doRun(cmd, Base.runDaemonAsRoot(), null);
Util.releaseWakeLock();
Util.releaseWifiLock();
hideNotification();
} else {
if (Base.debug) {
Log.d(TAG, "handleStop called, but dropbear is not running");
}
}
if (mPidWatchdog!=null) {
mPidWatchdog.stopWatching();
mPidWatchdog = null;
Loading
Loading
@@ -108,6 +136,7 @@ public class DroidSSHdService extends Service{
 
@Override
public void onDestroy() {
Log.d(TAG, "onDestroy called");
handleStop();
super.onDestroy();
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment