summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2012-05-08 14:37:08 -0700
committerWinson Chung <winsonc@google.com>2012-05-08 14:37:48 -0700
commitde0fb8fbf11caac382589ab464b50d528942273a (patch)
tree7b639ab24216aa707635c5af6a4a91dba3fdb6f6
parentdf4c0e25e579500a54023f92aff0dd0f2e2abc2a (diff)
downloadandroid_packages_apps_Trebuchet-de0fb8fbf11caac382589ab464b50d528942273a.tar.gz
android_packages_apps_Trebuchet-de0fb8fbf11caac382589ab464b50d528942273a.tar.bz2
android_packages_apps_Trebuchet-de0fb8fbf11caac382589ab464b50d528942273a.zip
Queueing up items for adding later if Launcher is unavailable. (Bug 6457412)
Change-Id: Ia66a6411a54397543db4122a80ebca6a50b6360c
-rw-r--r--src/com/android/launcher2/InstallShortcutReceiver.java10
-rw-r--r--src/com/android/launcher2/Launcher.java3
2 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java
index 6d91602dc..e05127b27 100644
--- a/src/com/android/launcher2/InstallShortcutReceiver.java
+++ b/src/com/android/launcher2/InstallShortcutReceiver.java
@@ -22,6 +22,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
+import android.os.Debug;
import android.widget.Toast;
import com.android.launcher.R;
@@ -90,9 +91,12 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
return;
}
}
+ // Queue the item up for adding if launcher has not loaded properly yet
+ boolean launcherNotLoaded = LauncherModel.getCellCountX() <= 0 ||
+ LauncherModel.getCellCountY() <= 0;
PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, name, intent);
- if (mUseInstallQueue) {
+ if (mUseInstallQueue || launcherNotLoaded) {
mInstallQueue.add(info);
} else {
processInstallShortcut(context, info);
@@ -102,9 +106,11 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
static void enableInstallQueue() {
mUseInstallQueue = true;
}
-
static void disableAndFlushInstallQueue(Context context) {
mUseInstallQueue = false;
+ flushInstallQueue(context);
+ }
+ static void flushInstallQueue(Context context) {
Iterator<PendingInstallShortcutInfo> iter = mInstallQueue.iterator();
while (iter.hasNext()) {
processInstallShortcut(context, iter.next());
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index d0f4b86fb..6025c701f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -649,6 +649,9 @@ public final class Launcher extends Activity
protected void onResume() {
super.onResume();
+ // Process any items that were added while Launcher was away
+ InstallShortcutReceiver.flushInstallQueue(this);
+
mPaused = false;
if (mRestoring || mOnResumeNeedsLoad) {
mWorkspaceLoading = true;