Skip to content

Commit

Permalink
refine VPN mode on L
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Nov 29, 2014
1 parent 8ee5d77 commit 4b37d88
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@

<service
android:name=".ShadowsocksVpnService"
android:process=":vpn"
android:label="@string/app_name"
android:permission="android.permission.BIND_VPN_SERVICE"
android:exported="false">
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/github/shadowsocks/Shadowsocks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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()

Expand All @@ -564,7 +552,7 @@ class ShadowsocksNatService extends Service with BaseService {
}

override def stopBackgroundService() {
stopRunner()
stopSelf()
}

override def getTag = TAG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}

override def stopBackgroundService() {
stopRunner()
stopSelf()
}

override def getTag = TAG
Expand Down

0 comments on commit 4b37d88

Please sign in to comment.