* for #11830 added new metric for collecting startup method move all source startup telemetry into its own logic and added an UNKOWN state * switched back to onNewIntent solution * renamed the metricmaster
parent
61b1b5a895
commit
4b9cc954fa
|
@ -8,6 +8,32 @@ no_lint:
|
||||||
- CATEGORY_GENERIC
|
- CATEGORY_GENERIC
|
||||||
|
|
||||||
events:
|
events:
|
||||||
|
app_received_intent:
|
||||||
|
type: event
|
||||||
|
description: |
|
||||||
|
The system received an Intent for the HomeActivity. An intent
|
||||||
|
is received an external entity wants to the app to display
|
||||||
|
content. Intents can be received when the app is closed – at
|
||||||
|
which point the app will be opened – or when the app is
|
||||||
|
already opened – at which point the already open app will make
|
||||||
|
changes such as loading a url. This can be used loosely as a
|
||||||
|
heuristic for when the user requested to open the app. The
|
||||||
|
HomeActivity encompasses the home screen and browser screen but
|
||||||
|
may include other screens. This differs from the app_opened
|
||||||
|
probe because it measures all startups, not just cold startup.
|
||||||
|
extra_keys:
|
||||||
|
source:
|
||||||
|
description: |
|
||||||
|
The method used to open Fenix. Possible values are `app_icon`,
|
||||||
|
`custom_tab`, `link` or `unknown`
|
||||||
|
bugs:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/issues/11830
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/11940/
|
||||||
|
notification_emails:
|
||||||
|
- esmyth@mozilla.com
|
||||||
|
- perf-android-fe@mozilla.com
|
||||||
|
expires: "2020-12-01"
|
||||||
app_opened:
|
app_opened:
|
||||||
type: event
|
type: event
|
||||||
description: |
|
description: |
|
||||||
|
|
|
@ -174,10 +174,14 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
|
||||||
lifecycle.addObserver(BreadcrumbsRecorder(components.analytics.crashReporter,
|
lifecycle.addObserver(BreadcrumbsRecorder(components.analytics.crashReporter,
|
||||||
navHost.navController, ::getBreadcrumbMessage))
|
navHost.navController, ::getBreadcrumbMessage))
|
||||||
|
|
||||||
intent
|
val safeIntent = intent?.toSafeIntent()
|
||||||
?.toSafeIntent()
|
safeIntent
|
||||||
?.let(::getIntentSource)
|
?.let(::getIntentSource)
|
||||||
?.also { components.analytics.metrics.track(Event.OpenedApp(it)) }
|
?.also { components.analytics.metrics.track(Event.OpenedApp(it)) }
|
||||||
|
// record on cold startup
|
||||||
|
safeIntent
|
||||||
|
?.let(::getIntentAllSource)
|
||||||
|
?.also { components.analytics.metrics.track(Event.AppRecievedIntent(it)) }
|
||||||
}
|
}
|
||||||
supportActionBar?.hide()
|
supportActionBar?.hide()
|
||||||
|
|
||||||
|
@ -250,6 +254,15 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
|
||||||
?.let { it as? TabTrayDialogFragment }
|
?.let { it as? TabTrayDialogFragment }
|
||||||
?.also { it.dismissAllowingStateLoss() }
|
?.also { it.dismissAllowingStateLoss() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is a warm or hot startup, onNewIntent method is always called first.
|
||||||
|
// Note: This does not work in case of an user sending an intent with ACTION_VIEW
|
||||||
|
// for example, launch the application, and than use adb to send an intent with
|
||||||
|
// ACTION_VIEW to open a link. In this case, we will get multiple telemetry events.
|
||||||
|
intent
|
||||||
|
.toSafeIntent()
|
||||||
|
.let(::getIntentAllSource)
|
||||||
|
?.also { components.analytics.metrics.track(Event.AppRecievedIntent(it)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -320,6 +333,14 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun getIntentAllSource(intent: SafeIntent): Event.AppRecievedIntent.Source? {
|
||||||
|
return when {
|
||||||
|
intent.isLauncherIntent -> Event.AppRecievedIntent.Source.APP_ICON
|
||||||
|
intent.action == Intent.ACTION_VIEW -> Event.AppRecievedIntent.Source.LINK
|
||||||
|
else -> Event.AppRecievedIntent.Source.UNKNOWN
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* External sources such as 3rd party links and shortcuts use this function to enter
|
* External sources such as 3rd party links and shortcuts use this function to enter
|
||||||
* private mode directly before the content view is created. Returns the mode set by the intent
|
* private mode directly before the content view is created. Returns the mode set by the intent
|
||||||
|
|
|
@ -97,6 +97,10 @@ private val Event.wrapper: EventWrapper<*>?
|
||||||
{ Events.appOpened.record(it) },
|
{ Events.appOpened.record(it) },
|
||||||
{ Events.appOpenedKeys.valueOf(it) }
|
{ Events.appOpenedKeys.valueOf(it) }
|
||||||
)
|
)
|
||||||
|
is Event.AppRecievedIntent -> EventWrapper(
|
||||||
|
{ Events.appReceivedIntent.record(it) },
|
||||||
|
{ Events.appReceivedIntentKeys.valueOf(it) }
|
||||||
|
)
|
||||||
is Event.SearchBarTapped -> EventWrapper(
|
is Event.SearchBarTapped -> EventWrapper(
|
||||||
{ Events.searchBarTapped.record(it) },
|
{ Events.searchBarTapped.record(it) },
|
||||||
{ Events.searchBarTappedKeys.valueOf(it) }
|
{ Events.searchBarTappedKeys.valueOf(it) }
|
||||||
|
|
|
@ -309,6 +309,13 @@ sealed class Event {
|
||||||
get() = hashMapOf(Events.appOpenedKeys.source to source.name)
|
get() = hashMapOf(Events.appOpenedKeys.source to source.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class AppRecievedIntent(val source: Source) : Event() {
|
||||||
|
enum class Source { APP_ICON, LINK, CUSTOM_TAB, UNKNOWN }
|
||||||
|
|
||||||
|
override val extras: Map<Events.appReceivedIntentKeys, String>?
|
||||||
|
get() = hashMapOf(Events.appReceivedIntentKeys.source to source.name)
|
||||||
|
}
|
||||||
|
|
||||||
data class CollectionSaveButtonPressed(val fromScreen: String) : Event() {
|
data class CollectionSaveButtonPressed(val fromScreen: String) : Event() {
|
||||||
override val extras: Map<Collections.saveButtonKeys, String>?
|
override val extras: Map<Collections.saveButtonKeys, String>?
|
||||||
get() = mapOf(Collections.saveButtonKeys.fromScreen to fromScreen)
|
get() = mapOf(Collections.saveButtonKeys.fromScreen to fromScreen)
|
||||||
|
|
|
@ -41,6 +41,8 @@ open class ExternalAppBrowserActivity : HomeActivity() {
|
||||||
|
|
||||||
final override fun getIntentSource(intent: SafeIntent) = Event.OpenedApp.Source.CUSTOM_TAB
|
final override fun getIntentSource(intent: SafeIntent) = Event.OpenedApp.Source.CUSTOM_TAB
|
||||||
|
|
||||||
|
final override fun getIntentAllSource(intent: SafeIntent) = Event.AppRecievedIntent.Source.CUSTOM_TAB
|
||||||
|
|
||||||
final override fun getIntentSessionId(intent: SafeIntent) = intent.getSessionId()
|
final override fun getIntentSessionId(intent: SafeIntent) = intent.getSessionId()
|
||||||
|
|
||||||
override fun getNavDirections(
|
override fun getNavDirections(
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue