summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2012-06-12 12:42:29 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-06-12 12:42:29 -0700
commit5016b98520b9dbad8cf234a15fded9fb9e805ea2 (patch)
tree584c50ad7f35f251cb0a7c0a377c786a70cdd88e
parentfab8e5506ddb26cb8218aa89b60813a8083b9998 (diff)
parent898f152d79e06828675361a176772cdf1cef56ca (diff)
downloadandroid_packages_apps_Trebuchet-5016b98520b9dbad8cf234a15fded9fb9e805ea2.tar.gz
android_packages_apps_Trebuchet-5016b98520b9dbad8cf234a15fded9fb9e805ea2.tar.bz2
android_packages_apps_Trebuchet-5016b98520b9dbad8cf234a15fded9fb9e805ea2.zip
am 898f152d: Merge "Adding additional synchronized blocks when committing changes to the new-apps list. (Bug 6621553)" into jb-dev
* commit '898f152d79e06828675361a176772cdf1cef56ca': Adding additional synchronized blocks when committing changes to the new-apps list. (Bug 6621553)
-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 b454afd7f..54ba7de18 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 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();
}