Loading app/src/migration/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ <application android:name="org.mozilla.fenix.MigratingFenixApplication" tools:replace="android:name"> <service android:name="org.mozilla.fenix.MigrationService" /> </application> </manifest> app/src/migration/java/org/mozilla/fenix/MigratingFenixApplication.kt +18 −15 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ package org.mozilla.fenix import android.content.Context import kotlinx.coroutines.runBlocking import mozilla.components.support.migration.FennecMigrator Loading @@ -11,12 +12,25 @@ import mozilla.components.support.migration.FennecMigrator * An application class which knows how to migrate Fennec data. */ class MigratingFenixApplication : FenixApplication() { val migrator by lazy { FennecMigrator.Builder(this, this.components.analytics.crashReporter) .migrateOpenTabs(this.components.core.sessionManager) .migrateHistory(this.components.core.historyStorage) .migrateBookmarks(this.components.core.bookmarksStorage) .migrateLogins( this.components.core.passwordsStorage.store, this.components.core.passwordsEncryptionKey ) .migrateFxa(this.components.backgroundServices.accountManager) .build() } override fun setupInMainProcessOnly() { migrateGeckoBlocking() super.setupInMainProcessOnly() migrateDataAsynchronously() migrator.startMigrationServiceIfNeeded(MigrationService::class.java) } private fun migrateGeckoBlocking() { Loading @@ -28,19 +42,8 @@ class MigratingFenixApplication : FenixApplication() { migrator.migrateAsync().await() } } private fun migrateDataAsynchronously() { val migrator = FennecMigrator.Builder(this, this.components.analytics.crashReporter) .migrateOpenTabs(this.components.core.sessionManager) .migrateHistory(this.components.core.historyStorage) .migrateBookmarks(this.components.core.bookmarksStorage) .migrateLogins( this.components.core.passwordsStorage.store, this.components.core.passwordsEncryptionKey ) .migrateFxa(this.components.backgroundServices.accountManager) .build() migrator.migrateAsync() } fun Context.getMigratorFromApplication(): FennecMigrator { return (applicationContext as MigratingFenixApplication).migrator } app/src/migration/java/org/mozilla/fenix/MigrationService.kt 0 → 100644 +14 −0 Original line number Diff line number Diff line /* 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 org.mozilla.fenix import mozilla.components.support.migration.AbstractMigrationService /** * Background service for running the migration from legacy Firefox for Android (Fennec). */ class MigrationService : AbstractMigrationService() { override val migrator by lazy { getMigratorFromApplication() } } Loading
app/src/migration/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ <application android:name="org.mozilla.fenix.MigratingFenixApplication" tools:replace="android:name"> <service android:name="org.mozilla.fenix.MigrationService" /> </application> </manifest>
app/src/migration/java/org/mozilla/fenix/MigratingFenixApplication.kt +18 −15 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ package org.mozilla.fenix import android.content.Context import kotlinx.coroutines.runBlocking import mozilla.components.support.migration.FennecMigrator Loading @@ -11,12 +12,25 @@ import mozilla.components.support.migration.FennecMigrator * An application class which knows how to migrate Fennec data. */ class MigratingFenixApplication : FenixApplication() { val migrator by lazy { FennecMigrator.Builder(this, this.components.analytics.crashReporter) .migrateOpenTabs(this.components.core.sessionManager) .migrateHistory(this.components.core.historyStorage) .migrateBookmarks(this.components.core.bookmarksStorage) .migrateLogins( this.components.core.passwordsStorage.store, this.components.core.passwordsEncryptionKey ) .migrateFxa(this.components.backgroundServices.accountManager) .build() } override fun setupInMainProcessOnly() { migrateGeckoBlocking() super.setupInMainProcessOnly() migrateDataAsynchronously() migrator.startMigrationServiceIfNeeded(MigrationService::class.java) } private fun migrateGeckoBlocking() { Loading @@ -28,19 +42,8 @@ class MigratingFenixApplication : FenixApplication() { migrator.migrateAsync().await() } } private fun migrateDataAsynchronously() { val migrator = FennecMigrator.Builder(this, this.components.analytics.crashReporter) .migrateOpenTabs(this.components.core.sessionManager) .migrateHistory(this.components.core.historyStorage) .migrateBookmarks(this.components.core.bookmarksStorage) .migrateLogins( this.components.core.passwordsStorage.store, this.components.core.passwordsEncryptionKey ) .migrateFxa(this.components.backgroundServices.accountManager) .build() migrator.migrateAsync() } fun Context.getMigratorFromApplication(): FennecMigrator { return (applicationContext as MigratingFenixApplication).migrator }
app/src/migration/java/org/mozilla/fenix/MigrationService.kt 0 → 100644 +14 −0 Original line number Diff line number Diff line /* 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 org.mozilla.fenix import mozilla.components.support.migration.AbstractMigrationService /** * Background service for running the migration from legacy Firefox for Android (Fennec). */ class MigrationService : AbstractMigrationService() { override val migrator by lazy { getMigratorFromApplication() } }