From 15a71a87d00ba3470cb08171f3b99fa3f7944367 Mon Sep 17 00:00:00 2001 From: "Randall E. Barker" Date: Thu, 25 Jun 2020 04:32:22 -0700 Subject: [PATCH] Ensure the pref overrides are written out before GeckoRuntime is created (#3546) --- .../org/mozilla/vrbrowser/VRBrowserActivity.java | 5 +++-- .../mozilla/vrbrowser/browser/engine/SessionStore.java | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java index 085a7693d..2d601b836 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java @@ -228,6 +228,8 @@ protected void attachBaseContext(Context base) { @Override protected void onCreate(Bundle savedInstanceState) { + Bundle extras = getIntent() != null ? getIntent().getExtras() : null; + SessionStore.prefOverrides(this, extras); ((VRBrowserApplication)getApplication()).onActivityCreate(); SettingsStore.getInstance(getBaseContext()).setPid(Process.myPid()); // Fix for infinite restart on startup crashes. @@ -251,8 +253,7 @@ protected void onCreate(Bundle savedInstanceState) { BitmapCache.getInstance(this).onCreate(); - Bundle extras = getIntent() != null ? getIntent().getExtras() : null; - SessionStore.get().initialize(this, extras); + SessionStore.get().initialize(this); SessionStore.get().setLocales(LocaleUtils.getPreferredLanguageTags(this)); EngineProvider.INSTANCE.getOrCreateRuntime(this).appendAppNotesToCrashReport("Firefox Reality " + BuildConfig.VERSION_NAME + "-" + BuildConfig.VERSION_CODE + "-" + BuildConfig.FLAVOR + "-" + BuildConfig.BUILD_TYPE + " (" + BuildConfig.GIT_HASH + ")"); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/SessionStore.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/SessionStore.java index dd5557691..fde66a60b 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/SessionStore.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/SessionStore.java @@ -87,12 +87,14 @@ private SessionStore() { mSessions = new ArrayList<>(); } - public void initialize(Context context, Bundle aExtras) { - mContext = context; - mMainExecutor = ((VRBrowserApplication)context.getApplicationContext()).getExecutors().mainThread(); - + public static void prefOverrides(Context context, Bundle aExtras) { // FIXME: Once GeckoView has a prefs API SessionUtils.vrPrefsWorkAround(context, aExtras); + } + + public void initialize(Context context) { + mContext = context; + mMainExecutor = ((VRBrowserApplication)context.getApplicationContext()).getExecutors().mainThread(); mRuntime = EngineProvider.INSTANCE.getOrCreateRuntime(context);