This repository was archived by the owner on Dec 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-14
lines changed
topl-service/src/main/java/io/matthewnelson/topl_service
service/components/binding Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -320,14 +320,16 @@ class BackgroundManager internal constructor(
320320 private fun applicationMovedToBackground () {
321321 taskIsInForeground = false
322322 if (! ServiceActionProcessor .wasLastAcceptedServiceActionStop()) {
323- // System automatically unbinds when app is sent to the background. This prevents
324- // it so that we maintain a started, bound service.
325- BaseService .bindService(
326- BaseService .getAppContext(),
327- serviceClass,
328- bindServiceFlag = bindServiceFlag
329- )
330- TorServiceConnection .serviceBinder?.executeBackgroundPolicyJob(policy, executionDelay)
323+ TorServiceConnection .serviceBinder?.let { binder ->
324+ // System automatically unbinds when app is sent to the background. This prevents
325+ // it so that we maintain a started, bound service.
326+ BaseService .bindService(
327+ BaseService .getAppContext(),
328+ serviceClass,
329+ bindServiceFlag = bindServiceFlag
330+ )
331+ binder.executeBackgroundPolicyJob(policy, executionDelay)
332+ }
331333 }
332334 }
333335}
Original file line number Diff line number Diff line change 6666* */
6767package io.matthewnelson.topl_service.service.components.binding
6868
69- import android.app.Activity
70- import android.app.Application
7169import android.os.Binder
72- import android.os.Bundle
7370import io.matthewnelson.topl_core.broadcaster.BroadcastLogger
7471import io.matthewnelson.topl_service.service.BaseService
7572import io.matthewnelson.topl_service.lifecycle.BackgroundManager
@@ -78,9 +75,7 @@ import io.matthewnelson.topl_service.service.components.actions.ServiceActions.S
7875import io.matthewnelson.topl_service.util.ServiceConsts.BackgroundPolicy
7976import kotlinx.coroutines.Job
8077import kotlinx.coroutines.delay
81- import kotlinx.coroutines.isActive
8278import kotlinx.coroutines.launch
83- import net.freehaven.tor.control.TorControlCommands
8479
8580
8681internal abstract class BaseServiceBinder (private val torService : BaseService ): Binder() {
Original file line number Diff line number Diff line change @@ -69,7 +69,6 @@ package io.matthewnelson.topl_service.util
6969import androidx.annotation.IntDef
7070import androidx.annotation.StringDef
7171import io.matthewnelson.topl_core_base.BaseConsts
72- import io.matthewnelson.topl_service.service.components.actions.ServiceActions
7372
7473abstract class ServiceConsts : BaseConsts () {
7574
You can’t perform that action at this time.
0 commit comments