diff options
author | Sravan Kumar V <sravankumar@codeaurora.org> | 2015-08-31 10:12:04 +0530 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-07-01 05:03:08 -0700 |
commit | d7d6c6db1f432d7c465d631a5155c80eb45594a2 (patch) | |
tree | ada35184d477108dcb1758c6a14ab4e42ab35901 /src/com/android/settings | |
parent | e40a0c583c91fc2175a1813d5ed42ee2a3ce93ef (diff) | |
download | packages_apps_Settings-d7d6c6db1f432d7c465d631a5155c80eb45594a2.zip packages_apps_Settings-d7d6c6db1f432d7c465d631a5155c80eb45594a2.tar.gz packages_apps_Settings-d7d6c6db1f432d7c465d631a5155c80eb45594a2.tar.bz2 |
Bluetooth : Handle SQL memory situation during OPP.
Use case :
1) Use Any tool to Fill memory
2) When available memory is very low, enter
settings-Bluetooth
Failure :
"Unfortunately, Bluetooth share has stopped" error comes.
Root Cause :
Because of Memory Issue application was unable to perform any SQL
operations.
Fix :
Catch SQLite FullException and SQlite Exception in bluetooth
settings to avoid crash in this use case.
Change-Id: I621816ef6214eead49ba9f5a98a4152572fb1379
Diffstat (limited to 'src/com/android/settings')
-rw-r--r-- | src/com/android/settings/search/Index.java | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java index c58923f..055c2d8 100644 --- a/src/com/android/settings/search/Index.java +++ b/src/com/android/settings/search/Index.java @@ -31,6 +31,7 @@ import android.database.DatabaseUtils; import android.database.MergeCursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; +import android.database.sqlite.SQLiteFullException; import android.net.Uri; import android.os.AsyncTask; import android.provider.SearchIndexableData; @@ -1189,14 +1190,15 @@ public class Index { final boolean forceUpdate = params[0].forceUpdate; - final SQLiteDatabase database = getWritableDatabase(); - if (database == null) { - Log.e(LOG_TAG, "Cannot update Index as I cannot get a writable database"); - return null; - } - final String localeStr = Locale.getDefault().toString(); + SQLiteDatabase database = null; try { + database = getWritableDatabase(); + if (database == null) { + Log.e(LOG_TAG, "Cannot update Index as I cannot get a writable database"); + return null; + } + final String localeStr = Locale.getDefault().toString(); database.beginTransaction(); if (dataToDelete.size() > 0) { processDataToDelete(database, localeStr, dataToDelete); @@ -1206,8 +1208,19 @@ public class Index { forceUpdate); } database.setTransactionSuccessful(); + } catch (SQLiteFullException e) { + Log.e(LOG_TAG, "SQLite database is full." + e.toString()); + } catch (SQLiteException e) { + Log.e(LOG_TAG, e.toString()); } finally { - database.endTransaction(); + try { + if (database != null) + database.endTransaction(); + } catch (SQLiteFullException e) { + Log.e(LOG_TAG, "SQLite database is full." + e.toString()); + } catch (SQLiteException e) { + Log.e(LOG_TAG, e.toString()); + } } return null; |