diff options
author | Winson Chung <winsonc@google.com> | 2012-06-11 14:13:51 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-06-11 14:13:51 -0700 |
commit | 898f152d79e06828675361a176772cdf1cef56ca (patch) | |
tree | 584c50ad7f35f251cb0a7c0a377c786a70cdd88e /src/com/android/launcher2 | |
parent | db2bfa05062b492664eff85c87dc6b725a9c983c (diff) | |
parent | d9e20bfba5b23c0da34dd628d9055ec3baad1ade (diff) | |
download | packages_apps_trebuchet-898f152d79e06828675361a176772cdf1cef56ca.zip packages_apps_trebuchet-898f152d79e06828675361a176772cdf1cef56ca.tar.gz packages_apps_trebuchet-898f152d79e06828675361a176772cdf1cef56ca.tar.bz2 |
Merge "Adding additional synchronized blocks when committing changes to the new-apps list. (Bug 6621553)" into jb-dev
Diffstat (limited to 'src/com/android/launcher2')
-rw-r--r-- | src/com/android/launcher2/InstallShortcutReceiver.java | 10 | ||||
-rw-r--r-- | src/com/android/launcher2/UninstallShortcutReceiver.java | 16 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java index b454afd..54ba7de 100644 --- a/src/com/android/launcher2/InstallShortcutReceiver.java +++ b/src/com/android/launcher2/InstallShortcutReceiver.java @@ -191,10 +191,12 @@ public class InstallShortcutReceiver extends BroadcastReceiver { final Set<String> savedNewApps = newApps; new Thread("setNewAppsThread") { public void run() { - sharedPrefs.edit() - .putInt(NEW_APPS_PAGE_KEY, screen) - .putStringSet(NEW_APPS_LIST_KEY, savedNewApps) - .commit(); + synchronized (savedNewApps) { + sharedPrefs.edit() + .putInt(NEW_APPS_PAGE_KEY, screen) + .putStringSet(NEW_APPS_LIST_KEY, savedNewApps) + .commit(); + } } }.start(); diff --git a/src/com/android/launcher2/UninstallShortcutReceiver.java b/src/com/android/launcher2/UninstallShortcutReceiver.java index e94a17f..02590c9 100644 --- a/src/com/android/launcher2/UninstallShortcutReceiver.java +++ b/src/com/android/launcher2/UninstallShortcutReceiver.java @@ -148,14 +148,16 @@ public class UninstallShortcutReceiver extends BroadcastReceiver { final Set<String> savedNewApps = newApps; new Thread("setNewAppsThread-remove") { public void run() { - SharedPreferences.Editor editor = sharedPrefs.edit(); - editor.putStringSet(InstallShortcutReceiver.NEW_APPS_LIST_KEY, - savedNewApps); - if (savedNewApps.isEmpty()) { - // Reset the page index if there are no more items - editor.putInt(InstallShortcutReceiver.NEW_APPS_PAGE_KEY, -1); + synchronized (savedNewApps) { + SharedPreferences.Editor editor = sharedPrefs.edit(); + editor.putStringSet(InstallShortcutReceiver.NEW_APPS_LIST_KEY, + savedNewApps); + if (savedNewApps.isEmpty()) { + // Reset the page index if there are no more items + editor.putInt(InstallShortcutReceiver.NEW_APPS_PAGE_KEY, -1); + } + editor.commit(); } - editor.commit(); } }.start(); } |