summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Studer <chstuder@google.com>2014-08-04 14:24:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-04 08:01:05 +0000
commit273f246c27dc0a2522eb90eb8256d13a9228c64d (patch)
treed679638874210243d19ba8237504780a640c8dd3
parent5f3278ba1e7572d4a5624d18fd08ba9038abc575 (diff)
parent1ad856e17f988482bbf37fc5b94cd55baee464ae (diff)
downloadframeworks_base-273f246c27dc0a2522eb90eb8256d13a9228c64d.zip
frameworks_base-273f246c27dc0a2522eb90eb8256d13a9228c64d.tar.gz
frameworks_base-273f246c27dc0a2522eb90eb8256d13a9228c64d.tar.bz2
Merge "NoMan: Fix notification sqlite log schema" into lmp-dev
-rw-r--r--services/core/java/com/android/server/notification/NotificationUsageStats.java29
1 files changed, 8 insertions, 21 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationUsageStats.java b/services/core/java/com/android/server/notification/NotificationUsageStats.java
index 9b56464..4a7a971 100644
--- a/services/core/java/com/android/server/notification/NotificationUsageStats.java
+++ b/services/core/java/com/android/server/notification/NotificationUsageStats.java
@@ -468,7 +468,7 @@ public class NotificationUsageStats {
private static final int MSG_DISMISS = 4;
private static final String DB_NAME = "notification_log.db";
- private static final int DB_VERSION = 3;
+ private static final int DB_VERSION = 4;
/** Age in ms after which events are pruned from the DB. */
private static final long HORIZON_MS = 7 * 24 * 60 * 60 * 1000L; // 1 week
@@ -559,32 +559,19 @@ public class NotificationUsageStats {
COL_CATEGORY + " TEXT," +
COL_ACTION_COUNT + " INT," +
COL_POSTTIME_MS + " INT," +
- COL_AIRTIME_MS + " INT" +
- COL_FIRST_EXPANSIONTIME_MS + " INT" +
- COL_AIRTIME_EXPANDED_MS + " INT" +
+ COL_AIRTIME_MS + " INT," +
+ COL_FIRST_EXPANSIONTIME_MS + " INT," +
+ COL_AIRTIME_EXPANDED_MS + " INT," +
COL_EXPAND_COUNT + " INT" +
")");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- switch (oldVersion) {
- case 1:
- // Add COL_POSTTIME_MS, COL_AIRTIME_MS columns,
- db.execSQL("ALTER TABLE " + TAB_LOG + " ADD COLUMN " +
- COL_POSTTIME_MS + " INT");
- db.execSQL("ALTER TABLE " + TAB_LOG + " ADD COLUMN " +
- COL_AIRTIME_MS + " INT");
- case 2:
- // Add COL_EXPANSIONTIME_MS column
- db.execSQL("ALTER TABLE " + TAB_LOG + " ADD COLUMN " +
- COL_FIRST_EXPANSIONTIME_MS + " INT");
- // Add COL_AIRTIME_EXPANDED_MS column
- db.execSQL("ALTER TABLE " + TAB_LOG + " ADD COLUMN " +
- COL_AIRTIME_EXPANDED_MS + " INT");
- // Add COL_EXPAND_COUNT column
- db.execSQL("ALTER TABLE " + TAB_LOG + " ADD COLUMN " +
- COL_EXPAND_COUNT + " INT");
+ if (oldVersion <= 3) {
+ // Version 3 creation left 'log' in a weird state. Just reset for now.
+ db.execSQL("DROP TABLE IF EXISTS " + TAB_LOG);
+ onCreate(db);
}
}
};