diff options
Diffstat (limited to 'src/com/android')
-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 b454afd7..54ba7de1 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 e94a17ff..02590c9f 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(); } |