summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/provider
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-07-27 15:04:47 -0700
committerJohn Reck <jreck@google.com>2011-07-27 15:50:46 -0700
commitc032281239c0e0452be91a4184f8a9aab7dcdebe (patch)
tree8f8f9841de69b13088c39d2cbb70049bf31369a1 /src/com/android/browser/provider
parent80a5fbb2965a859e0ccc814c02b30434645044e7 (diff)
downloadpackages_apps_Browser-c032281239c0e0452be91a4184f8a9aab7dcdebe.zip
packages_apps_Browser-c032281239c0e0452be91a4184f8a9aab7dcdebe.tar.gz
packages_apps_Browser-c032281239c0e0452be91a4184f8a9aab7dcdebe.tar.bz2
Fix HC -> ICS db upgrade
Bug: 3249854 When upgrading from HC to ICS, enable account sync for browser as in HC it defaulted to off whereas in ICS we default to on. Change-Id: I69ccd535409c0e5b031efe087c09cc06281c2537
Diffstat (limited to 'src/com/android/browser/provider')
-rw-r--r--src/com/android/browser/provider/BrowserProvider2.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java
index e40a882..fe7a31b 100644
--- a/src/com/android/browser/provider/BrowserProvider2.java
+++ b/src/com/android/browser/provider/BrowserProvider2.java
@@ -432,6 +432,26 @@ public class BrowserProvider2 extends SQLiteContentProvider {
values.put(Settings.KEY, Settings.KEY_SYNC_ENABLED);
values.put(Settings.VALUE, 1);
insertSettingsInTransaction(db, values);
+ // Enable bookmark sync on all accounts
+ AccountManager am = (AccountManager) getContext().getSystemService(
+ Context.ACCOUNT_SERVICE);
+ if (am == null) {
+ return;
+ }
+ Account[] accounts = am.getAccountsByType("com.google");
+ if (accounts == null || accounts.length == 0) {
+ return;
+ }
+ for (Account account : accounts) {
+ if (ContentResolver.getIsSyncable(
+ account, BrowserContract.AUTHORITY) == 0) {
+ // Account wasn't syncable, enable it
+ ContentResolver.setIsSyncable(
+ account, BrowserContract.AUTHORITY, 1);
+ ContentResolver.setSyncAutomatically(
+ account, BrowserContract.AUTHORITY, true);
+ }
+ }
}
boolean importFromBrowserProvider(SQLiteDatabase db) {