Commit b833cb62 authored by Max Lv's avatar Max Lv

Refine #530 again and again

Put ShadowsocksRunnerService into :bg process. It helped to solve #530, but
still I'm not sure why it works.

One assumption is that the startService() in BootReceiver helps to ensure :bg
process in a valid state.
parent 9c37f8ca
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
<service <service
android:name=".ShadowsocksRunnerService" android:name=".ShadowsocksRunnerService"
android:process=":bg"
android:exported="false"> android:exported="false">
</service> </service>
......
...@@ -54,11 +54,11 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext { ...@@ -54,11 +54,11 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext {
} }
override def onServiceConnected() { override def onServiceConnected() {
handler.postDelayed(() => if (bgService != null) { if (bgService != null) {
if (app.isNatEnabled) startBackgroundService() if (app.isNatEnabled) startBackgroundService()
else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService() else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService()
stopSelf() }
}, 1000) handler.postDelayed(() => stopSelf() , 1000)
} }
def startBackgroundService() = { def startBackgroundService() = {
......
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