зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1370591 - Remove intent handling from GeckoProfile. r=snorp
Have BrowserApp.onCreate() send the intent args string to GeckoProfile, and store it to use in GeckoProfile.get() calls rather than accessing the intent directly from GeckoProfile.
This commit is contained in:
Родитель
7c833da65d
Коммит
e3ea7958ac
|
@ -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.
|
||||
|
|
|
@ -80,6 +80,7 @@ public final class GeckoProfile {
|
|||
new ConcurrentHashMap<String, GeckoProfile>(
|
||||
/* 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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче