Matthew Finkel pushed to branch tor-browser-82.1.1-10.0-1 at The Tor Project / Applications / fenix
Commits:
-
5c08ba43
by Matthew Finkel at 2020-10-27T23:12:50+00:00
-
636f214a
by Matthew Finkel at 2020-10-29T19:53:19+00:00
-
b3df7adb
by Matthew Finkel at 2020-10-30T14:57:49+00:00
2 changed files:
- app/src/main/java/org/mozilla/fenix/FenixApplication.kt
- app/src/main/java/org/mozilla/fenix/tor/bootstrap/TorQuickStart.kt
Changes:
| ... | ... | @@ -160,8 +160,10 @@ open class FenixApplication : LocaleAwareApplication(), Provider { |
| 160 | 160 |
runBlocking { megazordSetup.await(); }
|
| 161 | 161 |
}
|
| 162 | 162 |
|
| 163 |
- // Give TAS the base Context
|
|
| 164 |
- Prefs.setContext(applicationContext)
|
|
| 163 |
+ GlobalScope.launch(Dispatchers.IO) {
|
|
| 164 |
+ // Give TAS the base Context
|
|
| 165 |
+ Prefs.setContext(applicationContext)
|
|
| 166 |
+ }
|
|
| 165 | 167 |
}
|
| 166 | 168 |
|
| 167 | 169 |
setupLeakCanary()
|
| ... | ... | @@ -6,20 +6,24 @@ package org.mozilla.fenix.tor.bootstrap |
| 6 | 6 |
|
| 7 | 7 |
import android.content.Context
|
| 8 | 8 |
import android.content.SharedPreferences
|
| 9 |
+import android.os.StrictMode
|
|
| 9 | 10 |
import androidx.annotation.VisibleForTesting
|
| 10 | 11 |
import mozilla.components.support.ktx.android.content.PreferencesHolder
|
| 11 | 12 |
import mozilla.components.support.ktx.android.content.booleanPreference
|
| 13 |
+import org.mozilla.fenix.ext.resetPoliciesAfter
|
|
| 12 | 14 |
|
| 13 | 15 |
class TorQuickStart(context: Context) : PreferencesHolder {
|
| 14 | 16 |
|
| 15 |
- override val preferences: SharedPreferences = context.getSharedPreferences(
|
|
| 16 |
- PREF_NAME_TOR_BOOTSTRAP_KEY,
|
|
| 17 |
- Context.MODE_PRIVATE
|
|
| 18 |
- )
|
|
| 17 |
+ override val preferences: SharedPreferences = StrictMode.allowThreadDiskReads().resetPoliciesAfter {
|
|
| 18 |
+ context.getSharedPreferences(
|
|
| 19 |
+ PREF_NAME_TOR_BOOTSTRAP_KEY,
|
|
| 20 |
+ Context.MODE_PRIVATE
|
|
| 21 |
+ )
|
|
| 22 |
+ }
|
|
| 19 | 23 |
|
| 20 | 24 |
private var torQuickStart by booleanPreference(TOR_QUICK_START, default = false)
|
| 21 | 25 |
|
| 22 |
- fun quickStartTor() = torQuickStart
|
|
| 26 |
+ fun quickStartTor() = StrictMode.allowThreadDiskReads().resetPoliciesAfter { torQuickStart }
|
|
| 23 | 27 |
|
| 24 | 28 |
fun enableQuickStartTor() {
|
| 25 | 29 |
torQuickStart = true
|