mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-14 05:44:20 +00:00
Bug 945832 - java.lang.IllegalStateException: No ContextGetter; cannot fetch prefs. on rotation or system locale change. r=wesj
This commit is contained in:
parent
f61459c71b
commit
e868ca3700
@ -16,6 +16,7 @@ import android.content.res.Configuration;
|
||||
import android.util.Log;
|
||||
|
||||
public class GeckoApplication extends Application {
|
||||
private static final String LOG_TAG = "GeckoApplication";
|
||||
|
||||
private boolean mInited;
|
||||
private boolean mInBackground;
|
||||
@ -29,8 +30,8 @@ public class GeckoApplication extends Application {
|
||||
*/
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration config) {
|
||||
Log.d("GeckoApplication", "onConfigurationChanged: " + config.locale +
|
||||
", background: " + mInBackground);
|
||||
Log.d(LOG_TAG, "onConfigurationChanged: " + config.locale +
|
||||
", background: " + mInBackground);
|
||||
|
||||
// Do nothing if we're in the background. It'll simply cause a loop
|
||||
// (Bug 936756 Comment 11), and it's not necessary.
|
||||
@ -41,7 +42,13 @@ public class GeckoApplication extends Application {
|
||||
|
||||
// Otherwise, correct the locale. This catches some cases that GeckoApp
|
||||
// doesn't get a chance to.
|
||||
LocaleManager.correctLocale(getResources(), config);
|
||||
try {
|
||||
LocaleManager.correctLocale(getResources(), config);
|
||||
} catch (IllegalStateException ex) {
|
||||
// GeckoApp hasn't started, so we have no ContextGetter in LocaleManager.
|
||||
Log.w(LOG_TAG, "Couldn't correct locale.", ex);
|
||||
}
|
||||
|
||||
super.onConfigurationChanged(config);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ public class LocaleManager {
|
||||
private static BroadcastReceiver receiver;
|
||||
|
||||
public static void setContextGetter(ContextGetter getter) {
|
||||
Log.d(LOG_TAG, "Calling setContextGetter: " + getter);
|
||||
LocaleManager.getter = getter;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user