am 2c53de69: Stop a daemon before starting it

Merge commit '2c53de69045557a51290b50dfda2ddb6c7d01912'

* commit '2c53de69045557a51290b50dfda2ddb6c7d01912':
  Stop a daemon before starting it
This commit is contained in:
Hung-ying Tyan
2009-07-19 21:14:44 -07:00
committed by Android Git Automerger
2 changed files with 8 additions and 0 deletions

View File

@@ -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);

View File

@@ -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) {