summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/Launcher.java3
-rw-r--r--src/com/android/launcher3/LauncherAppState.java2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 3a9b2c195..47fa66b77 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -348,6 +348,9 @@ public class Launcher extends Activity
}
super.onCreate(savedInstanceState);
+
+ // the LauncherApplication should call this, but in case of Instrumentation it might not be present yet
+ LauncherAppState.setApplicationContext(getApplicationContext());
LauncherAppState app = LauncherAppState.getInstance();
mSharedPrefs = getSharedPreferences(LauncherAppState.getSharedPreferencesKey(),
Context.MODE_PRIVATE);
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index ea8904f1f..03d2d3395 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -54,7 +54,7 @@ public class LauncherAppState {
public static void setApplicationContext(Context context) {
if (sContext != null) {
- throw new IllegalStateException("setApplicationContext called twice! old=" + sContext + " new=" + context);
+ Log.w(Launcher.TAG, "setApplicationContext called twice! old=" + sContext + " new=" + context);
}
sContext = context.getApplicationContext();
}