1
0
Fork 0

For #5705 - Adds telemetry for media state (#6463)

master
Gabriel 2019-11-12 20:24:30 -05:00 committed by Jeff Boek
parent 9d5c03c067
commit ebdfe8184e
4 changed files with 67 additions and 1 deletions

View File

@ -1446,6 +1446,41 @@ media_notification:
- fenix-core@mozilla.com
expires: "2020-03-01"
media_state:
play:
type: event
description: >
Media started playing.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5705
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6463
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
pause:
type: event
description: >
Media playback was paused.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5705
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6463
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
stop:
type: event
description: >
Media playback has ended.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5705
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6463
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
logins:
open_logins:
type: event

View File

@ -27,6 +27,7 @@ import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.Library
import org.mozilla.fenix.GleanMetrics.Logins
import org.mozilla.fenix.GleanMetrics.MediaNotification
import org.mozilla.fenix.GleanMetrics.MediaState
import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode
@ -373,6 +374,15 @@ private val Event.wrapper: EventWrapper<*>?
is Event.TabMediaPause -> EventWrapper<NoExtraKeys>(
{ Tab.mediaPause.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.NotificationMediaPlay -> EventWrapper<NoExtraKeys>(
{ MediaNotification.play.record(it) }
)

View File

@ -11,6 +11,7 @@ import mozilla.components.browser.toolbar.facts.ToolbarFacts
import mozilla.components.feature.contextmenu.facts.ContextMenuFacts
import mozilla.components.feature.customtabs.CustomTabsFacts
import mozilla.components.feature.findinpage.facts.FindInPageFacts
import mozilla.components.feature.media.facts.MediaFacts
import mozilla.components.support.base.Component
import mozilla.components.support.base.facts.Action
import mozilla.components.support.base.facts.Fact
@ -113,6 +114,9 @@ sealed class Event {
object PrivateBrowsingStaticShortcutPrivateTab : Event()
object TabMediaPlay : Event()
object TabMediaPause : Event()
object MediaPlayState : Event()
object MediaPauseState : Event()
object MediaStopState : Event()
object NotificationMediaPlay : Event()
object NotificationMediaPause : Event()
object TrackingProtectionTrackerList : Event()
@ -328,7 +332,7 @@ private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
Component.FEATURE_CUSTOMTABS to CustomTabsFacts.Items.CLOSE -> Event.CustomTabsClosed
Component.FEATURE_CUSTOMTABS to CustomTabsFacts.Items.ACTION_BUTTON -> Event.CustomTabsActionTapped
Component.FEATURE_MEDIA to "notification" -> {
Component.FEATURE_MEDIA to MediaFacts.Items.NOTIFICATION -> {
when (action) {
Action.PLAY -> {
Event.NotificationMediaPlay
@ -339,6 +343,20 @@ private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
else -> null
}
}
Component.FEATURE_MEDIA to MediaFacts.Items.STATE -> {
when (action) {
Action.PLAY -> {
Event.MediaPlayState
}
Action.PAUSE -> {
Event.MediaPauseState
}
Action.STOP -> {
Event.MediaStopState
}
else -> null
}
}
else -> null
}

View File

@ -100,6 +100,9 @@ The following metrics are added to the ping:
| logins.view_password_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user viewed a password in an individual saved login |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-03-01 |
| media_notification.pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on the media notification |[1](https://github.com/mozilla-mobile/fenix/pull/5520)||2020-03-01 |
| media_notification.play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on the media notification |[1](https://github.com/mozilla-mobile/fenix/pull/5520)||2020-03-01 |
| media_state.pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media playback was paused. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-03-01 |
| media_state.play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media started playing. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-03-01 |
| media_state.stop |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media playback has ended. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-03-01 |
| private_browsing_mode.garbage_icon |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the garbage can icon on the private browsing home page, deleting all private tabs. |[1](https://github.com/mozilla-mobile/fenix/pull/4968)||2020-03-01 |
| private_browsing_mode.notification_delete |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the private browsing mode notification's "Delete and Open" button. |[1](https://github.com/mozilla-mobile/fenix/pull/4968)||2020-03-01 |
| private_browsing_mode.notification_open |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the private browsing mode notification's "Open" button. |[1](https://github.com/mozilla-mobile/fenix/pull/4968)||2020-03-01 |