From 297128651903c23e099f90e947eaffd5f2c1c95b Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Tue, 21 Jul 2020 14:54:59 +0200 Subject: [PATCH] Reset all global state when destroying the Glean handle After we destroy the Glean handle we should be conceptually in a clean state, just as if the app is just starting and loading Glean. And for Glean that means tasks should get queued up. Some tests explicitly toggle this already, but resetting it here does not seem to affect them. --- .../android/src/main/java/mozilla/telemetry/glean/Glean.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt index 2ee8e38b4..28362344b 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt @@ -776,8 +776,12 @@ open class GleanInternalAPI internal constructor () { } LibGleanFFI.INSTANCE.glean_destroy_glean() - initialized = false + + // Reset all state. + @Suppress("EXPERIMENTAL_API_USAGE") + Dispatchers.API.setTaskQueueing(true) initFinished = false + initialized = false } /**