Commit b84936e0 authored by Max Lv's avatar Max Lv

fix a FC

parent 5b4e36cd
...@@ -119,8 +119,7 @@ class ShadowsocksService extends Service { ...@@ -119,8 +119,7 @@ class ShadowsocksService extends Service {
private var mStopForegroundArgs = new Array[AnyRef](1) private var mStopForegroundArgs = new Array[AnyRef](1)
private var state = State.INIT private var state = State.INIT
private var last = new TrafficStat(TrafficStats.getUidTxBytes(getApplicationInfo.uid), private var last: TrafficStat = null
TrafficStats.getUidRxBytes(getApplicationInfo.uid), java.lang.System.currentTimeMillis())
private var lastTxRate = 0 private var lastTxRate = 0
private var lastRxRate = 0 private var lastRxRate = 0
private val timer = new Timer(true) private val timer = new Timer(true)
...@@ -379,10 +378,10 @@ class ShadowsocksService extends Service { ...@@ -379,10 +378,10 @@ class ShadowsocksService extends Service {
mStopForeground = getClass.getMethod("stopForeground", mStopForegroundSignature: _*) mStopForeground = getClass.getMethod("stopForeground", mStopForegroundSignature: _*)
} catch { } catch {
case e: NoSuchMethodException => { case e: NoSuchMethodException => {
mStartForeground = ({ mStartForeground = {
mStopForeground = null mStopForeground = null
mStopForeground mStopForeground
}) }
} }
} }
try { try {
...@@ -425,6 +424,8 @@ class ShadowsocksService extends Service { ...@@ -425,6 +424,8 @@ class ShadowsocksService extends Service {
} }
} }
} }
last = new TrafficStat(TrafficStats.getUidTxBytes(getApplicationInfo.uid),
TrafficStats.getUidRxBytes(getApplicationInfo.uid), java.lang.System.currentTimeMillis())
timer.schedule(task, TIMER_INTERVAL*1000, TIMER_INTERVAL*1000) timer.schedule(task, TIMER_INTERVAL*1000, TIMER_INTERVAL*1000)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment