Fix flashing
This commit is contained in:
@@ -39,8 +39,6 @@
|
||||
|
||||
package com.github.shadowsocks
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
import android.app.Notification
|
||||
import android.content.Context
|
||||
import android.os.{Handler, RemoteCallbackList}
|
||||
@@ -96,7 +94,7 @@ trait BaseService {
|
||||
}
|
||||
|
||||
def startRunner(config: Config) {
|
||||
this.config = config;
|
||||
this.config = config
|
||||
|
||||
TrafficMonitor.reset()
|
||||
trafficMonitorThread = new TrafficMonitorThread(this)
|
||||
@@ -129,7 +127,7 @@ trait BaseService {
|
||||
handler.post(() => {
|
||||
if (callbackCount > 0) {
|
||||
val n = callbacks.beginBroadcast()
|
||||
for (i <- 0 to n - 1) {
|
||||
for (i <- 0 until n) {
|
||||
try {
|
||||
callbacks.getBroadcastItem(i).trafficUpdated(txRate, rxRate, txTotal, rxTotal)
|
||||
} catch {
|
||||
@@ -146,7 +144,7 @@ trait BaseService {
|
||||
handler.post(() => if (state != s) {
|
||||
if (callbackCount > 0) {
|
||||
val n = callbacks.beginBroadcast()
|
||||
for (i <- 0 to n - 1) {
|
||||
for (i <- 0 until n) {
|
||||
try {
|
||||
callbacks.getBroadcastItem(i).stateChanged(s, msg)
|
||||
} catch {
|
||||
|
||||
@@ -40,7 +40,7 @@ package com.github.shadowsocks
|
||||
|
||||
import java.io.{FileOutputStream, IOException, InputStream, OutputStream}
|
||||
import java.util
|
||||
import java.util.{Locale, Timer, TimerTask}
|
||||
import java.util.Locale
|
||||
|
||||
import android.app.backup.BackupManager
|
||||
import android.app.{Activity, ProgressDialog}
|
||||
@@ -55,7 +55,7 @@ import android.support.v4.content.ContextCompat
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.util.Log
|
||||
import android.view.{ViewGroup, View, ViewParent}
|
||||
import android.view.{View, ViewGroup, ViewParent}
|
||||
import android.widget._
|
||||
import com.github.jorgecastilloprz.FABProgressCircle
|
||||
import com.github.shadowsocks.aidl.{IShadowsocksService, IShadowsocksServiceCallback}
|
||||
@@ -73,8 +73,7 @@ object Typefaces {
|
||||
cache synchronized {
|
||||
if (!cache.containsKey(assetPath)) {
|
||||
try {
|
||||
val t: Typeface = Typeface.createFromAsset(c.getAssets, assetPath)
|
||||
cache.put(assetPath, t)
|
||||
cache.put(assetPath, Typeface.createFromAsset(c.getAssets, assetPath))
|
||||
} catch {
|
||||
case e: Exception =>
|
||||
Log.e(TAG, "Could not get typeface '" + assetPath + "' because " + e.getMessage)
|
||||
@@ -471,6 +470,9 @@ class Shadowsocks
|
||||
|
||||
// Check if current profile changed
|
||||
if (ShadowsocksApplication.profileId != currentProfile.id) reloadProfile()
|
||||
|
||||
callback.trafficUpdated(TrafficMonitor.getTxRate, TrafficMonitor.getRxRate,
|
||||
TrafficMonitor.getTxTotal, TrafficMonitor.getRxTotal)
|
||||
}
|
||||
|
||||
private def setPreferenceEnabled(enabled: Boolean) {
|
||||
|
||||
@@ -74,10 +74,10 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
var apps: Array[ProxiedApp] = null
|
||||
val myUid = Process.myUid()
|
||||
|
||||
var sslocalPid: Int = 0;
|
||||
var sstunnelPid: Int = 0;
|
||||
var redsocksPid: Int = 0;
|
||||
var pdnsdPid: Int = 0;
|
||||
var sslocalPid: Int = 0
|
||||
var sstunnelPid: Int = 0
|
||||
var redsocksPid: Int = 0
|
||||
var pdnsdPid: Int = 0
|
||||
|
||||
private val dnsAddressCache = new SparseArray[String]
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
var vpnThread: ShadowsocksVpnThread = null
|
||||
var closeReceiver: BroadcastReceiver = null
|
||||
|
||||
var sslocalPid: Int = 0;
|
||||
var sstunnelPid: Int = 0;
|
||||
var tun2socksPid: Int = 0;
|
||||
var pdnsdPid: Int = 0;
|
||||
var sslocalPid: Int = 0
|
||||
var sstunnelPid: Int = 0
|
||||
var tun2socksPid: Int = 0
|
||||
var pdnsdPid: Int = 0
|
||||
|
||||
def isByass(net: SubnetUtils): Boolean = {
|
||||
val info = net.getInfo
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.github.shadowsocks.utils
|
||||
|
||||
import java.lang.{Math, System}
|
||||
import java.lang.System
|
||||
import java.text.DecimalFormat
|
||||
|
||||
import com.github.shadowsocks.{R, ShadowsocksApplication}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
package com.github.shadowsocks.utils
|
||||
|
||||
import java.io.{File, FileDescriptor, IOException}
|
||||
import java.io.{File, IOException}
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
import android.net.{LocalServerSocket, LocalSocket, LocalSocketAddress}
|
||||
|
||||
Reference in New Issue
Block a user