summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2012-06-12 13:15:18 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-06-12 13:15:18 -0700
commit56f5df728c6dd7108af774a10e57f3e2e2175d6f (patch)
treeac0084c0d476e34940009d61d612652b67d32b71 /src
parent04cd38fd0b5733821fceba3977dd16bec0af3666 (diff)
parent5016b98520b9dbad8cf234a15fded9fb9e805ea2 (diff)
downloadandroid_packages_apps_Trebuchet-56f5df728c6dd7108af774a10e57f3e2e2175d6f.tar.gz
android_packages_apps_Trebuchet-56f5df728c6dd7108af774a10e57f3e2e2175d6f.tar.bz2
android_packages_apps_Trebuchet-56f5df728c6dd7108af774a10e57f3e2e2175d6f.zip
am 5016b985: am 898f152d: Merge "Adding additional synchronized blocks when committing changes to the new-apps list. (Bug 6621553)" into jb-dev
* commit '5016b98520b9dbad8cf234a15fded9fb9e805ea2': Adding additional synchronized blocks when committing changes to the new-apps list. (Bug 6621553)
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/InstallShortcutReceiver.java10
-rw-r--r--src/com/android/launcher2/UninstallShortcutReceiver.java16
2 files changed, 15 insertions, 11 deletions
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java
index 81824c614..fb7bf30e0 100644
--- a/src/com/android/launcher2/InstallShortcutReceiver.java
+++ b/src/com/android/launcher2/InstallShortcutReceiver.java
@@ -190,10 +190,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 e94a17ffd..02590c9f6 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();
}