Skip to content

Commit 6a92778

Browse files
Grisha Kruglovpocmo
Grisha Kruglov
authored andcommitted
Closes mozilla-mobile#3433: Disable periodic device event polling
1 parent c7b67ae commit 6a92778

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

components/service/firefox-accounts/src/main/java/mozilla/components/service/fxa/manager/FxaAccountManager.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,6 @@ open class FxaAccountManager(
418418
deviceTuple.name, deviceTuple.type, deviceTuple.capabilities
419419
).await()
420420

421-
logger.info("Starting periodic refresh of the device constellation")
422-
account.deviceConstellation().startPeriodicRefresh()
423-
424421
notifyObservers { onAuthenticated(account) }
425422

426423
Event.FetchProfile
@@ -440,8 +437,11 @@ open class FxaAccountManager(
440437
logger.warn("Failed to ensure device capabilities.")
441438
}
442439

443-
logger.info("Starting periodic refresh of the device constellation")
444-
account.deviceConstellation().startPeriodicRefresh()
440+
// We used to perform a periodic device event polling, but for now we do not.
441+
// This cancels any periodic jobs device may still have active.
442+
// See https://github.com/mozilla-mobile/android-components/issues/3433
443+
logger.info("Stopping periodic refresh of the device constellation")
444+
account.deviceConstellation().stopPeriodicRefresh()
445445

446446
notifyObservers { onAuthenticated(account) }
447447

@@ -462,9 +462,6 @@ open class FxaAccountManager(
462462
deviceTuple.name, deviceTuple.type, deviceTuple.capabilities
463463
).await()
464464

465-
logger.info("Starting periodic refresh of the device constellation")
466-
account.deviceConstellation().startPeriodicRefresh()
467-
468465
notifyObservers { onAuthenticated(account) }
469466

470467
Event.FetchProfile

components/service/firefox-accounts/src/test/java/mozilla/components/service/fxa/FxaAccountManagerTest.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,11 @@ class FxaAccountManagerTest {
182182
verify(constellation).ensureCapabilitiesAsync(listOf(DeviceCapability.SEND_TAB))
183183
verify(constellation, never()).initDeviceAsync(any(), any(), any())
184184

185-
// Assert that periodic account refresh started.
186-
verify(constellation).startPeriodicRefresh()
185+
// Assert that periodic account refresh never started.
186+
// See https://github.com/mozilla-mobile/android-components/issues/3433
187+
verify(constellation, never()).startPeriodicRefresh()
188+
// Assert that we cancel any existing periodic jobs.
189+
verify(constellation).stopPeriodicRefresh()
187190

188191
// Assert that persistence callback is interacting with the storage layer.
189192
account.persistenceCallback!!.persist("test")
@@ -218,8 +221,9 @@ class FxaAccountManagerTest {
218221
verify(constellation).ensureCapabilitiesAsync(listOf(DeviceCapability.SEND_TAB))
219222
verify(constellation, never()).initDeviceAsync(any(), any(), any())
220223

221-
// Assert that periodic account refresh started.
222-
verify(constellation).startPeriodicRefresh()
224+
// Assert that periodic account refresh never started.
225+
// See https://github.com/mozilla-mobile/android-components/issues/3433
226+
verify(constellation, never()).startPeriodicRefresh()
223227

224228
// Assert that persistence callback is interacting with the storage layer.
225229
account.persistenceCallback!!.persist("test")
@@ -339,8 +343,9 @@ class FxaAccountManagerTest {
339343
// Assert that persistence callback is set.
340344
assertNotNull(account.persistenceCallback)
341345

342-
// Assert that periodic account refresh started after finishing auth.
343-
verify(constellation).startPeriodicRefresh()
346+
// Assert that periodic account refresh is never started after finishing auth.
347+
// See https://github.com/mozilla-mobile/android-components/issues/3433
348+
verify(constellation, never()).startPeriodicRefresh()
344349

345350
// Assert that initDevice fired, but not ensureCapabilities (since we're initing a new account).
346351
verify(constellation).initDeviceAsync(any(), any(), eq(listOf(DeviceCapability.SEND_TAB)))

0 commit comments

Comments
 (0)