Commit 4ee9eea2 authored by Max Lv's avatar Max Lv

clean up

parent fbcf90e6
...@@ -221,8 +221,7 @@ class AppManager extends SherlockActivity with OnCheckedChangeListener with OnCl ...@@ -221,8 +221,7 @@ class AppManager extends SherlockActivity with OnCheckedChangeListener with OnCl
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
this.setContentView(R.layout.layout_apps) this.setContentView(R.layout.layout_apps)
this.overlay = View.inflate(this, R.layout.overlay, null).asInstanceOf[TextView] this.overlay = View.inflate(this, R.layout.overlay, null).asInstanceOf[TextView]
getWindowManager getWindowManager.addView(overlay, new
.addView(overlay, new
WindowManager.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.TYPE_APPLICATION,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
......
...@@ -250,7 +250,6 @@ class ShadowVpnService extends VpnService { ...@@ -250,7 +250,6 @@ class ShadowVpnService extends VpnService {
val t: Thread = new Thread { val t: Thread = new Thread {
override def run() { override def run() {
Exec.waitFor(-pid) Exec.waitFor(-pid)
Log.d(TAG, "Successfully exit pid: " + pid)
} }
} }
t.start() t.start()
...@@ -326,16 +325,13 @@ class ShadowVpnService extends VpnService { ...@@ -326,16 +325,13 @@ class ShadowVpnService extends VpnService {
+ "--socks-server-addr 127.0.0.1:%d " + "--socks-server-addr 127.0.0.1:%d "
+ "--tunfd %d " + "--tunfd %d "
+ "--tunmtu %d " + "--tunmtu %d "
+ "--pid %stun2socks.pid") + "--pid %stun2socks.pid").format(localAddress.format(2), udpgw, localPort, fd, VPN_MTU, BASE)
.format(localAddress.format(2), udpgw, localPort, fd, VPN_MTU, BASE)
Log.d(TAG, cmd)
System.exec(cmd) System.exec(cmd)
} }
/** Called when the activity is first created. */ /** Called when the activity is first created. */
def handleConnection: Boolean = { def handleConnection: Boolean = {
startShadowsocksDaemon() startShadowsocksDaemon()
startVpn() startVpn()
true true
......
...@@ -276,7 +276,6 @@ class ShadowsocksService extends Service { ...@@ -276,7 +276,6 @@ class ShadowsocksService extends Service {
val t: Thread = new Thread { val t: Thread = new Thread {
override def run() { override def run() {
Exec.waitFor(-pid) Exec.waitFor(-pid)
Log.d(TAG, "Successfully exit pid: " + pid)
} }
} }
t.start() t.start()
...@@ -498,8 +497,7 @@ class ShadowsocksService extends Service { ...@@ -498,8 +497,7 @@ class ShadowsocksService extends Service {
} }
} }
if (isGlobalProxy || isBypassApps) { if (isGlobalProxy || isBypassApps) {
http_sb http_sb.append(if (hasRedirectSupport) {
.append(if (hasRedirectSupport) {
Utils.getIptables + CMD_IPTABLES_REDIRECT_ADD_SOCKS Utils.getIptables + CMD_IPTABLES_REDIRECT_ADD_SOCKS
} else { } else {
Utils.getIptables + CMD_IPTABLES_DNAT_ADD_SOCKS Utils.getIptables + CMD_IPTABLES_DNAT_ADD_SOCKS
...@@ -515,13 +513,11 @@ class ShadowsocksService extends Service { ...@@ -515,13 +513,11 @@ class ShadowsocksService extends Service {
} }
for (uid <- uidSet) { for (uid <- uidSet) {
if (!isBypassApps) { if (!isBypassApps) {
http_sb http_sb.append((if (hasRedirectSupport) {
.append((if (hasRedirectSupport) {
Utils.getIptables + CMD_IPTABLES_REDIRECT_ADD_SOCKS Utils.getIptables + CMD_IPTABLES_REDIRECT_ADD_SOCKS
} else { } else {
Utils.getIptables + CMD_IPTABLES_DNAT_ADD_SOCKS Utils.getIptables + CMD_IPTABLES_DNAT_ADD_SOCKS
}) }).replace("-t nat", "-t nat -m owner --uid-owner " + uid))
.replace("-t nat", "-t nat -m owner --uid-owner " + uid))
} else { } else {
init_sb.append(cmd_bypass.replace("-d 0.0.0.0", "-m owner --uid-owner " + uid)) init_sb.append(cmd_bypass.replace("-d 0.0.0.0", "-m owner --uid-owner " + uid))
} }
......
...@@ -8,15 +8,14 @@ class PasswordEditTextPreference(context: Context, attrs: AttributeSet, defStyle ...@@ -8,15 +8,14 @@ class PasswordEditTextPreference(context: Context, attrs: AttributeSet, defStyle
extends EditTextPreference(context, attrs, defStyle) { extends EditTextPreference(context, attrs, defStyle) {
def this(context: Context, attrs: AttributeSet) = { def this(context: Context, attrs: AttributeSet) = {
this (context, attrs, android.R.attr.editTextPreferenceStyle) this(context, attrs, android.R.attr.editTextPreferenceStyle)
mDefaultSummary = getSummary mDefaultSummary = getSummary
} }
override def setSummary(summary: CharSequence) { override def setSummary(summary: CharSequence) {
if (summary.toString.isEmpty) { if (summary.toString.isEmpty) {
super.setSummary(mDefaultSummary) super.setSummary(mDefaultSummary)
} } else {
else {
super.setSummary(summary.toString.map(c => "*").mkString) super.setSummary(summary.toString.map(c => "*").mkString)
} }
} }
......
...@@ -8,15 +8,14 @@ class SummaryEditTextPreference(context: Context, attrs: AttributeSet, defStyle: ...@@ -8,15 +8,14 @@ class SummaryEditTextPreference(context: Context, attrs: AttributeSet, defStyle:
extends EditTextPreference(context, attrs, defStyle) { extends EditTextPreference(context, attrs, defStyle) {
def this(context: Context, attrs: AttributeSet) = { def this(context: Context, attrs: AttributeSet) = {
this (context, attrs, android.R.attr.editTextPreferenceStyle) this(context, attrs, android.R.attr.editTextPreferenceStyle)
mDefaultSummary = getSummary mDefaultSummary = getSummary
} }
override def setSummary(summary: CharSequence) { override def setSummary(summary: CharSequence) {
if (summary.toString.isEmpty) { if (summary.toString.isEmpty) {
super.setSummary(mDefaultSummary) super.setSummary(mDefaultSummary)
} } else {
else {
super.setSummary(summary) super.setSummary(summary)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment