AI 143294: Fixes #1725672. For good this time. When Home starts for the first time, it spawns a loading thread for the workspace items. That loader is responsible for starting the drawer loader after it's done. Unfortunately, after a wipe data or a database upgrade, the worksapce loader could be interrupted by a ContentProvider notification change which would cause the loader to be cancelled and another workspace loader to be spawned. The new workspace loader, however, would not start the drawer loader because the appropriate flag was not set correctly. This change simply duplicates the flag from the old loader in the new one and all is well.

BUG=1725672

Automated import of CL 143294
This commit is contained in:
Romain Guy 2009-03-27 17:34:37 -07:00 committed by The Android Open Source Project
parent 21b086984b
commit bcc7c577d3
1 changed files with 10 additions and 1 deletions

View File

@ -584,6 +584,7 @@ public class LauncherModel {
} }
if (mDesktopItemsLoader != null && mDesktopItemsLoader.isRunning()) { if (mDesktopItemsLoader != null && mDesktopItemsLoader.isRunning()) {
if (DEBUG_LOADERS) d(LOG_TAG, " --> stopping workspace loader");
mDesktopItemsLoader.stop(); mDesktopItemsLoader.stop();
// Wait for the currently running thread to finish, this can take a little // Wait for the currently running thread to finish, this can take a little
// time but it should be well below the timeout limit // time but it should be well below the timeout limit
@ -592,6 +593,13 @@ public class LauncherModel {
} catch (InterruptedException e) { } catch (InterruptedException e) {
// Empty // Empty
} }
// If the thread we are interrupting was tasked to load the list of
// applications make sure we keep that information in the new loader
// spawned below
// note: we don't apply this to localeChanged because the thread can
// only be stopped *after* the localeChanged handling has occured
loadApplications = mDesktopItemsLoader.mLoadApplications;
} }
if (DEBUG_LOADERS) d(LOG_TAG, " --> starting workspace loader"); if (DEBUG_LOADERS) d(LOG_TAG, " --> starting workspace loader");
@ -636,7 +644,8 @@ public class LauncherModel {
final ContentValues values = new ContentValues(); final ContentValues values = new ContentValues();
values.put(LauncherSettings.Favorites.TITLE, label); values.put(LauncherSettings.Favorites.TITLE, label);
resolver.update(LauncherSettings.Favorites.CONTENT_URI_NO_NOTIFICATION, resolver.update(
LauncherSettings.Favorites.CONTENT_URI_NO_NOTIFICATION,
values, "_id=?", values, "_id=?",
new String[] { String.valueOf(c.getLong(idIndex)) }); new String[] { String.valueOf(c.getLong(idIndex)) });