Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-Launcher: 提交

packages/apps/Launcher


Commit MetaInfo

修订版f3fe9030b6f729782c52d4d7c47757ffefa0a771 (tree)
时间2010-04-18 01:09:16
作者chrisrl <chris+android@zent...>
CommiterChih-Wei Huang

Log Message

Fix a race condition that caused the Launcher to be blank when triggered.

更改概述

差异

--- a/src/com/android/launcher/LauncherModel.java
+++ b/src/com/android/launcher/LauncherModel.java
@@ -541,10 +541,12 @@ public class LauncherModel {
541541 launcher.runOnUiThread(action);
542542 }
543543
544- if (!mStopped) {
545- mApplicationsLoaded = true;
546- } else {
547- if (DEBUG_LOADERS) d(LOG_TAG, " ----> applications loader stopped (" + mId + ")");
544+ synchronized(LauncherModel.this) {
545+ if (!mStopped) {
546+ mApplicationsLoaded = true;
547+ } else {
548+ if (DEBUG_LOADERS) d(LOG_TAG, " ----> applications loader stopped (" + mId + ")");
549+ }
548550 }
549551 mRunning = false;
550552 }
@@ -951,40 +953,42 @@ public class LauncherModel {
951953 c.close();
952954 }
953955
954- if (!mStopped) {
955- if (DEBUG_LOADERS) {
956- d(LOG_TAG, " --> done loading workspace");
957- d(LOG_TAG, " ----> worskpace items=" + desktopItems.size());
958- d(LOG_TAG, " ----> worskpace widgets=" + desktopAppWidgets.size());
959- }
956+ synchronized(LauncherModel.this) {
957+ if (!mStopped) {
958+ if (DEBUG_LOADERS) {
959+ d(LOG_TAG, " --> done loading workspace");
960+ d(LOG_TAG, " ----> worskpace items=" + desktopItems.size());
961+ d(LOG_TAG, " ----> worskpace widgets=" + desktopAppWidgets.size());
962+ }
960963
961- // Create a copy of the lists in case the workspace loader is restarted
962- // and the list are cleared before the UI can go through them
963- final ArrayList<ItemInfo> uiDesktopItems =
964- new ArrayList<ItemInfo>(desktopItems);
965- final ArrayList<LauncherAppWidgetInfo> uiDesktopWidgets =
966- new ArrayList<LauncherAppWidgetInfo>(desktopAppWidgets);
964+ // Create a copy of the lists in case the workspace loader is restarted
965+ // and the list are cleared before the UI can go through them
966+ final ArrayList<ItemInfo> uiDesktopItems =
967+ new ArrayList<ItemInfo>(desktopItems);
968+ final ArrayList<LauncherAppWidgetInfo> uiDesktopWidgets =
969+ new ArrayList<LauncherAppWidgetInfo>(desktopAppWidgets);
970+
971+ if (!mStopped) {
972+ d(LOG_TAG, " ----> items cloned, ready to refresh UI");
973+ launcher.runOnUiThread(new Runnable() {
974+ public void run() {
975+ if (DEBUG_LOADERS) d(LOG_TAG, " ----> onDesktopItemsLoaded()");
976+ launcher.onDesktopItemsLoaded(uiDesktopItems, uiDesktopWidgets);
977+ }
978+ });
979+ }
967980
968- if (!mStopped) {
969- d(LOG_TAG, " ----> items cloned, ready to refresh UI");
970- launcher.runOnUiThread(new Runnable() {
971- public void run() {
972- if (DEBUG_LOADERS) d(LOG_TAG, " ----> onDesktopItemsLoaded()");
973- launcher.onDesktopItemsLoaded(uiDesktopItems, uiDesktopWidgets);
981+ if (mLoadApplications) {
982+ if (DEBUG_LOADERS) {
983+ d(LOG_TAG, " ----> loading applications from workspace loader");
974984 }
975- });
976- }
977-
978- if (mLoadApplications) {
979- if (DEBUG_LOADERS) {
980- d(LOG_TAG, " ----> loading applications from workspace loader");
985+ startApplicationsLoader(launcher, mIsLaunching);
981986 }
982- startApplicationsLoader(launcher, mIsLaunching);
983- }
984987
985- mDesktopItemsLoaded = true;
986- } else {
987- if (DEBUG_LOADERS) d(LOG_TAG, " ----> worskpace loader was stopped");
988+ mDesktopItemsLoaded = true;
989+ } else {
990+ if (DEBUG_LOADERS) d(LOG_TAG, " ----> worskpace loader was stopped");
991+ }
988992 }
989993 mRunning = false;
990994 }
Show on old repository browser