Obsolete code cleanup
This commit is contained in:
@@ -60,7 +60,7 @@ trait BaseService extends Service {
|
||||
|
||||
final val callbacks = new RemoteCallbackList[IShadowsocksServiceCallback]
|
||||
var callbacksCount: Int = _
|
||||
lazy val handler = new Handler(getContext.getMainLooper)
|
||||
lazy val handler = new Handler(getMainLooper)
|
||||
|
||||
private val closeReceiver: BroadcastReceiver = (context: Context, intent: Intent) => {
|
||||
Toast.makeText(context, R.string.stopping, Toast.LENGTH_SHORT).show()
|
||||
@@ -69,10 +69,6 @@ trait BaseService extends Service {
|
||||
var closeReceiverRegistered: Boolean = _
|
||||
|
||||
val binder = new IShadowsocksService.Stub {
|
||||
override def getMode: Int = {
|
||||
getServiceMode
|
||||
}
|
||||
|
||||
override def getState: Int = {
|
||||
state
|
||||
}
|
||||
@@ -125,7 +121,7 @@ trait BaseService extends Service {
|
||||
def startRunner(config: Config) {
|
||||
this.config = config
|
||||
|
||||
startService(new Intent(getContext, getClass))
|
||||
startService(new Intent(this, getClass))
|
||||
TrafficMonitor.reset()
|
||||
trafficMonitorThread = new TrafficMonitorThread(getApplicationContext)
|
||||
trafficMonitorThread.start()
|
||||
@@ -176,16 +172,9 @@ trait BaseService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
def getServiceMode: Int
|
||||
def getTag: String
|
||||
def getContext: Context
|
||||
|
||||
def getState: Int = {
|
||||
state
|
||||
}
|
||||
def changeState(s: Int) {
|
||||
changeState(s, null)
|
||||
}
|
||||
|
||||
def updateTrafficRate() {
|
||||
handler.post(() => {
|
||||
@@ -210,8 +199,8 @@ 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)
|
||||
protected def changeState(s: Int, msg: String = null) {
|
||||
val handler = new Handler(getMainLooper)
|
||||
handler.post(() => if (state != s) {
|
||||
if (callbacksCount > 0) {
|
||||
val n = callbacks.beginBroadcast()
|
||||
|
||||
Reference in New Issue
Block a user