summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2010-08-18 15:51:26 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-18 15:51:26 -0700
commit9be87f0a751a29226f6d2a57054eb0627d370b9b (patch)
tree45e83656b30b8d659d5b593959ecbfa4aaac5031
parentd69a1a64027cd5937c7db622aaf7af493e6d3610 (diff)
parent743270bd7601ff4798a653dbb6ba5e956797a78a (diff)
downloadplatform_packages_providers_CalendarProvider-froyo.tar.gz
platform_packages_providers_CalendarProvider-froyo.tar.bz2
platform_packages_providers_CalendarProvider-froyo.zip
Merge "Fix bug #2927288 (CalendarCache table is not setup correctly) - DO NOT MERGE" into froyoandroid-cts-2.2_r8froyo
-rw-r--r--src/com/android/providers/calendar/CalendarDatabaseHelper.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/com/android/providers/calendar/CalendarDatabaseHelper.java b/src/com/android/providers/calendar/CalendarDatabaseHelper.java
index b38831b..74da09c 100644
--- a/src/com/android/providers/calendar/CalendarDatabaseHelper.java
+++ b/src/com/android/providers/calendar/CalendarDatabaseHelper.java
@@ -58,7 +58,7 @@ import java.net.URLDecoder;
// Note: if you update the version number, you must also update the code
// in upgradeDatabase() to modify the database (gracefully, if possible).
- static final int DATABASE_VERSION = 69;
+ static final int DATABASE_VERSION = 70;
private static final int PRE_FROYO_SYNC_STATE_VERSION = 3;
@@ -428,7 +428,12 @@ import java.net.URLDecoder;
"value TEXT" +
");");
- db.execSQL("INSERT INTO CalendarCache (key, value) VALUES (" +
+ initCalendarCacheTable(db);
+ }
+
+ private void initCalendarCacheTable(SQLiteDatabase db) {
+ db.execSQL("INSERT INTO CalendarCache (_id, key, value) VALUES (" +
+ CalendarCache.KEY_TIMEZONE_DATABASE_VERSION.hashCode() + "," +
"'" + CalendarCache.KEY_TIMEZONE_DATABASE_VERSION + "'," +
"'" + CalendarCache.DEFAULT_TIMEZONE_DATABASE_VERSION + "'" +
");");
@@ -532,6 +537,10 @@ import java.net.URLDecoder;
upgradeToVersion69(db);
oldVersion = 69;
}
+ if (oldVersion == 69) {
+ upgradeToVersion70(db);
+ oldVersion += 1;
+ }
} catch (SQLiteException e) {
Log.e(TAG, "onUpgrade: SQLiteException, recreating db. " + e);
dropTables(db);
@@ -565,6 +574,11 @@ import java.net.URLDecoder;
}
@VisibleForTesting
+ void upgradeToVersion70(SQLiteDatabase db) {
+ createCalendarCacheTable(db);
+ }
+
+ @VisibleForTesting
static void upgradeToVersion69(SQLiteDatabase db) {
// Clean up allDay events which could be in an invalid state from an earlier version
// Some allDay events had hour, min, sec not set to zero, which throws elsewhere. This