For #11118: Add toggle states to metrics ping
parent
cd24d07d41
commit
9302d07d13
219
app/metrics.yaml
219
app/metrics.yaml
|
@ -509,6 +509,225 @@ metrics:
|
|||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
||||
preferences:
|
||||
show_search_suggestions:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has search suggestions enabled
|
||||
default: true
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
remote_debugging:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has remote debugging enabled
|
||||
default: false
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
telemetry:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has telemetry enabled. Note we should
|
||||
never receive a "false" value for this since telemetry would
|
||||
not send in that case.
|
||||
default: true
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
tracking_protection:
|
||||
type: string_list
|
||||
description: >
|
||||
What type of enhanced tracking protection the user has enabled.
|
||||
"standard," "strict," "custom," or "" (if disabled)
|
||||
default: "standard"
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
search_bookmarks:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has enabled bookmark search suggestions
|
||||
default: true
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
search_browsing_history:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has enabled browsing history suggestions.
|
||||
default: true
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
show_clipboard_suggestions:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has enabled clipboard search suggestions.
|
||||
default: true
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
show_search_shortcuts:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has enabled search shortcuts.
|
||||
default: true
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
open_links_in_a_private_tab:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has enabled open links in a private tab.
|
||||
default: false
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
sync:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user is signed into FxA
|
||||
default: false
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
sync_items:
|
||||
type: string_list
|
||||
description: >
|
||||
The list of items the user has chosen to sync with FxA.
|
||||
default: "" if the user is signed out. Otherwise defaults to
|
||||
whatever is set in their FxA account. New accounts set:
|
||||
[bookmarks, history, passwords, tabs]
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
show_voice_search:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has enabled the voice search button.
|
||||
default: true
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
search_suggestions_private:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has enabled showing search suggestions
|
||||
in private mode.
|
||||
default: false (we prompt the user, asking them to make a selection)
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
toolbar_position:
|
||||
type: string_list
|
||||
description: >
|
||||
The position of the toolbar
|
||||
default: bottom (defaults to top if the user has accessibility services)
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
accessibility_services:
|
||||
type: string_list
|
||||
description: >
|
||||
Whether or not the user has touch exploration or switch services enabled.
|
||||
These are built into the Android OS, not Fenix prefs.
|
||||
default: ""
|
||||
send_in_pings:
|
||||
- metrics
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11118
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11211
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
||||
search.default_engine:
|
||||
code:
|
||||
type: string
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package org.mozilla.fenix.components.metrics
|
||||
|
||||
import android.content.Context
|
||||
import mozilla.components.service.fxa.manager.SyncEnginesStorage
|
||||
import mozilla.components.service.glean.Glean
|
||||
import mozilla.components.service.glean.private.NoExtraKeys
|
||||
import mozilla.components.support.base.log.logger.Logger
|
||||
|
@ -28,6 +29,7 @@ import org.mozilla.fenix.GleanMetrics.MediaState
|
|||
import org.mozilla.fenix.GleanMetrics.Metrics
|
||||
import org.mozilla.fenix.GleanMetrics.Pings
|
||||
import org.mozilla.fenix.GleanMetrics.Pocket
|
||||
import org.mozilla.fenix.GleanMetrics.Preferences
|
||||
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode
|
||||
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingShortcut
|
||||
import org.mozilla.fenix.GleanMetrics.QrScanner
|
||||
|
@ -588,6 +590,56 @@ class GleanMetricsService(private val context: Context) : MetricsService {
|
|||
}
|
||||
|
||||
internal fun setStartupMetrics() {
|
||||
|
||||
// We purposefully make all of our preferences the string_list format to make data analysis
|
||||
// simpler. While it makes things like booleans a bit more complicated, it means all our
|
||||
// preferences can be analyzed with the same dashboard and compared.
|
||||
Preferences.apply {
|
||||
showSearchSuggestions.set(context.settings().shouldShowSearchSuggestions.toStringList())
|
||||
remoteDebugging.set(context.settings().isRemoteDebuggingEnabled.toStringList())
|
||||
telemetry.set(context.settings().isTelemetryEnabled.toStringList())
|
||||
searchBookmarks.set(context.settings().shouldShowBookmarkSuggestions.toStringList())
|
||||
showClipboardSuggestions.set(context.settings().shouldShowClipboardSuggestions.toStringList())
|
||||
showSearchShortcuts.set(context.settings().shouldShowSearchShortcuts.toStringList())
|
||||
openLinksInAPrivateTab.set(context.settings().openLinksInAPrivateTab.toStringList())
|
||||
searchSuggestionsPrivate.set(context.settings().shouldShowSearchSuggestionsInPrivate.toStringList())
|
||||
|
||||
val isLoggedIn =
|
||||
context.components.backgroundServices.accountManager.accountProfile() != null
|
||||
sync.set(isLoggedIn.toStringList())
|
||||
|
||||
val syncedItems = SyncEnginesStorage(context).getStatus().entries.filter {
|
||||
it.value
|
||||
}.map { it.key.nativeName }
|
||||
|
||||
syncItems.set(syncedItems)
|
||||
|
||||
val etpSelection =
|
||||
if (!context.settings().shouldUseTrackingProtection) {
|
||||
""
|
||||
} else if (context.settings().useStandardTrackingProtection) {
|
||||
"standard"
|
||||
} else if (context.settings().useStrictTrackingProtection) {
|
||||
"strict"
|
||||
} else if (context.settings().useCustomTrackingProtection) {
|
||||
"custom"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
trackingProtection.set(listOf(etpSelection))
|
||||
|
||||
val accessibilitySelection = mutableListOf<String>()
|
||||
|
||||
if (context.settings().switchServiceIsEnabled) { accessibilitySelection.add("switch") }
|
||||
|
||||
if (context.settings().touchExplorationIsEnabled) {
|
||||
accessibilitySelection.add("touch exploration")
|
||||
}
|
||||
|
||||
accessibilityServices.set(accessibilitySelection.toList())
|
||||
}
|
||||
|
||||
Metrics.apply {
|
||||
defaultBrowser.set(BrowsersCache.all(context).isDefaultBrowser)
|
||||
MozillaProductDetector.getMozillaBrowserDefault(context)?.also {
|
||||
|
@ -645,3 +697,8 @@ class GleanMetricsService(private val context: Context) : MetricsService {
|
|||
return event.wrapper != null
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function for making our booleans fit into the string list formatting
|
||||
fun Boolean.toStringList(): List<String> {
|
||||
return listOf(this.toString())
|
||||
}
|
||||
|
|
|
@ -331,6 +331,11 @@ class Settings private constructor(
|
|||
default = false
|
||||
)
|
||||
|
||||
val useStandardTrackingProtection by booleanPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_standard_option),
|
||||
true
|
||||
)
|
||||
|
||||
val useStrictTrackingProtection by booleanPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
||||
false
|
||||
|
@ -435,7 +440,7 @@ class Settings private constructor(
|
|||
* Check each active accessibility service to see if it can perform gestures, if any can,
|
||||
* then it is *likely* a switch service is enabled. We are assuming this to be the case based on #7486
|
||||
*/
|
||||
private val switchServiceIsEnabled: Boolean
|
||||
val switchServiceIsEnabled: Boolean
|
||||
get() {
|
||||
val accessibilityManager =
|
||||
appContext.getSystemService(Context.ACCESSIBILITY_SERVICE) as? AccessibilityManager
|
||||
|
@ -451,7 +456,7 @@ class Settings private constructor(
|
|||
return false
|
||||
}
|
||||
|
||||
private val touchExplorationIsEnabled: Boolean
|
||||
val touchExplorationIsEnabled: Boolean
|
||||
get() {
|
||||
val accessibilityManager =
|
||||
appContext.getSystemService(Context.ACCESSIBILITY_SERVICE) as? AccessibilityManager
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue