From 1e05446283e3eed367cdef32f0c5070f6cee383b Mon Sep 17 00:00:00 2001 From: Elise Richards Date: Mon, 30 Aug 2021 14:35:36 -0700 Subject: [PATCH] [fenix] Remove tip telemetry --- app/metrics.yaml | 56 ------------------- .../mozilla/fenix/components/metrics/Event.kt | 16 ------ .../components/metrics/GleanMetricsService.kt | 13 ----- .../providers/MasterPasswordTipProvider.kt | 4 -- .../fenix/home/tips/ButtonTipViewHolder.kt | 8 --- .../home/tips/ButtonTipViewHolderTest.kt | 9 +-- 6 files changed, 1 insertion(+), 105 deletions(-) diff --git a/app/metrics.yaml b/app/metrics.yaml index 7cd40f20de..53f91f05f0 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -2363,62 +2363,6 @@ history: - android-probes@mozilla.com expires: "2022-08-01" -tip: - displayed: - type: event - description: | - The tip was displayed - extra_keys: - identifier: - description: "The identifier of the tip displayed" - bugs: - - https://github.com/mozilla-mobile/fenix/issues/9328 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/9836 - - https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068 - - https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789 - data_sensitivity: - - interaction - notification_emails: - - android-probes@mozilla.com - expires: "2021-08-01" - pressed: - type: event - description: | - The tip's button was pressed - extra_keys: - identifier: - description: "The identifier of the tip the action was taken on" - bugs: - - https://github.com/mozilla-mobile/fenix/issues/9328 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/9836 - - https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068 - - https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789 - data_sensitivity: - - interaction - notification_emails: - - android-probes@mozilla.com - expires: "2021-08-01" - closed: - type: event - description: | - The tip was closed - extra_keys: - identifier: - description: "The identifier of the tip closed" - bugs: - - https://github.com/mozilla-mobile/fenix/issues/9328 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/9836 - - https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068 - - https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789 - data_sensitivity: - - interaction - notification_emails: - - android-probes@mozilla.com - expires: "2021-08-01" - reader_mode: available: type: event diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt index 3015d39e00..0dc2a18e79 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt @@ -22,7 +22,6 @@ import org.mozilla.fenix.GleanMetrics.Onboarding import org.mozilla.fenix.GleanMetrics.ProgressiveWebApp import org.mozilla.fenix.GleanMetrics.SearchShortcuts import org.mozilla.fenix.GleanMetrics.TabsTray -import org.mozilla.fenix.GleanMetrics.Tip import org.mozilla.fenix.GleanMetrics.ToolbarSettings import org.mozilla.fenix.GleanMetrics.TopSites import org.mozilla.fenix.GleanMetrics.TrackingProtection @@ -351,21 +350,6 @@ sealed class Event { get() = hashMapOf(Addons.openAddonSettingKeys.addonId to addonId) } - data class TipDisplayed(val identifier: String) : Event() { - override val extras: Map? - get() = hashMapOf(Tip.displayedKeys.identifier to identifier) - } - - data class TipPressed(val identifier: String) : Event() { - override val extras: Map? - get() = hashMapOf(Tip.pressedKeys.identifier to identifier) - } - - data class TipClosed(val identifier: String) : Event() { - override val extras: Map? - get() = hashMapOf(Tip.closedKeys.identifier to identifier) - } - data class ToolbarPositionChanged(val position: Position) : Event() { enum class Position { TOP, BOTTOM } diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt index 24c8e9b509..5185ca84cf 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt @@ -54,7 +54,6 @@ import org.mozilla.fenix.GleanMetrics.SyncedTabs import org.mozilla.fenix.GleanMetrics.Tab import org.mozilla.fenix.GleanMetrics.Tabs import org.mozilla.fenix.GleanMetrics.TabsTray -import org.mozilla.fenix.GleanMetrics.Tip import org.mozilla.fenix.GleanMetrics.ToolbarSettings import org.mozilla.fenix.GleanMetrics.TopSites import org.mozilla.fenix.GleanMetrics.TrackingProtection @@ -541,18 +540,6 @@ private val Event.wrapper: EventWrapper<*>? { Addons.openAddonSetting.record(it) }, { Addons.openAddonSettingKeys.valueOf(it) } ) - is Event.TipDisplayed -> EventWrapper( - { Tip.displayed.record(it) }, - { Tip.displayedKeys.valueOf(it) } - ) - is Event.TipPressed -> EventWrapper( - { Tip.pressed.record(it) }, - { Tip.pressedKeys.valueOf(it) } - ) - is Event.TipClosed -> EventWrapper( - { Tip.closed.record(it) }, - { Tip.closedKeys.valueOf(it) } - ) is Event.VoiceSearchTapped -> EventWrapper( { VoiceSearch.tapped.record(it) } ) diff --git a/app/src/main/java/org/mozilla/fenix/components/tips/providers/MasterPasswordTipProvider.kt b/app/src/main/java/org/mozilla/fenix/components/tips/providers/MasterPasswordTipProvider.kt index b2c156b05c..95e582962c 100644 --- a/app/src/main/java/org/mozilla/fenix/components/tips/providers/MasterPasswordTipProvider.kt +++ b/app/src/main/java/org/mozilla/fenix/components/tips/providers/MasterPasswordTipProvider.kt @@ -27,12 +27,10 @@ import mozilla.components.service.sync.logins.toLogin import mozilla.components.support.migration.FennecLoginsMPImporter import mozilla.components.support.migration.FennecProfile import org.mozilla.fenix.R -import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.tips.Tip import org.mozilla.fenix.components.tips.TipProvider import org.mozilla.fenix.components.tips.TipType import org.mozilla.fenix.ext.components -import org.mozilla.fenix.ext.metrics import org.mozilla.fenix.ext.settings /** @@ -214,8 +212,6 @@ class MasterPasswordTipProvider( private fun dismissMPTip() { tip?.let { - context.metrics.track(Event.TipClosed(it.identifier)) - context.components.settings.preferences .edit() .putBoolean(it.identifier, false) diff --git a/app/src/main/java/org/mozilla/fenix/home/tips/ButtonTipViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/tips/ButtonTipViewHolder.kt index cd4f6cb021..972659b78c 100644 --- a/app/src/main/java/org/mozilla/fenix/home/tips/ButtonTipViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/tips/ButtonTipViewHolder.kt @@ -9,8 +9,6 @@ import androidx.core.view.isVisible import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R -import org.mozilla.fenix.components.metrics.Event -import org.mozilla.fenix.components.metrics.MetricController import org.mozilla.fenix.components.tips.Tip import org.mozilla.fenix.components.tips.TipType import org.mozilla.fenix.databinding.ButtonTipItemBinding @@ -23,7 +21,6 @@ import org.mozilla.fenix.utils.view.ViewHolder class ButtonTipViewHolder( private val view: View, private val interactor: SessionControlInteractor, - private val metrics: MetricController = view.context.components.analytics.metrics, private val settings: Settings = view.context.components.settings ) : ViewHolder(view) { @@ -35,8 +32,6 @@ class ButtonTipViewHolder( this.tip = tip - metrics.track(Event.TipDisplayed(tip.identifier)) - with(binding) { tipHeaderText.text = tip.title tip.titleDrawable?.let { @@ -60,12 +55,9 @@ class ButtonTipViewHolder( tipButton.setOnClickListener { tip.type.action.invoke() - metrics.track(Event.TipPressed(tip.identifier)) } tipClose.setOnClickListener { - metrics.track(Event.TipClosed(tip.identifier)) - settings.preferences .edit() .putBoolean(tip.identifier, false) diff --git a/app/src/test/java/org/mozilla/fenix/home/tips/ButtonTipViewHolderTest.kt b/app/src/test/java/org/mozilla/fenix/home/tips/ButtonTipViewHolderTest.kt index 505109faad..a34617a565 100644 --- a/app/src/test/java/org/mozilla/fenix/home/tips/ButtonTipViewHolderTest.kt +++ b/app/src/test/java/org/mozilla/fenix/home/tips/ButtonTipViewHolderTest.kt @@ -24,8 +24,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.HomeActivity -import org.mozilla.fenix.components.metrics.Event -import org.mozilla.fenix.components.metrics.MetricController import org.mozilla.fenix.components.tips.Tip import org.mozilla.fenix.components.tips.TipType import org.mozilla.fenix.databinding.ButtonTipItemBinding @@ -38,7 +36,6 @@ class ButtonTipViewHolderTest { @MockK private lateinit var activity: HomeActivity @MockK private lateinit var interactor: SessionControlInteractor - @MockK(relaxed = true) private lateinit var metrics: MetricController @MockK private lateinit var settings: Settings @MockK private lateinit var sharedPrefs: SharedPreferences @MockK private lateinit var sharedPrefsEditor: SharedPreferences.Editor @@ -53,7 +50,7 @@ class ButtonTipViewHolderTest { .inflate(ButtonTipViewHolder.LAYOUT_ID, null) ) - viewHolder = ButtonTipViewHolder(view, interactor, metrics, settings) + viewHolder = ButtonTipViewHolder(view, interactor, settings) binding = ButtonTipItemBinding.bind(view) every { view.context } returns activity every { activity.openToBrowserAndLoad(any(), any(), any()) } just Runs @@ -71,8 +68,6 @@ class ButtonTipViewHolderTest { assertEquals("Tip Title", binding.tipHeaderText.text) assertEquals("Tip description", binding.tipDescriptionText.text) assertEquals("button", binding.tipButton.text) - - verify { metrics.track(Event.TipDisplayed("tipIdentifier")) } } @Test @@ -105,7 +100,6 @@ class ButtonTipViewHolderTest { binding.tipButton.performClick() verify { action() } - verify { metrics.track(Event.TipPressed("tipIdentifier")) } } @Test @@ -115,7 +109,6 @@ class ButtonTipViewHolderTest { binding.tipClose.performClick() verify { interactor.onCloseTip(tip) } - verify { metrics.track(Event.TipClosed("tipIdentifier")) } verify { sharedPrefsEditor.putBoolean("tipIdentifier", false) } }