release-request-108343c4-ad88-44f9-aaa2-24d8b8a5c176-for-git_oc-mr1-release-4321077 snap-temp-L97000000100182150

Change-Id: If06c10bf05028a1253e0be28a612d30eb54219d9
diff --git a/src/com/android/providers/telephony/HbpcdLookupDatabaseHelper.java b/src/com/android/providers/telephony/HbpcdLookupDatabaseHelper.java
index ceaed4c..2debc57 100644
--- a/src/com/android/providers/telephony/HbpcdLookupDatabaseHelper.java
+++ b/src/com/android/providers/telephony/HbpcdLookupDatabaseHelper.java
@@ -86,6 +86,7 @@
 
     private static final String DATABASE_NAME = "HbpcdLookup.db";
     private static final int DATABASE_VERSION = 1;
+    private static final int IDLE_CONNECTION_TIMEOUT_MS = 30000;
 
     // Context to access resources with
     private Context mContext;
@@ -99,6 +100,8 @@
         super(context, DATABASE_NAME, null, DATABASE_VERSION);
 
         mContext = context;
+        // Memory optimization - close idle connections after 30s of inactivity
+        setIdleConnectionTimeout(IDLE_CONNECTION_TIMEOUT_MS);
     }
 
     @Override
diff --git a/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java b/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
index 095313f..4b84fe5 100644
--- a/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
+++ b/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
@@ -241,14 +241,17 @@
 
     static final String DATABASE_NAME = "mmssms.db";
     static final int DATABASE_VERSION = 66;
+    private static final int IDLE_CONNECTION_TIMEOUT_MS = 30000;
+
     private final Context mContext;
     private LowStorageMonitor mLowStorageMonitor;
 
 
     private MmsSmsDatabaseHelper(Context context) {
         super(context, DATABASE_NAME, null, DATABASE_VERSION);
-
         mContext = context;
+        // Memory optimization - close idle connections after 30s of inactivity
+        setIdleConnectionTimeout(IDLE_CONNECTION_TIMEOUT_MS);
     }
 
     /**
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
index 32e0b55..a74ceb0 100644
--- a/src/com/android/providers/telephony/TelephonyProvider.java
+++ b/src/com/android/providers/telephony/TelephonyProvider.java
@@ -115,6 +115,7 @@
 public class TelephonyProvider extends ContentProvider
 {
     private static final String DATABASE_NAME = "telephony.db";
+    private static final int IDLE_CONNECTION_TIMEOUT_MS = 30000;
     private static final boolean DBG = true;
     private static final boolean VDBG = false; // STOPSHIP if true
 
@@ -337,6 +338,8 @@
         public DatabaseHelper(Context context) {
             super(context, DATABASE_NAME, null, getVersion(context));
             mContext = context;
+            // Memory optimization - close idle connections after 30s of inactivity
+            setIdleConnectionTimeout(IDLE_CONNECTION_TIMEOUT_MS);
         }
 
         private static int getVersion(Context context) {