summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2012-06-11 21:13:51 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-11 21:13:51 (GMT)
commit898f152d79e06828675361a176772cdf1cef56ca (patch)
tree584c50ad7f35f251cb0a7c0a377c786a70cdd88e
parentdb2bfa05062b492664eff85c87dc6b725a9c983c (diff)
parentd9e20bfba5b23c0da34dd628d9055ec3baad1ade (diff)
downloadandroid_packages_apps_Trebuchet-898f152d79e06828675361a176772cdf1cef56ca.zip
android_packages_apps_Trebuchet-898f152d79e06828675361a176772cdf1cef56ca.tar.gz
android_packages_apps_Trebuchet-898f152d79e06828675361a176772cdf1cef56ca.tar.bz2
Merge "Adding additional synchronized blocks when committing changes to the new-apps list. (Bug 6621553)" into jb-dev
-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 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();
}