clean up
This commit is contained in:
@@ -221,8 +221,7 @@ class AppManager extends SherlockActivity with OnCheckedChangeListener with OnCl
|
||||
super.onCreate(savedInstanceState)
|
||||
this.setContentView(R.layout.layout_apps)
|
||||
this.overlay = View.inflate(this, R.layout.overlay, null).asInstanceOf[TextView]
|
||||
getWindowManager
|
||||
.addView(overlay, new
|
||||
getWindowManager.addView(overlay, new
|
||||
WindowManager.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.TYPE_APPLICATION,
|
||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
|
||||
|
||||
@@ -250,7 +250,6 @@ class ShadowVpnService extends VpnService {
|
||||
val t: Thread = new Thread {
|
||||
override def run() {
|
||||
Exec.waitFor(-pid)
|
||||
Log.d(TAG, "Successfully exit pid: " + pid)
|
||||
}
|
||||
}
|
||||
t.start()
|
||||
@@ -326,16 +325,13 @@ class ShadowVpnService extends VpnService {
|
||||
+ "--socks-server-addr 127.0.0.1:%d "
|
||||
+ "--tunfd %d "
|
||||
+ "--tunmtu %d "
|
||||
+ "--pid %stun2socks.pid")
|
||||
.format(localAddress.format(2), udpgw, localPort, fd, VPN_MTU, BASE)
|
||||
+ "--pid %stun2socks.pid").format(localAddress.format(2), udpgw, localPort, fd, VPN_MTU, BASE)
|
||||
|
||||
Log.d(TAG, cmd)
|
||||
System.exec(cmd)
|
||||
}
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
def handleConnection: Boolean = {
|
||||
|
||||
startShadowsocksDaemon()
|
||||
startVpn()
|
||||
true
|
||||
|
||||
@@ -276,7 +276,6 @@ class ShadowsocksService extends Service {
|
||||
val t: Thread = new Thread {
|
||||
override def run() {
|
||||
Exec.waitFor(-pid)
|
||||
Log.d(TAG, "Successfully exit pid: " + pid)
|
||||
}
|
||||
}
|
||||
t.start()
|
||||
@@ -498,8 +497,7 @@ class ShadowsocksService extends Service {
|
||||
}
|
||||
}
|
||||
if (isGlobalProxy || isBypassApps) {
|
||||
http_sb
|
||||
.append(if (hasRedirectSupport) {
|
||||
http_sb.append(if (hasRedirectSupport) {
|
||||
Utils.getIptables + CMD_IPTABLES_REDIRECT_ADD_SOCKS
|
||||
} else {
|
||||
Utils.getIptables + CMD_IPTABLES_DNAT_ADD_SOCKS
|
||||
@@ -515,13 +513,11 @@ class ShadowsocksService extends Service {
|
||||
}
|
||||
for (uid <- uidSet) {
|
||||
if (!isBypassApps) {
|
||||
http_sb
|
||||
.append((if (hasRedirectSupport) {
|
||||
http_sb.append((if (hasRedirectSupport) {
|
||||
Utils.getIptables + CMD_IPTABLES_REDIRECT_ADD_SOCKS
|
||||
} else {
|
||||
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 {
|
||||
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
|
||||
extends EditTextPreference(context, attrs, defStyle) {
|
||||
|
||||
def this(context: Context, attrs: AttributeSet) = {
|
||||
this (context, attrs, android.R.attr.editTextPreferenceStyle)
|
||||
this(context, attrs, android.R.attr.editTextPreferenceStyle)
|
||||
mDefaultSummary = getSummary
|
||||
}
|
||||
|
||||
override def setSummary(summary: CharSequence) {
|
||||
if (summary.toString.isEmpty) {
|
||||
super.setSummary(mDefaultSummary)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
super.setSummary(summary.toString.map(c => "*").mkString)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,14 @@ class SummaryEditTextPreference(context: Context, attrs: AttributeSet, defStyle:
|
||||
extends EditTextPreference(context, attrs, defStyle) {
|
||||
|
||||
def this(context: Context, attrs: AttributeSet) = {
|
||||
this (context, attrs, android.R.attr.editTextPreferenceStyle)
|
||||
this(context, attrs, android.R.attr.editTextPreferenceStyle)
|
||||
mDefaultSummary = getSummary
|
||||
}
|
||||
|
||||
override def setSummary(summary: CharSequence) {
|
||||
if (summary.toString.isEmpty) {
|
||||
super.setSummary(mDefaultSummary)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
super.setSummary(summary)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user