diff options
author | Winson Chung <winsonc@google.com> | 2012-06-06 16:17:04 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-06-06 16:17:04 -0700 |
commit | 478244409e15594ceaa7426a6a23cc805db0b1fc (patch) | |
tree | 078917028e2c0fa70394e9444733a1c6d4c253cc /src/com/android/launcher2 | |
parent | 5766032503a4ace048e69d6540a46134a858cbb9 (diff) | |
parent | bfeac0681b63091731c853fdafa3206642449a9d (diff) | |
download | android_packages_apps_Trebuchet-478244409e15594ceaa7426a6a23cc805db0b1fc.tar.gz android_packages_apps_Trebuchet-478244409e15594ceaa7426a6a23cc805db0b1fc.tar.bz2 android_packages_apps_Trebuchet-478244409e15594ceaa7426a6a23cc805db0b1fc.zip |
Merge "Synchronizing on the new-apps list before modifying it. (Bug 6621553)" into jb-dev
Diffstat (limited to 'src/com/android/launcher2')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/AppsCustomizeTabHost.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/InstallShortcutReceiver.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 10 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/UninstallShortcutReceiver.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 18 |
7 files changed, 33 insertions, 17 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index ac6ec8800..61329adaf 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -940,7 +940,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen @Override public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) { - Log.d(TAG, "6549598 onLauncherTransitionEnd"); + Log.d(TAG, "6549598 onLauncherTransitionEnd mDeferredSyncWidgetPageItems.size(): " + mDeferredSyncWidgetPageItems.size()); mInTransition = false; for (AsyncTaskPageData d : mDeferredSyncWidgetPageItems) { onSyncWidgetPageItems(d); @@ -1108,7 +1108,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } public void syncAppsPageItems(int page, boolean immediate) { - Log.d(TAG, "6549598 syncAppsPageItems page: " + page); + Log.d(TAG, "6549598 syncAppsPageItems page: " + page + " mNumAppsPages: " + mNumAppsPages); // ensure that we have the right number of items on the pages int numCells = mCellCountX * mCellCountY; int startIndex = page * numCells; diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java index d3afc3bf0..6bd97a2f2 100644 --- a/src/com/android/launcher2/AppsCustomizeTabHost.java +++ b/src/com/android/launcher2/AppsCustomizeTabHost.java @@ -23,6 +23,7 @@ import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.Resources; import android.util.AttributeSet; +import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -392,6 +393,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona // Make sure the current page is loaded (we start loading the side pages after the // transition to prevent slowing down the animation) + Log.d(LOG_TAG, "6549598 onLauncherTransitionPrepare currentPage: " + mAppsCustomizePane.getCurrentPage()); mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true); if (!LauncherApplication.isScreenLarge()) { @@ -434,6 +436,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona mAppsCustomizePane.showAllAppsCling(); // Make sure adjacent pages are loaded (we wait until after the transition to // prevent slowing down the animation) + Log.d(LOG_TAG, "6549598 onLauncherTransitionEnd currentPage: " + mAppsCustomizePane.getCurrentPage()); mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage()); if (!LauncherApplication.isScreenLarge()) { diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java index e05127b27..b454afd7f 100644 --- a/src/com/android/launcher2/InstallShortcutReceiver.java +++ b/src/com/android/launcher2/InstallShortcutReceiver.java @@ -185,7 +185,9 @@ public class InstallShortcutReceiver extends BroadcastReceiver { if (newAppsScreen == screen) { newApps = sharedPrefs.getStringSet(NEW_APPS_LIST_KEY, newApps); } - newApps.add(intent.toUri(0).toString()); + synchronized (newApps) { + newApps.add(intent.toUri(0).toString()); + } final Set<String> savedNewApps = newApps; new Thread("setNewAppsThread") { public void run() { diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index d7dd6480a..659077f71 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -3145,9 +3145,13 @@ public final class Launcher extends Activity View shortcut = createShortcut(info); workspace.addInScreen(shortcut, item.container, item.screen, item.cellX, item.cellY, 1, 1, false); - if (newApps.contains(uri)) { - newApps.remove(uri); - + boolean animateIconUp = false; + synchronized (newApps) { + if (newApps.contains(uri)) { + animateIconUp = newApps.remove(uri); + } + } + if (animateIconUp) { // Prepare the view to be animated up shortcut.setAlpha(0f); shortcut.setScaleX(0f); diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index c8202642a..19f6a62a7 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -234,6 +234,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc mDirtyPageContent.ensureCapacity(32); mScroller = new Scroller(getContext(), new ScrollInterpolator()); mCurrentPage = 0; + if (this instanceof AppsCustomizePagedView) Log.d(TAG, "6549598 init() mCurrentPage: " + mCurrentPage); mCenterPagesVertically = true; final ViewConfiguration configuration = ViewConfiguration.get(getContext()); @@ -317,7 +318,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc return; } + mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1)); + if (this instanceof AppsCustomizePagedView) Log.d(TAG, "6549598 setCurrentPage mCurrentPage: " + mCurrentPage); updateCurrentPageScroll(); updateScrollingIndicator(); notifyPageSwitchListener(); diff --git a/src/com/android/launcher2/UninstallShortcutReceiver.java b/src/com/android/launcher2/UninstallShortcutReceiver.java index 84b1ad50e..e94a17ffd 100644 --- a/src/com/android/launcher2/UninstallShortcutReceiver.java +++ b/src/com/android/launcher2/UninstallShortcutReceiver.java @@ -139,9 +139,11 @@ public class UninstallShortcutReceiver extends BroadcastReceiver { boolean appRemoved; Set<String> newApps = new HashSet<String>(); newApps = sharedPrefs.getStringSet(InstallShortcutReceiver.NEW_APPS_LIST_KEY, newApps); - do { - appRemoved = newApps.remove(intent.toUri(0).toString()); - } while (appRemoved); + synchronized (newApps) { + do { + appRemoved = newApps.remove(intent.toUri(0).toString()); + } while (appRemoved); + } if (appRemoved) { final Set<String> savedNewApps = newApps; new Thread("setNewAppsThread-remove") { diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 8b9662b3b..11eb3c15b 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -3682,14 +3682,16 @@ public class Workspace extends SmoothPagedView } // Remove all queued items that match the same package if (newApps != null) { - for (String intentStr : newApps) { - try { - Intent intent = Intent.parseUri(intentStr, 0); - String pn = ItemInfo.getPackageName(intent); - if (packageNames.contains(pn)) { - newApps.remove(intentStr); - } - } catch (URISyntaxException e) {} + synchronized (newApps) { + for (String intentStr : newApps) { + try { + Intent intent = Intent.parseUri(intentStr, 0); + String pn = ItemInfo.getPackageName(intent); + if (packageNames.contains(pn)) { + newApps.remove(intentStr); + } + } catch (URISyntaxException e) {} + } } } } |