refine VPN mode on L

This commit is contained in:
Max Lv
2014-11-29 10:26:58 +08:00
parent 8ee5d77c6f
commit 4b37d88f74
4 changed files with 4 additions and 15 deletions
@@ -775,7 +775,7 @@ class Shadowsocks
if (pref != null) {
if (Seq(Key.isGlobalProxy, Key.proxyedApps)
.contains(name)) {
pref.setEnabled(enabled && (!isVpnEnabled))
pref.setEnabled(enabled && (Utils.isLollipopOrAbove || !isVpnEnabled))
} else {
pref.setEnabled(enabled)
}
@@ -41,7 +41,6 @@ package com.github.shadowsocks
import java.io.File
import java.lang.reflect.{InvocationTargetException, Method}
import java.util.Timer
import android.app.{Notification, NotificationManager, PendingIntent, Service}
import android.content._
@@ -86,11 +85,6 @@ class ShadowsocksNatService extends Service with BaseService {
private var mStartForegroundArgs = new Array[AnyRef](2)
private var mStopForegroundArgs = new Array[AnyRef](1)
private var lastTxRate = 0
private var lastRxRate = 0
private var timer: Timer = null
private val TIMER_INTERVAL = 2
private lazy val application = getApplication.asInstanceOf[ShadowsocksApplication]
def setDnsForAllNetwork(dns: String) {
@@ -543,12 +537,6 @@ class ShadowsocksNatService extends Service with BaseService {
.setLabel(getVersionName)
.build())
// reset timer
if (timer != null) {
timer.cancel()
timer = null
}
// reset NAT
killProcesses()
@@ -564,7 +552,7 @@ class ShadowsocksNatService extends Service with BaseService {
}
override def stopBackgroundService() {
stopRunner()
stopSelf()
}
override def getTag = TAG
@@ -479,7 +479,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
override def stopBackgroundService() {
stopRunner()
stopSelf()
}
override def getTag = TAG