Avoid service restarted by system

This commit is contained in:
Max Lv
2016-02-02 09:52:36 +08:00
parent 187cb28d15
commit 65635c6b93
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
resolvers += Resolver.url("scalasbt releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.5.14")
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.5.15")
resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
@@ -178,6 +178,9 @@ trait BaseService extends Service {
})
}
// Service of shadowsocks should always be started explicitly
override def onStartCommand(intent: Intent, flags: Int, startId: Int): Int = Service.START_NOT_STICKY
protected def changeState(s: Int, msg: String) {
val handler = new Handler(getContext.getMainLooper)
handler.post(() => if (state != s) {
@@ -335,8 +335,6 @@ class ShadowsocksNatService extends BaseService {
ConfigUtils.refresh(this)
}
override def onStartCommand(intent: Intent, flags: Int, startId: Int): Int = Service.START_STICKY
def killProcesses() {
if (sslocalProcess != null) {
sslocalProcess.destroy()