Bug 1884527 - remove lingering geckoadapter bits r=chutten,android-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D205336
This commit is contained in:
@@ -1,50 +0,0 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
package mozilla.components.browser.engine.gecko.glean
|
|
||||||
|
|
||||||
import mozilla.components.browser.engine.gecko.GleanMetrics.GleanGeckoMetricsMapping
|
|
||||||
import org.mozilla.geckoview.RuntimeTelemetry
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This implements a [RuntimeTelemetry.Delegate] that dispatches Gecko runtime
|
|
||||||
* telemetry to the Glean SDK.
|
|
||||||
*
|
|
||||||
* Metrics defined in the `metrics.yaml` file in Gecko's mozilla-central repository
|
|
||||||
* will be automatically dispatched to the Glean SDK and sent through the requested
|
|
||||||
* pings.
|
|
||||||
*
|
|
||||||
* This can be used, in products collecting data through the Glean SDK, by
|
|
||||||
* providing an instance to `GeckoRuntimeSettings.Builder().telemetryDelegate`.
|
|
||||||
*/
|
|
||||||
class GeckoAdapter : RuntimeTelemetry.Delegate {
|
|
||||||
// Note that the `GleanGeckoMetricsMapping` is automatically generated at
|
|
||||||
// build time by the Glean SDK parsers.
|
|
||||||
|
|
||||||
override fun onHistogram(metric: RuntimeTelemetry.Histogram) {
|
|
||||||
if (metric.isCategorical) {
|
|
||||||
// Gecko categorical histograms are a bit special: their value indicates
|
|
||||||
// the index of the label they want to accumulate 1 unit to. Moreover,
|
|
||||||
// Gecko batches them up before sending: each value in `metric.value` is
|
|
||||||
// the index of a potentially different label.
|
|
||||||
GleanGeckoMetricsMapping.getCategoricalMetric(metric.name)?.let { categorical ->
|
|
||||||
metric.value.forEach { labelIndex -> categorical[labelIndex.toInt()].add(1) }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
GleanGeckoMetricsMapping.getHistogram(metric.name)?.accumulateSamples(metric.value.toList())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBooleanScalar(metric: RuntimeTelemetry.Metric<Boolean>) {
|
|
||||||
GleanGeckoMetricsMapping.getBooleanScalar(metric.name)?.set(metric.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStringScalar(metric: RuntimeTelemetry.Metric<String>) {
|
|
||||||
GleanGeckoMetricsMapping.getStringScalar(metric.name)?.set(metric.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLongScalar(metric: RuntimeTelemetry.Metric<Long>) {
|
|
||||||
GleanGeckoMetricsMapping.getQuantityScalar(metric.name)?.set(metric.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,15 +2,11 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// Needed until bug 1884527 is fixed.
|
|
||||||
@file:Suppress("DEPRECATION")
|
|
||||||
|
|
||||||
package org.mozilla.samples.browser
|
package org.mozilla.samples.browser
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import mozilla.components.browser.engine.gecko.GeckoEngine
|
import mozilla.components.browser.engine.gecko.GeckoEngine
|
||||||
import mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient
|
import mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient
|
||||||
import mozilla.components.browser.engine.gecko.glean.GeckoAdapter
|
|
||||||
import mozilla.components.concept.engine.Engine
|
import mozilla.components.concept.engine.Engine
|
||||||
import mozilla.components.experiment.NimbusExperimentDelegate
|
import mozilla.components.experiment.NimbusExperimentDelegate
|
||||||
import mozilla.components.feature.webcompat.WebCompatFeature
|
import mozilla.components.feature.webcompat.WebCompatFeature
|
||||||
@@ -27,7 +23,6 @@ class Components(private val applicationContext: Context) : DefaultComponents(ap
|
|||||||
private val runtime by lazy {
|
private val runtime by lazy {
|
||||||
// Allow for exfiltrating Gecko metrics through the Glean SDK.
|
// Allow for exfiltrating Gecko metrics through the Glean SDK.
|
||||||
val builder = GeckoRuntimeSettings.Builder().aboutConfigEnabled(true)
|
val builder = GeckoRuntimeSettings.Builder().aboutConfigEnabled(true)
|
||||||
builder.telemetryDelegate(GeckoAdapter())
|
|
||||||
builder.experimentDelegate(NimbusExperimentDelegate())
|
builder.experimentDelegate(NimbusExperimentDelegate())
|
||||||
builder.crashHandler(CrashHandlerService::class.java)
|
builder.crashHandler(CrashHandlerService::class.java)
|
||||||
GeckoRuntime.create(applicationContext, builder.build())
|
GeckoRuntime.create(applicationContext, builder.build())
|
||||||
|
|||||||
@@ -2,16 +2,12 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// Needed until bug 1884527 is fixed.
|
|
||||||
@file:Suppress("DEPRECATION")
|
|
||||||
|
|
||||||
package org.mozilla.fenix.gecko
|
package org.mozilla.fenix.gecko
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.annotation.VisibleForTesting
|
import androidx.annotation.VisibleForTesting
|
||||||
import mozilla.components.browser.engine.gecko.autofill.GeckoAutocompleteStorageDelegate
|
import mozilla.components.browser.engine.gecko.autofill.GeckoAutocompleteStorageDelegate
|
||||||
import mozilla.components.browser.engine.gecko.ext.toContentBlockingSetting
|
import mozilla.components.browser.engine.gecko.ext.toContentBlockingSetting
|
||||||
import mozilla.components.browser.engine.gecko.glean.GeckoAdapter
|
|
||||||
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
||||||
import mozilla.components.concept.storage.CreditCardsAddressesStorage
|
import mozilla.components.concept.storage.CreditCardsAddressesStorage
|
||||||
import mozilla.components.concept.storage.LoginsStorage
|
import mozilla.components.concept.storage.LoginsStorage
|
||||||
@@ -110,7 +106,6 @@ object GeckoProvider {
|
|||||||
): GeckoRuntimeSettings {
|
): GeckoRuntimeSettings {
|
||||||
return GeckoRuntimeSettings.Builder()
|
return GeckoRuntimeSettings.Builder()
|
||||||
.crashHandler(CrashHandlerService::class.java)
|
.crashHandler(CrashHandlerService::class.java)
|
||||||
.telemetryDelegate(GeckoAdapter())
|
|
||||||
.experimentDelegate(NimbusExperimentDelegate())
|
.experimentDelegate(NimbusExperimentDelegate())
|
||||||
.contentBlocking(
|
.contentBlocking(
|
||||||
policy.toContentBlockingSetting(
|
policy.toContentBlockingSetting(
|
||||||
|
|||||||
Reference in New Issue
Block a user