Execute update operations immediately if on right thread

- Potential fix to bug 5205131

Change-Id: Iae302f81e4c8f5c07dc4363b3bb9ef298a33faf4
This commit is contained in:
Michael Jurka
2011-08-31 20:59:26 -07:00
parent 82aef76fe3
commit 83df188ce0
+7 -2
View File
@@ -465,7 +465,7 @@ public class LauncherModel extends BroadcastReceiver {
item.onAddToDatabase(values);
item.updateValuesWithCoordinates(values, item.cellX, item.cellY);
sWorker.post(new Runnable() {
Runnable r = new Runnable() {
public void run() {
cr.update(LauncherSettings.Favorites.getContentUri(item.id, false),
values, null, null);
@@ -481,7 +481,12 @@ public class LauncherModel extends BroadcastReceiver {
throw new RuntimeException(msg);
}
}
});
};
if (sWorkerThread.getThreadId() == Process.myTid()) {
r.run();
} else {
sWorker.post(r);
}
}
/**