Merge "Catch the SQLiteFullException in NotificationUsageStats." am: 41537638f0 am: b73b57577a

am: f1ddec0a41

Change-Id: I34674a94316d537442e2351387a200a6d6c0fea0
This commit is contained in:
Julia Reynolds
2019-05-22 17:47:27 -07:00
committed by android-build-merger

View File

@@ -23,6 +23,7 @@ import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteFullException;
import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteOpenHelper;
import android.os.Handler; import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
@@ -1272,9 +1273,13 @@ public class NotificationUsageStats {
sNumWrites = 0; sNumWrites = 0;
sLastPruneMs = nowMs; sLastPruneMs = nowMs;
long horizonStartMs = nowMs - HORIZON_MS; long horizonStartMs = nowMs - HORIZON_MS;
int deletedRows = db.delete(TAB_LOG, COL_EVENT_TIME + " < ?", try {
new String[] { String.valueOf(horizonStartMs) }); int deletedRows = db.delete(TAB_LOG, COL_EVENT_TIME + " < ?",
Log.d(TAG, "Pruned event entries: " + deletedRows); new String[]{String.valueOf(horizonStartMs)});
Log.d(TAG, "Pruned event entries: " + deletedRows);
} catch (SQLiteFullException e) {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
}
} }
} }