From 9688e637abbd5c6c5e9e8d231964f4f887942548 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Thu, 5 Mar 2020 20:44:15 +0100 Subject: [PATCH] Move accounts initialization to Activity onCreate (#2926) * Move accounts initialization to onActivityCreate * Revert "Fixes an AC issue with FxA and the account state after rebooting (#2925)" This reverts commit 83ebdc5139a3546b2c076de0406fb0fa326f730f. --- .../org/mozilla/vrbrowser/VRBrowserActivity.java | 1 + .../org/mozilla/vrbrowser/VRBrowserApplication.java | 11 +++++++---- .../vrbrowser/telemetry/GleanMetricsService.java | 2 +- build.gradle | 2 +- versions.gradle | 6 +++--- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java index 3598c6159..015f26940 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java @@ -216,6 +216,7 @@ protected void attachBaseContext(Context base) { @Override protected void onCreate(Bundle savedInstanceState) { + ((VRBrowserApplication)getApplication()).onActivityCreate(); SettingsStore.getInstance(getBaseContext()).setPid(Process.myPid()); // Fix for infinite restart on startup crashes. long count = SettingsStore.getInstance(getBaseContext()).getCrashRestartCount(); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserApplication.java b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserApplication.java index aa184b900..6e8a031f7 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserApplication.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserApplication.java @@ -31,17 +31,20 @@ public class VRBrowserApplication extends Application { @Override public void onCreate() { super.onCreate(); - mAppExecutors = new AppExecutors(); - mPlaces = new Places(this); mBitmapCache = new BitmapCache(this, mAppExecutors.diskIO(), mAppExecutors.mainThread()); - mServices = new Services(this, mPlaces); - mAccounts = new Accounts(this); + TelemetryWrapper.init(this); GleanMetricsService.init(this); } + protected void onActivityCreate() { + mPlaces = new Places(this); + mServices = new Services(this, mPlaces); + mAccounts = new Accounts(this); + } + @Override protected void attachBaseContext(Context base) { Context context = LocaleUtils.init(base); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/telemetry/GleanMetricsService.java b/app/src/common/shared/org/mozilla/vrbrowser/telemetry/GleanMetricsService.java index 6e065a49c..dbceba2f4 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/telemetry/GleanMetricsService.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/telemetry/GleanMetricsService.java @@ -52,7 +52,7 @@ public static void init(Context aContext) { GleanMetricsService.stop(); } Configuration config = new Configuration(Configuration.DEFAULT_TELEMETRY_ENDPOINT, BuildConfig.BUILD_TYPE); - Glean.INSTANCE.initialize(aContext, config); + Glean.INSTANCE.initialize(aContext, true, config); } // It would be called when users turn on/off the setting of telemetry. diff --git a/build.gradle b/build.gradle index c94fe430a..6b2f10441 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { addRepos(repositories) dependencies { classpath 'com.android.tools.build:gradle:3.4.2' - classpath "org.mozilla.telemetry:glean-gradle-plugin:$versions.android_components" + classpath "org.mozilla.telemetry:glean-gradle-plugin:$versions.telemetry" classpath "$deps.kotlin.plugin" // NOTE: Do not place your application dependencies here; they belong diff --git a/versions.gradle b/versions.gradle index 4d61e37b4..d42b6c5fe 100644 --- a/versions.gradle +++ b/versions.gradle @@ -25,13 +25,13 @@ def versions = [:] // GeckoView versions can be found here: // https://maven.mozilla.org/?prefix=maven2/org/mozilla/geckoview/ versions.gecko_view = "75.0.20200304084140" -versions.android_components = "21.0.0" +versions.android_components = "28.0.1" // Note that android-components also depends on application-services, // and in fact is our main source of appservices-related functionality. // The version number below tracks the application-services version // that we depend on directly for its rustlog package, and it's important // that it be kept insync with the version used by android-components above. -versions.mozilla_appservices = "0.42.2" +versions.mozilla_appservices = "0.48.2" versions.mozilla_speech = "1.0.11" versions.openwnn = "1.3.7" versions.google_vr = "1.190.0" @@ -52,7 +52,7 @@ versions.snakeyaml = "1.24" versions.gson = "2.8.5" versions.robolectric = "4.2.1" versions.work = "2.2.0" -versions.telemetry = "22.0.0" +versions.telemetry = "24.1.0" ext.versions = versions def deps = [:]