Protect against duplicate timestamps
Despite the timestamp having millisecond granulatiry, it was still
possible to get a duplicate one for very short scans. Instead of
throwing an exception, just overwrite the previous one.
Change-Id: Ia468838c6aca79384cf1fa571be8262d19ddd382
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 2292ed8..2a24d9c 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -1817,7 +1817,8 @@
* Write a persistent diagnostic message to the log table.
*/
static void logToDb(SQLiteDatabase db, String message) {
- db.execSQL("INSERT INTO log (time,message) VALUES (strftime('%Y-%m-%d %H:%M:%f','now'),?);",
+ db.execSQL("INSERT OR REPLACE" +
+ " INTO log (time,message) VALUES (strftime('%Y-%m-%d %H:%M:%f','now'),?);",
new String[] { message });
// delete all but the last 500 rows
db.execSQL("DELETE FROM log WHERE rowid IN" +