Always set the LauncherAppState context before using it from a broadcast. (Bug 10947459)

Change-Id: I284786b538a9d58aa96cfc208ef68621e2500645
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java
index b4d6ea5..821c15f 100644
--- a/src/com/android/launcher3/InstallShortcutReceiver.java
+++ b/src/com/android/launcher3/InstallShortcutReceiver.java
@@ -224,6 +224,7 @@
             data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
 
         // Queue the item up for adding if launcher has not loaded properly yet
+        LauncherAppState.setApplicationContext(context.getApplicationContext());
         LauncherAppState app = LauncherAppState.getInstance();
         boolean launcherNotLoaded = (app.getDynamicGrid() == null);
 
diff --git a/src/com/android/launcher3/UninstallShortcutReceiver.java b/src/com/android/launcher3/UninstallShortcutReceiver.java
index 00fa631..ccea4ec 100644
--- a/src/com/android/launcher3/UninstallShortcutReceiver.java
+++ b/src/com/android/launcher3/UninstallShortcutReceiver.java
@@ -78,6 +78,7 @@
             PendingUninstallShortcutInfo pendingInfo) {
         final Intent data = pendingInfo.data;
 
+        LauncherAppState.setApplicationContext(context.getApplicationContext());
         LauncherAppState app = LauncherAppState.getInstance();
         synchronized (app) { // TODO: make removeShortcut internally threadsafe
             removeShortcut(context, data);