Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #5197: Adds telemetry for media notification
Browse files Browse the repository at this point in the history
  • Loading branch information
sblatz committed Sep 24, 2019
1 parent 01f3c85 commit ab3b9da
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
24 changes: 24 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -378,6 +379,12 @@ private val Event.wrapper: EventWrapper<*>?
is Event.TabMediaPause -> EventWrapper<NoExtraKeys>(
{ Tab.mediaPause.record(it) }
)
is Event.NotificationMediaPlay -> EventWrapper<NoExtraKeys>(
{ MediaNotification.play.record(it) }
)
is Event.NotificationMediaPause -> EventWrapper<NoExtraKeys>(
{ MediaNotification.pause.record(it) }
)
is Event.TrackingProtectionTrackerList -> EventWrapper<NoExtraKeys>(
{ TrackingProtection.etpTrackerList.record(it) }
)
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab3b9da

Please sign in to comment.