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.
This commit is contained in:
Max Lv
2016-07-12 13:36:23 +08:00
parent 9c37f8cae6
commit b833cb6267
2 changed files with 4 additions and 3 deletions
+1
View File
@@ -118,6 +118,7 @@
<service
android:name=".ShadowsocksRunnerService"
android:process=":bg"
android:exported="false">
</service>
@@ -54,11 +54,11 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext {
}
override def onServiceConnected() {
handler.postDelayed(() => if (bgService != null) {
if (bgService != null) {
if (app.isNatEnabled) startBackgroundService()
else if (VpnService.prepare(ShadowsocksRunnerService.this) == null) startBackgroundService()
stopSelf()
}, 1000)
}
handler.postDelayed(() => stopSelf() , 1000)
}
def startBackgroundService() = {