summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-07-29 15:16:23 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-29 15:16:23 -0700
commit0d883a28572fc634ab59d2727e48637c5b76fb3e (patch)
tree98cae4af542f7c944b7fef449615c3c30c3aa825
parent027ab22553a0d1202030a21103ccbd018b3487ff (diff)
parente17db4221f15a19fa636602ae317263cdde1a325 (diff)
downloadpackages_apps_Browser-0d883a28572fc634ab59d2727e48637c5b76fb3e.zip
packages_apps_Browser-0d883a28572fc634ab59d2727e48637c5b76fb3e.tar.gz
packages_apps_Browser-0d883a28572fc634ab59d2727e48637c5b76fb3e.tar.bz2
Merge "Fix race condition"
-rw-r--r--src/com/android/browser/provider/BrowserProvider2.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java
index 1821b50..0c1fd42 100644
--- a/src/com/android/browser/provider/BrowserProvider2.java
+++ b/src/com/android/browser/provider/BrowserProvider2.java
@@ -355,6 +355,7 @@ public class BrowserProvider2 extends SQLiteContentProvider {
SyncStateContentProviderHelper mSyncHelper = new SyncStateContentProviderHelper();
// This is so provider tests can intercept widget updating
ContentObserver mWidgetObserver = null;
+ boolean mUpdateWidgets = false;
final class DatabaseHelper extends SQLiteOpenHelper {
static final String DATABASE_NAME = "browser2.db";
@@ -766,10 +767,19 @@ public class BrowserProvider2 extends SQLiteContentProvider {
}
void refreshWidgets() {
- if (mWidgetObserver == null) {
- BookmarkThumbnailWidgetProvider.refreshWidgets(getContext());
- } else {
- mWidgetObserver.dispatchChange(false);
+ mUpdateWidgets = true;
+ }
+
+ @Override
+ protected void onEndTransaction(boolean callerIsSyncAdapter) {
+ super.onEndTransaction(callerIsSyncAdapter);
+ if (mUpdateWidgets) {
+ if (mWidgetObserver == null) {
+ BookmarkThumbnailWidgetProvider.refreshWidgets(getContext());
+ } else {
+ mWidgetObserver.dispatchChange(false);
+ }
+ mUpdateWidgets = false;
}
}