Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
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
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
2511a1c1
Verified
Commit
2511a1c1
authored
Dec 21, 2023
by
Dan Ballard
Committed by
Pier Angelo Vendrame
Jan 15, 2024
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Bug 42247: Android helpers for the TorProvider
Fix settings loading issues and saving
parent
972359d7
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!889
Bug 42366: Tor Browser 115.7.0esr alpha rebase
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorIntegrationAndroid.java
+30
-11
30 additions, 11 deletions
...ain/java/org/mozilla/geckoview/TorIntegrationAndroid.java
toolkit/modules/TorAndroidIntegration.sys.mjs
+8
-2
8 additions, 2 deletions
toolkit/modules/TorAndroidIntegration.sys.mjs
with
38 additions
and
13 deletions
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorIntegrationAndroid.java
+
30
−
11
View file @
2511a1c1
...
...
@@ -7,6 +7,7 @@
package
org.mozilla.geckoview
;
import
android.content.Context
;
import
android.os.AsyncTask
;
import
android.util.Log
;
import
androidx.annotation.AnyThread
;
...
...
@@ -129,7 +130,11 @@ public class TorIntegrationAndroid implements BundleEventListener {
}
else
if
(
EVENT_MEEK_STOP
.
equals
(
event
))
{
stopMeek
(
message
,
callback
);
}
else
if
(
EVENT_SETTINGS_READY
.
equals
(
event
))
{
loadSettings
(
message
);
try
{
new
SettingsLoader
().
execute
(
message
);
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"SettingsLoader error: "
+
e
.
toString
());
}
}
else
if
(
EVENT_BOOTSTRAP_STATE_CHANGED
.
equals
(
event
))
{
String
state
=
message
.
getString
(
"state"
);
for
(
BootstrapStateChangeListener
listener:
mBootstrapStateListeners
)
{
...
...
@@ -155,14 +160,24 @@ public class TorIntegrationAndroid implements BundleEventListener {
}
}
private
void
loadSettings
(
GeckoBundle
message
)
{
private
class
SettingsLoader
extends
AsyncTask
<
GeckoBundle
,
Void
,
TorSettings
>
{
protected
TorSettings
doInBackground
(
GeckoBundle
...
messages
)
{
GeckoBundle
message
=
messages
[
0
];
TorSettings
settings
;
if
(
TorLegacyAndroidSettings
.
unmigrated
())
{
mS
ettings
=
TorLegacyAndroidSettings
.
loadTorSettings
();
setSettings
(
mS
ettings
);
s
ettings
=
TorLegacyAndroidSettings
.
loadTorSettings
();
setSettings
(
s
ettings
,
true
,
true
);
TorLegacyAndroidSettings
.
setMigrated
();
}
else
{
GeckoBundle
bundle
=
message
.
getBundle
(
"settings"
);
mSettings
=
new
TorSettings
(
bundle
);
settings
=
new
TorSettings
(
bundle
);
}
return
settings
;
}
@Override
protected
void
onPostExecute
(
TorSettings
torSettings
)
{
mSettings
=
torSettings
;
}
}
...
...
@@ -508,8 +523,12 @@ public class TorIntegrationAndroid implements BundleEventListener {
return
EventDispatcher
.
getInstance
().
queryBundle
(
EVENT_SETTINGS_GET
);
}
public
@NonNull
GeckoResult
<
Void
>
setSettings
(
final
TorSettings
settings
)
{
return
EventDispatcher
.
getInstance
().
queryVoid
(
EVENT_SETTINGS_SET
,
settings
.
asGeckoBundle
());
public
@NonNull
GeckoResult
<
Void
>
setSettings
(
final
TorSettings
settings
,
boolean
save
,
boolean
apply
)
{
GeckoBundle
bundle
=
new
GeckoBundle
(
3
);
bundle
.
putBoolean
(
"save"
,
save
);
bundle
.
putBoolean
(
"apply"
,
apply
);
bundle
.
putBundle
(
"settings"
,
settings
.
asGeckoBundle
());
return
EventDispatcher
.
getInstance
().
queryVoid
(
EVENT_SETTINGS_SET
,
bundle
);
}
public
@NonNull
GeckoResult
<
Void
>
applySettings
()
{
...
...
This diff is collapsed.
Click to expand it.
toolkit/modules/TorAndroidIntegration.sys.mjs
+
8
−
2
View file @
2511a1c1
...
...
@@ -136,13 +136,19 @@ class TorAndroidIntegrationImpl {
return
;
case
ListenedEvents
.
settingsSet
:
// This does not throw, so we do not have any way to report the error!
lazy
.
TorSettings
.
setSettings
(
data
);
lazy
.
TorSettings
.
setSettings
(
data
.
settings
);
if
(
data
.
save
)
{
lazy
.
TorSettings
.
saveToPrefs
();
}
if
(
data
.
apply
)
{
lazy
.
TorSettings
.
applySettings
();
}
break
;
case
ListenedEvents
.
settingsApply
:
await
lazy
.
TorSettings
.
applySettings
();
break
;
case
ListenedEvents
.
settingsSave
:
await
lazy
.
TorSettings
.
save
Setting
s
();
await
lazy
.
TorSettings
.
save
ToPref
s
();
break
;
case
ListenedEvents
.
bootstrapBegin
:
lazy
.
TorConnect
.
beginBootstrap
();
...
...
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