summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/LauncherModel.java
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2010-10-27 13:21:00 -0700
committerJoe Onorato <joeo@google.com>2010-10-27 13:21:00 -0700
commitef2efcff5e70e5900f4f10f9e46c3fa17c03b0ec (patch)
treeb539f42e8daceb9cb1d56d1f41fc73303add2faa /src/com/android/launcher2/LauncherModel.java
parenta915a917a2d80a076030cf90791d607cf67a250c (diff)
downloadandroid_packages_apps_Trebuchet-ef2efcff5e70e5900f4f10f9e46c3fa17c03b0ec.tar.gz
android_packages_apps_Trebuchet-ef2efcff5e70e5900f4f10f9e46c3fa17c03b0ec.tar.bz2
android_packages_apps_Trebuchet-ef2efcff5e70e5900f4f10f9e46c3fa17c03b0ec.zip
When the launcher is paused and we reload stuff in the background, we need to re-re-load it in onResume.
Otherwise we can load widgets and other resources from the wrong Configuration. This doesn't completely fix the bug, but it makes it much less likely. We tell the launcher once at the beginning of starting a reload because of SD cards coming back, and once when we bind. cherry pick of I99ee6af38bef91e261832bad4dec978a5d4a8b3d Bug: 3126698 Change-Id: I917bdb3982e3eea4924c6e9a8f3c037fd493f415
Diffstat (limited to 'src/com/android/launcher2/LauncherModel.java')
-rw-r--r--src/com/android/launcher2/LauncherModel.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index eff5ed63b..1e58ca0e4 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -108,6 +108,7 @@ public class LauncherModel extends BroadcastReceiver {
private static int mCellCountY;
public interface Callbacks {
+ public boolean setLoadOnResume();
public int getCurrentWorkspaceScreen();
public void startBinding();
public void bindItems(ArrayList<ItemInfo> shortcuts, int start, int end);
@@ -433,7 +434,19 @@ public class LauncherModel extends BroadcastReceiver {
String[] packages = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);
enqueuePackageUpdated(new PackageUpdatedTask(PackageUpdatedTask.OP_ADD, packages));
// Then, rebind everything.
- startLoader(mApp, false);
+ boolean runLoader = true;
+ if (mCallbacks != null) {
+ Callbacks callbacks = mCallbacks.get();
+ if (callbacks != null) {
+ // If they're paused, we can skip loading, because they'll do it again anyway
+ if (callbacks.setLoadOnResume()) {
+ runLoader = false;
+ }
+ }
+ }
+ if (runLoader) {
+ startLoader(mApp, false);
+ }
} else if (Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action)) {
String[] packages = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);