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:
@@ -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() = {
|
||||
|
||||
Reference in New Issue
Block a user