diff options
author | Hung-ying Tyan <tyanh@google.com> | 2009-07-18 11:12:40 +0800 |
---|---|---|
committer | Hung-ying Tyan <tyanh@google.com> | 2009-07-19 09:33:56 +0800 |
commit | 2c53de69045557a51290b50dfda2ddb6c7d01912 (patch) | |
tree | 6d685b333a6d4b39d8d68813005995f1ac84094d /packages/VpnServices/src/com/android/server/vpn | |
parent | a8d5644b548263d68e2c9bfff58958b29c3525ff (diff) | |
download | frameworks_base-2c53de69045557a51290b50dfda2ddb6c7d01912.zip frameworks_base-2c53de69045557a51290b50dfda2ddb6c7d01912.tar.gz frameworks_base-2c53de69045557a51290b50dfda2ddb6c7d01912.tar.bz2 |
Stop a daemon before starting it
in case the daemon is not cleaned up in last session.
Diffstat (limited to 'packages/VpnServices/src/com/android/server/vpn')
-rw-r--r-- | packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java | 7 | ||||
-rw-r--r-- | packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java b/packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java index c6c9452..e4c070f 100644 --- a/packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java +++ b/packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java @@ -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); diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java index 7eb3287..32b8e51 100644 --- a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java +++ b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java @@ -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) { |