Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fenix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
The Tor Project
Applications
fenix
Commits
0518acac
Commit
0518acac
authored
Sep 18, 2020
by
Matthew Finkel
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Bug 40028: Implement Tor Service controller
Minor improvements
parent
d01d44a7
Branches
Branches containing commit
No related tags found
1 merge request
!26
Bug 40041 09
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/org/mozilla/fenix/tor/TorController.kt
+15
-10
15 additions, 10 deletions
app/src/main/java/org/mozilla/fenix/tor/TorController.kt
with
15 additions
and
10 deletions
app/src/main/java/org/mozilla/fenix/tor/TorController.kt
+
15
−
10
View file @
0518acac
...
...
@@ -210,9 +210,7 @@ class TorController(
)
// Request service status
val
torServiceStatus
=
Intent
(
context
,
TorService
::
class
.
java
)
torServiceStatus
.
action
=
TorServiceConstants
.
ACTION_STATUS
context
.
startService
(
torServiceStatus
)
sendServiceAction
(
TorServiceConstants
.
ACTION_STATUS
)
// Wait for response and unregister receiver
var
torIsStarted
=
false
...
...
@@ -223,7 +221,7 @@ class TorController(
return
torIsStarted
}
fun
initiateTorBootstrap
(
lifecycleScope
:
LifecycleCoroutineScope
,
withDebugLogging
:
Boolean
=
false
)
{
fun
initiateTorBootstrap
(
lifecycleScope
:
LifecycleCoroutineScope
?
=
null
,
withDebugLogging
:
Boolean
=
false
)
{
if
(
BuildConfig
.
DISABLE_TOR
)
{
return
}
...
...
@@ -231,12 +229,14 @@ class TorController(
context
.
getSharedPreferences
(
"org.torproject.android_preferences"
,
Context
.
MODE_PRIVATE
)
.
edit
().
putBoolean
(
"pref_enable_logging"
,
withDebugLogging
).
apply
()
if
(
lifecycleScope
==
null
)
{
sendServiceAction
(
TorServiceConstants
.
ACTION_START
)
}
else
{
lifecycleScope
.
launch
{
val
torNeedsStart
=
!
checkTorIsStarted
()
if
(
torNeedsStart
)
{
val
torServiceStatus
=
Intent
(
context
,
TorService
::
class
.
java
)
torServiceStatus
.
action
=
TorServiceConstants
.
ACTION_START
context
.
startService
(
torServiceStatus
)
sendServiceAction
(
TorServiceConstants
.
ACTION_START
)
}
}
}
}
...
...
@@ -256,6 +256,11 @@ class TorController(
onTorStopped
()
}
private
fun
sendServiceAction
(
action
:
String
)
{
val
torServiceStatus
=
Intent
(
context
,
TorService
::
class
.
java
)
torServiceStatus
.
action
=
action
context
.
startService
(
torServiceStatus
)
}
companion
object
{
const
val
torServiceResponseTimeout
=
5000L
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment