From cec583352cd76bd4319d56beec03a4820a3e9d58 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Thu, 7 Oct 2010 14:37:40 -0400 Subject: [PATCH] When the SD card comes back, we need to show the apps on it. The problem was that we were doing startLoader, but once the apps are loaded, all that does is re-bind everything. Before a recent change of mine, we were clearing mWorkspaceLoaded and mAllAppsLoaded. But that's not good either, because it meant that there needed to be a lock that the main thread and the worker thread were both acquiring, which was causing ANRs. Instead, now we schedule two messages - one to add the apps back into the list, and one to update everything to use those new icons. Bug: 3065061 Change-Id: If9d36d4b55a7ba72fcf48a5ed8941bb9466bebe6 --- src/com/android/launcher2/LauncherModel.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 0978499a99..ee61a919ea 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -340,8 +340,10 @@ public class LauncherModel extends BroadcastReceiver { } } else if (Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action)) { - // When everything comes back, just reload everything. We might not - // have the right icons for apps on external storage. + // First, schedule to add these apps back in. + String[] packages = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST); + enqueuePackageUpdated(new PackageUpdatedTask(PackageUpdatedTask.OP_ADD, packages)); + // Then, rebind everything. startLoader(mApp, false); } else if (Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action)) {