Commit 30c5b41d authored by Jonathan Almeida's avatar Jonathan Almeida
Browse files

Closes #5929: Emit facts during migration

parent feddd369
......@@ -83,6 +83,8 @@ abstract class AbstractMigrationService : Service() {
private fun shutdown() {
store.dispatch(MigrationAction.Completed)
emitCompletedFact()
stopForeground(true)
showMigrationCompleteNotification()
......
......@@ -551,6 +551,8 @@ class FennecMigrator private constructor(
store.dispatch(MigrationAction.Started).join()
}
ContextCompat.startForegroundService(context, Intent(context, service))
emitStartedFact()
}
private fun getMigrationsToRun(): List<VersionedMigration> {
......
/* 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.support.migration
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.collect
/**
* Facts emitted for telemetry related to migration.
*/
class MigrationFacts {
/**
* Items that specify which portion of the migration was invoked.
*/
object Items {
const val MIGRATION_COMPLETED = "migration_completed"
const val MIGRATION_STARTED = "migration_started"
}
}
private fun emitMigrationFact(
action: Action,
item: String
) {
Fact(
Component.SUPPORT_MIGRATION,
action,
item
).collect()
}
internal fun emitCompletedFact() = emitMigrationFact(Action.INTERACTION, MigrationFacts.Items.MIGRATION_COMPLETED)
internal fun emitStartedFact() = emitMigrationFact(Action.INTERACTION, MigrationFacts.Items.MIGRATION_STARTED)
......@@ -72,6 +72,9 @@ permalink: /changelog/
* **feature-awesomebar**
* Added `showDescription` parameter (default to `true`) to `SearchSuggestionProvider` constructors to add the possibility of removing search suggestion description.
* **support-migration**
* Emit facts during migration.
# 31.0.0
* [Commits](https://github.com/mozilla-mobile/android-components/compare/v30.0.0...v31.0.0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment