Merge "Close idle connections to release RAM" into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
da49d05a8d
@@ -713,12 +713,15 @@ class LockSettingsStorage {
|
|||||||
private static final String DATABASE_NAME = "locksettings.db";
|
private static final String DATABASE_NAME = "locksettings.db";
|
||||||
|
|
||||||
private static final int DATABASE_VERSION = 2;
|
private static final int DATABASE_VERSION = 2;
|
||||||
|
private static final int IDLE_CONNECTION_TIMEOUT_MS = 30000;
|
||||||
|
|
||||||
private Callback mCallback;
|
private Callback mCallback;
|
||||||
|
|
||||||
public DatabaseHelper(Context context) {
|
public DatabaseHelper(Context context) {
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
setWriteAheadLoggingEnabled(true);
|
setWriteAheadLoggingEnabled(true);
|
||||||
|
// Memory optimization - close idle connections after 30s of inactivity
|
||||||
|
setIdleConnectionTimeout(IDLE_CONNECTION_TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCallback(Callback callback) {
|
public void setCallback(Callback callback) {
|
||||||
|
|||||||
@@ -1059,6 +1059,9 @@ public class NotificationUsageStats {
|
|||||||
private static final int EVENT_TYPE_CLICK = 2;
|
private static final int EVENT_TYPE_CLICK = 2;
|
||||||
private static final int EVENT_TYPE_REMOVE = 3;
|
private static final int EVENT_TYPE_REMOVE = 3;
|
||||||
private static final int EVENT_TYPE_DISMISS = 4;
|
private static final int EVENT_TYPE_DISMISS = 4;
|
||||||
|
|
||||||
|
private static final int IDLE_CONNECTION_TIMEOUT_MS = 30000;
|
||||||
|
|
||||||
private static long sLastPruneMs;
|
private static long sLastPruneMs;
|
||||||
|
|
||||||
private static long sNumWrites;
|
private static long sNumWrites;
|
||||||
@@ -1140,6 +1143,12 @@ public class NotificationUsageStats {
|
|||||||
")");
|
")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigure(SQLiteDatabase db) {
|
||||||
|
// Memory optimization - close idle connections after 30s of inactivity
|
||||||
|
setIdleConnectionTimeout(IDLE_CONNECTION_TIMEOUT_MS);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
if (oldVersion != newVersion) {
|
if (oldVersion != newVersion) {
|
||||||
|
|||||||
Reference in New Issue
Block a user