diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 09c7c1983852..c39957ed4227 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -628,6 +628,8 @@ public class BrowserApp extends GeckoApp final SafeIntent intent = new SafeIntent(getIntent()); final boolean isInAutomation = IntentUtils.getIsInAutomationFromEnvironment(intent); + GeckoProfile.setIntentArgs(intent.getStringExtra("args")); + if (!isInAutomation && AppConstants.MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE) { // Kick off download of app content as early as possible so that in the best case it's // available before the user starts using the browser. diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java index 8823830857d6..aaa74dcf21e0 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java @@ -80,6 +80,7 @@ public final class GeckoProfile { new ConcurrentHashMap( /* capacity */ 4, /* load factor */ 0.75f, /* concurrency */ 2); private static String sDefaultProfileName; + private static String sIntentArgs; private final String mName; private final File mMozillaDir; @@ -108,6 +109,10 @@ public final class GeckoProfile { GeckoSharedPrefs.forApp(context).edit().putBoolean(GUEST_MODE_PREF, false).commit(); } + public static void setIntentArgs(final String intentArgs) { + sIntentArgs = intentArgs; + } + public static GeckoProfile initFromArgs(final Context context, final String args) { if (shouldUseGuestMode(context)) { final GeckoProfile guestProfile = getGuestProfile(context); @@ -214,15 +219,7 @@ public final class GeckoProfile { return profile; } - final String args; - if (context instanceof Activity) { - args = IntentUtils.getStringExtraSafe(((Activity) context).getIntent(), "args"); - } else { - args = null; - } - - return GeckoProfile.initFromArgs(context, args); - + return GeckoProfile.initFromArgs(context, sIntentArgs); } else if (profileName == null) { // If only profile dir was passed in, use custom (anonymous) profile. profileName = CUSTOM_PROFILE;