Add ShadowsocksDeathRecipient

This commit is contained in:
chentao
2016-02-25 00:00:33 +08:00
parent f6cab9b99c
commit 1bb3a6bf5d
@@ -0,0 +1,28 @@
package com.github.shadowsocks
import android.os.IBinder
import android.util.Log
import com.github.shadowsocks.utils.ProcessUtils._
/**
* @author chentaov5@gmail.com
*/
class ShadowsocksDeathRecipient(val mContext: ServiceBoundContext)
extends IBinder.DeathRecipient {
val TAG = "ShadowsocksDeathRecipient"
override def binderDied(): Unit = {
Log.d(TAG, "[ShadowsocksDeathRecipient] binder died.")
mContext match {
case ss: Shadowsocks =>
inShadowsocks {
ss.unregisterCallback
ss.bindToService()
}
case _ =>
}
}
}