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 fixup! Bug 40185: [android] Use NimbusDisabled
Bug 43016: Redisable Nimbus
- - - - -
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:
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt ===================================== @@ -378,7 +378,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, TorIn ?.also { Events.appOpened.record(Events.AppOpenedExtra(it)) // This will record an event in Nimbus' internal event store. Used for behavioral targeting - components.nimbus.events.recordEvent("app_opened") + // components.nimbus.events.recordEvent("app_opened")
if (safeIntent.action.equals(ACTION_OPEN_PRIVATE_TAB) && it == APP_ICON) { AppIcon.newPrivateTabTapped.record(NoExtras())
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Analytics.kt ===================================== @@ -17,8 +17,6 @@ import mozilla.components.lib.crash.service.MozillaSocorroService import mozilla.components.support.ktx.android.content.isMainProcess import mozilla.components.support.utils.BrowsersCache import mozilla.components.support.utils.RunWhenReadyQueue -import mozilla.components.service.nimbus.NimbusDisabled -import org.mozilla.fenix.nimbus.FxNimbus import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.Config import org.mozilla.fenix.HomeActivity
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt ===================================== @@ -254,7 +254,7 @@ internal class TelemetryAccountObserver( // User signed-in into an existing FxA account. AuthType.Signin -> { SyncAuth.signIn.record(NoExtras()) - context.components.nimbus.events.recordEvent("sync_auth.sign_in") + // context.components.nimbus.events.recordEvent("sync_auth.sign_in") }
// User created a new FxA account.
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/NimbusComponents.kt ===================================== @@ -6,16 +6,21 @@ package org.mozilla.fenix.components
import android.content.Context import mozilla.components.service.nimbus.NimbusApi +import mozilla.components.service.nimbus.NimbusDisabled import mozilla.components.service.nimbus.messaging.FxNimbusMessaging +import mozilla.components.service.nimbus.messaging.Message +import mozilla.components.service.nimbus.messaging.MessageMetadataStorage import mozilla.components.service.nimbus.messaging.NimbusMessagingController import mozilla.components.service.nimbus.messaging.NimbusMessagingControllerInterface import mozilla.components.service.nimbus.messaging.NimbusMessagingStorage import mozilla.components.service.nimbus.messaging.OnDiskMessageMetadataStorage import org.mozilla.experiments.nimbus.NimbusEventStore import org.mozilla.experiments.nimbus.NimbusMessagingHelperInterface +import org.mozilla.experiments.nimbus.NullNimbus import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.experiments.createNimbus import org.mozilla.fenix.messaging.CustomAttributeProvider +import org.mozilla.fenix.nimbus.FxNimbus import org.mozilla.fenix.perf.lazyMonitored
/** @@ -28,7 +33,14 @@ class NimbusComponents(private val context: Context) { * should be mediated through a FML generated class, e.g. [FxNimbus]. */ val sdk: NimbusApi by lazyMonitored { - createNimbus(context, BuildConfig.NIMBUS_ENDPOINT) + if (BuildConfig.DATA_COLLECTION_DISABLED) { + NimbusDisabled(context) + } else { + createNimbus(context, BuildConfig.NIMBUS_ENDPOINT).also { api -> + FxNimbus.api = api + } + } + }
/** @@ -44,7 +56,8 @@ class NimbusComponents(private val context: Context) { * the JEXL helper available from [createJexlHelper]. */ val events: NimbusEventStore by lazyMonitored { - sdk.events + NullNimbus(context) + //sdk.events }
/** @@ -92,10 +105,25 @@ class NimbusComponents(private val context: Context) { private val messagingStorage by lazyMonitored { NimbusMessagingStorage( context = context, - metadataStorage = OnDiskMessageMetadataStorage(context), + metadataStorage = NullMessageMetadataStorage(), //OnDiskMessageMetadataStorage(context), nimbus = sdk, messagingFeature = FxNimbusMessaging.features.messaging, attributeProvider = CustomAttributeProvider, ) } } +// Noop impl of MessageMetadataStorage to replace OnDiskMessageMetadataStorage +class NullMessageMetadataStorage(): MessageMetadataStorage { + override suspend fun getMetadata(): Map<String, Message.Metadata> { + var metadataMap: MutableMap<String, Message.Metadata> = hashMapOf() + return metadataMap + } + + override suspend fun addMetadata(metadata: Message.Metadata): Message.Metadata { + return metadata + } + + override suspend fun updateMetadata(metadata: Message.Metadata) { + // noop + } +}
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/share/SaveToPDFMiddleware.kt ===================================== @@ -154,7 +154,7 @@ class SaveToPDFMiddleware( source = telemetrySource(isPdf), ), ) - nimbusEventStore.recordEvent("print_tapped") + // nimbusEventStore.recordEvent("print_tapped") } else { Events.saveToPdfTapped.record( Events.SaveToPdfTappedExtra(
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/7c54df4a...