diff --git a/app/metrics.yaml b/app/metrics.yaml index 5b82b2ecd7a4..938eed4d8564 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -1451,6 +1451,30 @@ tab: - fenix-core@mozilla.com expires: "2020-03-01" +media_notification: + play: + type: event + description: > + A user pressed the play icon on the media notification + bugs: + - 5197 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/TODO + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + pause: + type: event + description: > + A user pressed the pause icon on the media notification + bugs: + - 5197 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/TODO + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + experiments.metrics: active_experiment: type: string 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 170eac6ab528..e1f8d11c3862 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 @@ -24,6 +24,7 @@ import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.FindInPage import org.mozilla.fenix.GleanMetrics.History import org.mozilla.fenix.GleanMetrics.Library +import org.mozilla.fenix.GleanMetrics.MediaNotification import org.mozilla.fenix.GleanMetrics.Metrics import org.mozilla.fenix.GleanMetrics.Pings import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode @@ -378,6 +379,12 @@ private val Event.wrapper: EventWrapper<*>? is Event.TabMediaPause -> EventWrapper( { Tab.mediaPause.record(it) } ) + is Event.NotificationMediaPlay -> EventWrapper( + { MediaNotification.play.record(it) } + ) + is Event.NotificationMediaPause -> EventWrapper( + { MediaNotification.pause.record(it) } + ) is Event.TrackingProtectionTrackerList -> EventWrapper( { TrackingProtection.etpTrackerList.record(it) } ) diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt index f16c0e6367ea..7e038abf0428 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt @@ -8,6 +8,7 @@ import android.content.Context import mozilla.components.browser.errorpages.ErrorType import mozilla.components.browser.search.SearchEngine import mozilla.components.support.base.Component +import mozilla.components.support.base.facts.Action import mozilla.components.support.base.facts.Fact import mozilla.components.support.base.facts.FactProcessor import mozilla.components.support.base.facts.Facts @@ -116,6 +117,8 @@ sealed class Event { object PrivateBrowsingStaticShortcutPrivateTab : Event() object TabMediaPlay : Event() object TabMediaPause : Event() + object NotificationMediaPlay : Event() + object NotificationMediaPause : Event() object TrackingProtectionTrackerList : Event() object TrackingProtectionIconPressed : Event() object TrackingProtectionSettingsPanel : Event() @@ -312,6 +315,17 @@ private fun Fact.toEvent(): Event? = when (Pair(component, item)) { Component.FEATURE_CUSTOMTABS to "close" -> Event.CustomTabsClosed Component.FEATURE_CUSTOMTABS to "action_button" -> Event.CustomTabsActionTapped + Component.FEATURE_MEDIA to "notification" -> { + when (action) { + Action.PLAY -> { + Event.NotificationMediaPlay + } + Action.PAUSE -> { + Event.NotificationMediaPause + } + else -> null + } + } else -> null } diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 3fef2d447e52..d5f3de0f3c0b 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -35,7 +35,7 @@ object Versions { const val androidx_work = "2.0.1" const val google_material = "1.1.0-alpha10" - const val mozilla_android_components = "14.0.0-SNAPSHOT" + const val mozilla_android_components = "14.0.0" // Note that android-components also depends on application-services, // and in fact is our main source of appservices-related functionality. // The version number below tracks the application-services version