diff options
author | Fyodor Kupolov <fkupolov@google.com> | 2017-09-05 18:17:58 -0700 |
---|---|---|
committer | Fyodor Kupolov <fkupolov@google.com> | 2017-09-05 18:17:58 -0700 |
commit | 0272515f306cf7f12d2babe03d625850990a00c1 (patch) | |
tree | c6f395524b75e41df614620644c65186e23e000f | |
parent | 0ad6b85db7b0b45cf42a38b1c083fb7e67692b3a (diff) | |
download | UserDictionaryProvider-0272515f306cf7f12d2babe03d625850990a00c1.tar.gz |
Close idle connections to release RAM
Close idle connections after 30s of inactivity to release RAM.
Savings: ~0.15MB on marlin
Bug: 63398887
Test: Create SMS and Use Add to dictionary
Change-Id: Ia94a235e6b4d7ef8be4ef869b38d4a3b2cac4f79
-rw-r--r-- | src/com/android/providers/userdictionary/UserDictionaryProvider.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/com/android/providers/userdictionary/UserDictionaryProvider.java b/src/com/android/providers/userdictionary/UserDictionaryProvider.java index a7a1971..c0f67e9 100644 --- a/src/com/android/providers/userdictionary/UserDictionaryProvider.java +++ b/src/com/android/providers/userdictionary/UserDictionaryProvider.java @@ -71,6 +71,8 @@ public class UserDictionaryProvider extends ContentProvider { private static final String USERDICT_TABLE_NAME = "words"; + private static final int IDLE_CONNECTION_TIMEOUT_MS = 30000; + private static ArrayMap<String, String> sDictProjectionMap; private static final UriMatcher sUriMatcher; @@ -104,6 +106,8 @@ public class UserDictionaryProvider extends ContentProvider { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); + // Memory optimization - close idle connections after 30s of inactivity + setIdleConnectionTimeout(IDLE_CONNECTION_TIMEOUT_MS); } @Override |