Compare commits

...
4 Commits
Author SHA1 Message Date
Max Lv acd89cc999 refine VPN mode 2014-09-02 10:02:08 +08:00
Max Lv 382af46d91 Update .travis.yml 2014-08-24 13:37:01 +08:00
Max Lv 415a9f6847 refine onTaskRemoved 2014-08-24 12:23:38 +08:00
Max Lv 91a069bc44 Update .travis.yml 2014-07-26 21:51:32 +08:00
7 changed files with 35 additions and 65 deletions
+1 -12
View File
@@ -20,18 +20,7 @@ before_install:
- export PATH=${PATH}:${ANDROID_NDK_HOME}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
- echo "y" | android update sdk --filter tools,platform-tools,build-tools-20.0.0,android-19,extra-google-m2repository --no-ui --no-https -a
- echo "y" | android update sdk --filter extra-android-m2repository --no-ui --no-https -a
install:
- gem install --version 0.8.9 faraday
- gem install travis-artifacts
script:
- ./build-ndk.sh
- cp local.properties.travis local.properties
- sbt clean android:package-release
after_success:
- ./deploy target/android-bin shadowsocks-release.apk
env:
global:
- "ARTIFACTS_AWS_REGION=us-east-1"
- "ARTIFACTS_S3_BUCKET=travis-nightly"
- secure: "GkAdnMh07id2VKhpCW16lE73A0LK2Jsk3hzkFvdx76JKW8FjLgaimLJ2T/+i\nxFfDw8XBinLE09dqg8JxSNS6JbLHLcav8P3yJIlzFh1NqfJABU9U4I8atb6P\nITSdSo9nb3LX6sB8SOU0nqXb5U+nj7jiekQqiBhmEmu6iDmMtfU="
- secure: "eCh5BjCFccp+sB/FIrjsmxJU4475D4qiWvDV++khcIHLel6lgUjDX18ImBlJ\n+IdiCKxvR6EpRDV1Cs4gJ2jZEAV0PbojQMoQOXbs1FLggM8RRq/Re1qWQFq7\nWkBRjjr8w8ddjJZHRo459cTUvgvD7krhp07coabAnEahDaGWSUo="
- sbt android:package-release
+2 -2
View File
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks"
android:versionCode="68"
android:versionName="2.2.0">
android:versionCode="69"
android:versionName="2.2.1">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
-1
View File
@@ -44,7 +44,6 @@
<string name="forward_stop">后台服务已停止。</string>
<string name="service_failed">请检查你的网络状态后并重试。</string>
<string name="stop">停止服务</string>
<string name="vpn_status">推荐通过通知栏关闭 VPN 服务</string>
<string name="vpn_error">无法启动 VPN 服务:\"%s\"。看来和你的设备存在兼容性问题,请使用 Root 模式。</string>
<string name="ok_iknow">确定</string>
<string name="port_alert">端口号应大于1024</string>
-1
View File
@@ -57,7 +57,6 @@
<string name="forward_stop">Shadowsocks stopped.</string>
<string name="service_failed">Please check your network status and try again.</string>
<string name="stop">Stop the service</string>
<string name="vpn_status">Recommend to disable the VPN service through the notification bar.</string>
<string name="vpn_error">Unable to start VPN service: "%s". It seems to be a compatibility issue with your device. Please consider using ROOT mode instead.</string>
<!-- alert category -->
@@ -919,7 +919,6 @@ class Shadowsocks
if (isVpnEnabled) {
val style = new Style.Builder().setBackgroundColorValue(Style.holoBlueLight).build()
val config = new Configuration.Builder().setDuration(Configuration.DURATION_LONG).build()
Crouton.makeText(Shadowsocks.this, R.string.vpn_status, style).setConfiguration(config).show()
changeSwitch(checked = false)
}
true
@@ -220,12 +220,12 @@ class ShadowsocksNatService extends Service with BaseService {
}
def notifyForegroundAlert(title: String, info: String, rate: Int) {
val openIntent: Intent = new Intent(this, classOf[Shadowsocks])
openIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val contentIntent: PendingIntent = PendingIntent.getActivity(this, 0, openIntent, 0)
val closeIntent: Intent = new Intent(Action.CLOSE)
val actionIntent: PendingIntent = PendingIntent.getBroadcast(this, 0, closeIntent, 0)
val builder: NotificationCompat.Builder = new NotificationCompat.Builder(this)
val openIntent = new Intent(this, classOf[Shadowsocks])
openIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
val contentIntent = PendingIntent.getActivity(this, 0, openIntent, 0)
val closeIntent = new Intent(Action.CLOSE)
val actionIntent = PendingIntent.getBroadcast(this, 0, closeIntent, 0)
val builder = new NotificationCompat.Builder(this)
val icon = getResources.getDrawable(R.drawable.ic_stat_shadowsocks)
if (rate >= 0) {
@@ -309,14 +309,6 @@ class ShadowsocksNatService extends Service with BaseService {
}
}
override def onStartCommand(intent: Intent, flags: Int, startId: Int): Int = {
Service.START_STICKY
}
override def onTaskRemoved(intent: Intent) {
stopRunner()
}
def killProcesses() {
Console.runRootCommand(Utils.getIptables + " -t nat -F OUTPUT")
@@ -564,13 +556,6 @@ class ShadowsocksNatService extends Service with BaseService {
timer = null
}
// clean up context
stopForegroundCompat(1)
if (receiver != null) {
unregisterReceiver(receiver)
receiver = null
}
// reset NAT
killProcesses()
@@ -578,6 +563,13 @@ class ShadowsocksNatService extends Service with BaseService {
if (callbackCount == 0) {
stopSelf()
}
// clean up context
if (receiver != null) {
unregisterReceiver(receiver)
receiver = null
}
stopForegroundCompat(1)
}
override def stopBackgroundService() {
@@ -118,13 +118,8 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def startVpn() {
val openIntent: Intent = new Intent(this, classOf[Shadowsocks])
openIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val configIntent = PendingIntent.getActivity(this, 0, openIntent, 0)
val builder = new Builder()
builder
.setConfigureIntent(configIntent)
.setSession(config.profileName)
.setMtu(VPN_MTU)
.addAddress(PRIVATE_VLAN.format("1"), 24)
@@ -221,17 +216,13 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
def notifyAlert(title: String, info: String) {
val openIntent: Intent = new Intent(this, classOf[Shadowsocks])
openIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val contentIntent: PendingIntent = PendingIntent.getActivity(this, 0, openIntent, 0)
val builder: NotificationCompat.Builder = new NotificationCompat.Builder(this)
val builder = new NotificationCompat.Builder(this)
builder
.setSmallIcon(R.drawable.ic_stat_shadowsocks)
.setWhen(0)
.setTicker(title)
.setContentTitle(getString(R.string.app_name))
.setContentText(info)
.setContentIntent(contentIntent)
.setAutoCancel(true)
notificationManager.notify(1, builder.build)
}
@@ -255,14 +246,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
.asInstanceOf[NotificationManager]
}
override def onStartCommand(intent: Intent, flags: Int, startId: Int): Int = {
Service.START_STICKY
}
override def onTaskRemoved(intent: Intent) {
stopRunner()
}
override def onRevoke() {
stopRunner()
}
@@ -363,12 +346,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
.set(Fields.SESSION_CONTROL, "stop")
.build())
// clean up the context
if (receiver != null) {
unregisterReceiver(receiver)
receiver = null
}
// reset VPN
killProcesses()
@@ -378,13 +355,28 @@ class ShadowsocksVpnService extends VpnService with BaseService {
conn = null
}
// reset notifications
notificationManager.cancel(1)
// stop the service if no callback registered
if (callbackCount == 0) {
stopSelf()
}
// clean up the context
if (receiver != null) {
unregisterReceiver(receiver)
receiver = null
}
// reset notifications
notificationManager.cancel(1)
}
override def onStartCommand(intent: Intent, flags: Int, startId: Int): Int =
{
Service.START_STICKY
}
override def onTaskRemoved(intent: Intent) {
stopRunner()
}
override def stopBackgroundService() {