commit 7dfb60b3969a6cf2722b67b941adefde60b80595
parent 0d4715e2385f0adc46993bda10d187552f400767
Author: Roger Yang <royang@mozilla.com>
Date: Fri, 31 Oct 2025 18:01:30 +0000
Bug 1978120 - Remove translations offer event probe and update translations engine support probe. r=android-reviewers,ohall
Differential Revision: https://phabricator.services.mozilla.com/D270865
Diffstat:
3 files changed, 9 insertions(+), 82 deletions(-)
diff --git a/mobile/android/fenix/app/metrics.yaml b/mobile/android/fenix/app/metrics.yaml
@@ -877,29 +877,6 @@ translations:
notification_emails:
- android-probes@mozilla.com
expires: never
- offer_event:
- type: event
- description: |
- The translations engine decided the user may be interested in a translation or that the user
- should be offered a translation.
- An "expected" event means the user is expected to want to translate and we should show the feature on the toolbar.
- An "offer" event means we should popup the translations dialog.
- extra_keys:
- item:
- description: |
- A string containing the type of signal sent by the translations engine.
- These signals include:
- expected, offer
- type: string
- bugs:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1886851
- data_reviews:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1886851#c8
- data_sensitivity:
- - interaction
- notification_emails:
- - android-probes@mozilla.com
- expires: never
translate_requested:
type: event
description: |
@@ -963,21 +940,15 @@ translations:
notification_emails:
- android-probes@mozilla.com
expires: never
- engine_supported:
+ engine_unsupported:
type: event
description: |
The translations engine for translating pages is only supported on certain devices.
- This probe indicates if the device supports the translations engine or not.
- extra_keys:
- support:
- description: |
- A string describing the support of the engine, either:
- supported, unsupported,
- type: string
+ This probe is sent when the device does not support the translations engine.
bugs:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1886221
+ - https://bugzilla.mozilla.org/show_bug.cgi?id=1978120
data_reviews:
- - https://bugzilla.mozilla.org/show_bug.cgi?id=1886221#c3
+ - https://phabricator.services.mozilla.com/D270865
data_sensitivity:
- technical
notification_emails:
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/telemetry/TelemetryMiddleware.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/telemetry/TelemetryMiddleware.kt
@@ -34,7 +34,6 @@ import org.mozilla.fenix.GleanMetrics.Urlbar
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.ext.components
-import org.mozilla.fenix.nimbus.FxNimbus
import org.mozilla.fenix.utils.Settings
import org.mozilla.fenix.GleanMetrics.EngineTab as EngineMetrics
@@ -131,13 +130,6 @@ class TelemetryMiddleware(
Urlbar.engagement.record()
}
}
- is TranslationsAction.TranslateOfferAction -> {
- Translations.offerEvent.record(Translations.OfferEventExtra("offer"))
- }
- is TranslationsAction.TranslateExpectedAction -> {
- FxNimbus.features.translations.recordExposure()
- Translations.offerEvent.record(Translations.OfferEventExtra("expected"))
- }
is TranslationsAction.TranslateAction -> {
Translations.translateRequested.record(
Translations.TranslateRequestedExtra(
@@ -159,9 +151,9 @@ class TelemetryMiddleware(
}
}
is TranslationsAction.SetEngineSupportedAction -> {
- Translations.engineSupported.record(
- Translations.EngineSupportedExtra(if (action.isEngineSupported) "supported" else "unsupported"),
- )
+ if (!action.isEngineSupported) {
+ Translations.engineUnsupported.record()
+ }
}
else -> {
// no-op
diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/telemetry/TelemetryMiddlewareTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/telemetry/TelemetryMiddlewareTest.kt
@@ -473,26 +473,6 @@ class TelemetryMiddlewareTest {
}
@Test
- fun `WHEN TranslateOfferAction is dispatched THEN update telemetry`() = runTest {
- assertNull(Translations.offerEvent.testGetValue())
-
- store.dispatch(TranslationsAction.TranslateOfferAction(tabId = "1", true)).joinBlocking()
-
- val telemetry = Translations.offerEvent.testGetValue()?.firstOrNull()
- assertEquals("offer", telemetry?.extra?.get("item"))
- }
-
- @Test
- fun `WHEN TranslateExpectedAction is dispatched THEN update telemetry`() = runTest {
- assertNull(Translations.offerEvent.testGetValue())
-
- store.dispatch(TranslationsAction.TranslateExpectedAction(tabId = "1")).joinBlocking()
-
- val telemetry = Translations.offerEvent.testGetValue()?.firstOrNull()
- assertEquals("expected", telemetry?.extra?.get("item"))
- }
-
- @Test
fun `WHEN TranslateAction is dispatched THEN update telemetry`() = runTest {
assertNull(Translations.translateRequested.testGetValue())
@@ -567,24 +547,9 @@ class TelemetryMiddlewareTest {
}
@Test
- fun `WHEN SetEngineSupportedAction is dispatched AND supported THEN update telemetry`() =
- runTest {
- assertNull(Translations.engineSupported.testGetValue())
-
- store.dispatch(
- TranslationsAction.SetEngineSupportedAction(
- isEngineSupported = true,
- ),
- ).joinBlocking()
-
- val telemetry = Translations.engineSupported.testGetValue()?.firstOrNull()
- assertEquals("supported", telemetry?.extra?.get("support"))
- }
-
- @Test
fun `WHEN SetEngineSupportedAction is dispatched AND unsupported THEN update telemetry`() =
runTest {
- assertNull(Translations.engineSupported.testGetValue())
+ assertNull(Translations.engineUnsupported.testGetValue())
store.dispatch(
TranslationsAction.SetEngineSupportedAction(
@@ -592,8 +557,7 @@ class TelemetryMiddlewareTest {
),
).joinBlocking()
- val telemetry = Translations.engineSupported.testGetValue()?.firstOrNull()
- assertEquals("unsupported", telemetry?.extra?.get("support"))
+ assertNotNull(Translations.engineUnsupported.testGetValue())
}
}