Adding additional synchronized blocks when committing changes to the new-apps list. (Bug 6621553)

Change-Id: Ia2553321230fec4202fa064cdc66ffd13d005281
This commit is contained in:
Winson Chung committed 2012-06-11 13:58:30 -07:00
1 parent 478244409e
commit d9e20bfba5
2 files changed
+15 -11

No files matched your search

@@ -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();
}