Stop a daemon before starting it
in case the daemon is not cleaned up in last session.
This commit is contained in:
@@ -106,6 +106,13 @@ public class AndroidServiceProxy extends ProcessProxy {
|
||||
@Override
|
||||
protected void performTask() throws IOException {
|
||||
String svc = mServiceName;
|
||||
Log.d(mTag, "----- Stop the daemon just in case: " + mServiceName);
|
||||
SystemProperties.set(SVC_STOP_CMD, mServiceName);
|
||||
if (!blockUntil(SVC_STATE_STOPPED, 5)) {
|
||||
throw new IOException("cannot start service anew: " + svc
|
||||
+ ", it is still running");
|
||||
}
|
||||
|
||||
Log.d(mTag, "+++++ Start: " + svc);
|
||||
SystemProperties.set(SVC_START_CMD, svc);
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ public class VpnServiceBinder extends Service {
|
||||
public void onStart (Intent intent, int startId) {
|
||||
super.onStart(intent, startId);
|
||||
setForeground(true);
|
||||
android.util.Log.d("VpnServiceBinder", "becomes a foreground service");
|
||||
}
|
||||
|
||||
public IBinder onBind(Intent intent) {
|
||||
|
||||
Reference in New Issue
Block a user