stop the service in time

This commit is contained in:
Max Lv
2014-02-24 12:41:14 +08:00
parent 4bbbc6b730
commit a21a4d24fa
5 changed files with 44 additions and 4 deletions
@@ -252,6 +252,10 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
override def onRevoke() {
stopRunner()
}
def killProcesses() {
val sb = new StringBuilder
@@ -373,6 +377,16 @@ class ShadowsocksVpnService extends VpnService with BaseService {
// reset notifications
notificationManager.cancel(1)
// stop the service if no callback registered
if (callbackCount == 0) {
stopSelf()
}
}
override def stopBackgroundService() {
stopRunner()
stopSelf()
}
override def getTag = TAG