[fenix] For https://github.com/mozilla-mobile/fenix/issues/24605 - Remove Event.wrapper for MediaState telemetry

pull/600/head
Alexandru2909 2 years ago committed by mergify[bot]
parent 795f47ca2f
commit d826d3d264

@ -128,10 +128,12 @@ import org.mozilla.fenix.wifi.SitePermissionsWifiIntegration
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import mozilla.components.feature.session.behavior.EngineViewBrowserToolbarBehavior import mozilla.components.feature.session.behavior.EngineViewBrowserToolbarBehavior
import mozilla.components.feature.webauthn.WebAuthnFeature import mozilla.components.feature.webauthn.WebAuthnFeature
import mozilla.components.service.glean.private.NoExtras
import mozilla.components.support.base.feature.ActivityResultHandler import mozilla.components.support.base.feature.ActivityResultHandler
import mozilla.components.support.ktx.android.view.enterToImmersiveMode import mozilla.components.support.ktx.android.view.enterToImmersiveMode
import mozilla.components.support.ktx.kotlin.getOrigin import mozilla.components.support.ktx.kotlin.getOrigin
import org.mozilla.fenix.GleanMetrics.Downloads import org.mozilla.fenix.GleanMetrics.Downloads
import org.mozilla.fenix.GleanMetrics.MediaState
import org.mozilla.fenix.components.toolbar.interactor.BrowserToolbarInteractor import org.mozilla.fenix.components.toolbar.interactor.BrowserToolbarInteractor
import org.mozilla.fenix.components.toolbar.interactor.DefaultBrowserToolbarInteractor import org.mozilla.fenix.components.toolbar.interactor.DefaultBrowserToolbarInteractor
import org.mozilla.fenix.crashes.CrashContentIntegration import org.mozilla.fenix.crashes.CrashContentIntegration
@ -1325,7 +1327,7 @@ abstract class BaseBrowserFragment :
} }
final override fun onPictureInPictureModeChanged(enabled: Boolean) { final override fun onPictureInPictureModeChanged(enabled: Boolean) {
if (enabled) requireComponents.analytics.metrics.track(Event.MediaPictureInPictureState) if (enabled) MediaState.pictureInPicture.record(NoExtras())
pipFeature?.onPictureInPictureModeChanged(enabled) pipFeature?.onPictureInPictureModeChanged(enabled)
} }
@ -1361,7 +1363,7 @@ abstract class BaseBrowserFragment :
// Without this, fullscreen has a margin at the top. // Without this, fullscreen has a margin at the top.
binding.engineView.setVerticalClipping(0) binding.engineView.setVerticalClipping(0)
requireComponents.analytics.metrics.track(Event.MediaFullscreenState) MediaState.fullscreen.record(NoExtras())
} else { } else {
activity?.exitImmersiveModeIfNeeded() activity?.exitImmersiveModeIfNeeded()
(activity as? HomeActivity)?.let { activity -> (activity as? HomeActivity)?.let { activity ->

@ -23,11 +23,6 @@ sealed class Event {
object AddBookmark : Event() object AddBookmark : Event()
object HistoryHighlightOpened : Event() object HistoryHighlightOpened : Event()
object HistorySearchGroupOpened : Event() object HistorySearchGroupOpened : Event()
object MediaPlayState : Event()
object MediaPauseState : Event()
object MediaStopState : Event()
object MediaFullscreenState : Event()
object MediaPictureInPictureState : Event()
object PocketTopSiteClicked : Event() object PocketTopSiteClicked : Event()
object PocketTopSiteRemoved : Event() object PocketTopSiteRemoved : Event()
object PocketHomeRecsShown : Event() object PocketHomeRecsShown : Event()

@ -20,7 +20,6 @@ import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.ExperimentsDefaultBrowser import org.mozilla.fenix.GleanMetrics.ExperimentsDefaultBrowser
import org.mozilla.fenix.GleanMetrics.HomeMenu import org.mozilla.fenix.GleanMetrics.HomeMenu
import org.mozilla.fenix.GleanMetrics.HomeScreen import org.mozilla.fenix.GleanMetrics.HomeScreen
import org.mozilla.fenix.GleanMetrics.MediaState
import org.mozilla.fenix.GleanMetrics.Metrics import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.Pocket import org.mozilla.fenix.GleanMetrics.Pocket
@ -110,21 +109,6 @@ private val Event.wrapper: EventWrapper<*>?
is Event.SetDefaultBrowserToolbarMenuClicked -> EventWrapper<NoExtraKeys>( is Event.SetDefaultBrowserToolbarMenuClicked -> EventWrapper<NoExtraKeys>(
{ ExperimentsDefaultBrowser.toolbarMenuClicked.record(it) } { ExperimentsDefaultBrowser.toolbarMenuClicked.record(it) }
) )
is Event.MediaPlayState -> EventWrapper<NoExtraKeys>(
{ MediaState.play.record(it) }
)
is Event.MediaPauseState -> EventWrapper<NoExtraKeys>(
{ MediaState.pause.record(it) }
)
is Event.MediaStopState -> EventWrapper<NoExtraKeys>(
{ MediaState.stop.record(it) }
)
is Event.MediaFullscreenState -> EventWrapper<NoExtraKeys>(
{ MediaState.fullscreen.record(it) }
)
is Event.MediaPictureInPictureState -> EventWrapper<NoExtraKeys>(
{ MediaState.pictureInPicture.record(it) }
)
is Event.PocketTopSiteClicked -> EventWrapper<NoExtraKeys>( is Event.PocketTopSiteClicked -> EventWrapper<NoExtraKeys>(
{ Pocket.pocketTopSiteClicked.record(it) } { Pocket.pocketTopSiteClicked.record(it) }
) )

@ -35,10 +35,11 @@ import mozilla.components.support.base.log.logger.Logger
import mozilla.components.support.webextensions.facts.WebExtensionFacts import mozilla.components.support.webextensions.facts.WebExtensionFacts
import mozilla.telemetry.glean.private.NoExtras import mozilla.telemetry.glean.private.NoExtras
import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.LoginDialog import org.mozilla.fenix.GleanMetrics.LoginDialog
import org.mozilla.fenix.GleanMetrics.MediaNotification import org.mozilla.fenix.GleanMetrics.MediaNotification
import org.mozilla.fenix.GleanMetrics.CustomTab import org.mozilla.fenix.GleanMetrics.MediaState
import org.mozilla.fenix.GleanMetrics.PerfAwesomebar import org.mozilla.fenix.GleanMetrics.PerfAwesomebar
import org.mozilla.fenix.search.awesomebar.ShortcutsSuggestionProvider import org.mozilla.fenix.search.awesomebar.ShortcutsSuggestionProvider
import org.mozilla.fenix.utils.Settings import org.mozilla.fenix.utils.Settings
@ -117,6 +118,14 @@ internal class ReleaseMetricController(
Component.FEATURE_PROMPTS to LoginDialogFacts.Items.SAVE -> { Component.FEATURE_PROMPTS to LoginDialogFacts.Items.SAVE -> {
LoginDialog.saved.record(NoExtras()) LoginDialog.saved.record(NoExtras())
} }
Component.FEATURE_MEDIA to MediaFacts.Items.STATE -> {
when (action) {
Action.PLAY -> MediaState.play.record(NoExtras())
Action.PAUSE -> MediaState.pause.record(NoExtras())
Action.STOP -> MediaState.stop.record(NoExtras())
else -> Unit
}
}
Component.FEATURE_MEDIA to MediaFacts.Items.NOTIFICATION -> { Component.FEATURE_MEDIA to MediaFacts.Items.NOTIFICATION -> {
when (action) { when (action) {
Action.PLAY -> MediaNotification.play.record(NoExtras()) Action.PLAY -> MediaNotification.play.record(NoExtras())
@ -228,14 +237,6 @@ internal class ReleaseMetricController(
metadata?.get("id")?.let { Event.AddonsOpenInToolbarMenu(it.toString()) } metadata?.get("id")?.let { Event.AddonsOpenInToolbarMenu(it.toString()) }
} }
Component.FEATURE_MEDIA == component && MediaFacts.Items.STATE == item -> {
when (action) {
Action.PLAY -> Event.MediaPlayState
Action.PAUSE -> Event.MediaPauseState
Action.STOP -> Event.MediaStopState
else -> null
}
}
Component.SUPPORT_WEBEXTENSIONS == component && WebExtensionFacts.Items.WEB_EXTENSIONS_INITIALIZED == item -> { Component.SUPPORT_WEBEXTENSIONS == component && WebExtensionFacts.Items.WEB_EXTENSIONS_INITIALIZED == item -> {
metadata?.get("installed")?.let { installedAddons -> metadata?.get("installed")?.let { installedAddons ->
if (installedAddons is List<*>) { if (installedAddons is List<*>) {

Loading…
Cancel
Save