Pier Angelo Vendrame pushed to branch tor-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
7c54df4a
by Dan Ballard at 2024-09-05T17:58:05+00:00
5 changed files:
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Analytics.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/NimbusComponents.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/share/SaveToPDFMiddleware.kt
Changes:
... | ... | @@ -378,7 +378,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, TorIn |
378 | 378 | ?.also {
|
379 | 379 | Events.appOpened.record(Events.AppOpenedExtra(it))
|
380 | 380 | // This will record an event in Nimbus' internal event store. Used for behavioral targeting
|
381 | - components.nimbus.events.recordEvent("app_opened")
|
|
381 | + // components.nimbus.events.recordEvent("app_opened")
|
|
382 | 382 | |
383 | 383 | if (safeIntent.action.equals(ACTION_OPEN_PRIVATE_TAB) && it == APP_ICON) {
|
384 | 384 | AppIcon.newPrivateTabTapped.record(NoExtras())
|
... | ... | @@ -17,8 +17,6 @@ import mozilla.components.lib.crash.service.MozillaSocorroService |
17 | 17 | import mozilla.components.support.ktx.android.content.isMainProcess
|
18 | 18 | import mozilla.components.support.utils.BrowsersCache
|
19 | 19 | import mozilla.components.support.utils.RunWhenReadyQueue
|
20 | -import mozilla.components.service.nimbus.NimbusDisabled
|
|
21 | -import org.mozilla.fenix.nimbus.FxNimbus
|
|
22 | 20 | import org.mozilla.fenix.BuildConfig
|
23 | 21 | import org.mozilla.fenix.Config
|
24 | 22 | import org.mozilla.fenix.HomeActivity
|
... | ... | @@ -254,7 +254,7 @@ internal class TelemetryAccountObserver( |
254 | 254 | // User signed-in into an existing FxA account.
|
255 | 255 | AuthType.Signin -> {
|
256 | 256 | SyncAuth.signIn.record(NoExtras())
|
257 | - context.components.nimbus.events.recordEvent("sync_auth.sign_in")
|
|
257 | + // context.components.nimbus.events.recordEvent("sync_auth.sign_in")
|
|
258 | 258 | }
|
259 | 259 | |
260 | 260 | // User created a new FxA account.
|
... | ... | @@ -6,16 +6,21 @@ package org.mozilla.fenix.components |
6 | 6 | |
7 | 7 | import android.content.Context
|
8 | 8 | import mozilla.components.service.nimbus.NimbusApi
|
9 | +import mozilla.components.service.nimbus.NimbusDisabled
|
|
9 | 10 | import mozilla.components.service.nimbus.messaging.FxNimbusMessaging
|
11 | +import mozilla.components.service.nimbus.messaging.Message
|
|
12 | +import mozilla.components.service.nimbus.messaging.MessageMetadataStorage
|
|
10 | 13 | import mozilla.components.service.nimbus.messaging.NimbusMessagingController
|
11 | 14 | import mozilla.components.service.nimbus.messaging.NimbusMessagingControllerInterface
|
12 | 15 | import mozilla.components.service.nimbus.messaging.NimbusMessagingStorage
|
13 | 16 | import mozilla.components.service.nimbus.messaging.OnDiskMessageMetadataStorage
|
14 | 17 | import org.mozilla.experiments.nimbus.NimbusEventStore
|
15 | 18 | import org.mozilla.experiments.nimbus.NimbusMessagingHelperInterface
|
19 | +import org.mozilla.experiments.nimbus.NullNimbus
|
|
16 | 20 | import org.mozilla.fenix.BuildConfig
|
17 | 21 | import org.mozilla.fenix.experiments.createNimbus
|
18 | 22 | import org.mozilla.fenix.messaging.CustomAttributeProvider
|
23 | +import org.mozilla.fenix.nimbus.FxNimbus
|
|
19 | 24 | import org.mozilla.fenix.perf.lazyMonitored
|
20 | 25 | |
21 | 26 | /**
|
... | ... | @@ -28,7 +33,14 @@ class NimbusComponents(private val context: Context) { |
28 | 33 | * should be mediated through a FML generated class, e.g. [FxNimbus].
|
29 | 34 | */
|
30 | 35 | val sdk: NimbusApi by lazyMonitored {
|
31 | - createNimbus(context, BuildConfig.NIMBUS_ENDPOINT)
|
|
36 | + if (BuildConfig.DATA_COLLECTION_DISABLED) {
|
|
37 | + NimbusDisabled(context)
|
|
38 | + } else {
|
|
39 | + createNimbus(context, BuildConfig.NIMBUS_ENDPOINT).also { api ->
|
|
40 | + FxNimbus.api = api
|
|
41 | + }
|
|
42 | + }
|
|
43 | + |
|
32 | 44 | }
|
33 | 45 | |
34 | 46 | /**
|
... | ... | @@ -44,7 +56,8 @@ class NimbusComponents(private val context: Context) { |
44 | 56 | * the JEXL helper available from [createJexlHelper].
|
45 | 57 | */
|
46 | 58 | val events: NimbusEventStore by lazyMonitored {
|
47 | - sdk.events
|
|
59 | + NullNimbus(context)
|
|
60 | + //sdk.events
|
|
48 | 61 | }
|
49 | 62 | |
50 | 63 | /**
|
... | ... | @@ -92,10 +105,25 @@ class NimbusComponents(private val context: Context) { |
92 | 105 | private val messagingStorage by lazyMonitored {
|
93 | 106 | NimbusMessagingStorage(
|
94 | 107 | context = context,
|
95 | - metadataStorage = OnDiskMessageMetadataStorage(context),
|
|
108 | + metadataStorage = NullMessageMetadataStorage(), //OnDiskMessageMetadataStorage(context),
|
|
96 | 109 | nimbus = sdk,
|
97 | 110 | messagingFeature = FxNimbusMessaging.features.messaging,
|
98 | 111 | attributeProvider = CustomAttributeProvider,
|
99 | 112 | )
|
100 | 113 | }
|
101 | 114 | }
|
115 | +// Noop impl of MessageMetadataStorage to replace OnDiskMessageMetadataStorage
|
|
116 | +class NullMessageMetadataStorage(): MessageMetadataStorage {
|
|
117 | + override suspend fun getMetadata(): Map<String, Message.Metadata> {
|
|
118 | + var metadataMap: MutableMap<String, Message.Metadata> = hashMapOf()
|
|
119 | + return metadataMap
|
|
120 | + }
|
|
121 | + |
|
122 | + override suspend fun addMetadata(metadata: Message.Metadata): Message.Metadata {
|
|
123 | + return metadata
|
|
124 | + }
|
|
125 | + |
|
126 | + override suspend fun updateMetadata(metadata: Message.Metadata) {
|
|
127 | + // noop
|
|
128 | + }
|
|
129 | +} |
... | ... | @@ -154,7 +154,7 @@ class SaveToPDFMiddleware( |
154 | 154 | source = telemetrySource(isPdf),
|
155 | 155 | ),
|
156 | 156 | )
|
157 | - nimbusEventStore.recordEvent("print_tapped")
|
|
157 | + // nimbusEventStore.recordEvent("print_tapped")
|
|
158 | 158 | } else {
|
159 | 159 | Events.saveToPdfTapped.record(
|
160 | 160 | Events.SaveToPdfTappedExtra(
|