diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 759095db13..6ac6bfb2c4 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -80,6 +80,7 @@ diff --git a/src/main/scala/com/github/shadowsocks/Shadowsocks.scala b/src/main/scala/com/github/shadowsocks/Shadowsocks.scala index 4140e77da6..016b0e70a4 100644 --- a/src/main/scala/com/github/shadowsocks/Shadowsocks.scala +++ b/src/main/scala/com/github/shadowsocks/Shadowsocks.scala @@ -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) } diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala index 6d162c21e5..d991dcd381 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala @@ -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 diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala index b2ac3597e4..30bde0779d 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala @@ -479,7 +479,7 @@ class ShadowsocksVpnService extends VpnService with BaseService { } override def stopBackgroundService() { - stopRunner() + stopSelf() } override def getTag = TAG