summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Martinz <amartinz@shiftphones.com>2018-04-13 16:41:10 (GMT)
committerJoey <joey@lineageos.org>2018-04-29 12:24:49 (GMT)
commit37894424d1c3e96505759f2618696bbfd5609470 (patch)
treefbc9c6d66a68a2c800d924b7494bfad6676a66de
parentf48c6b02170acacb1cf26e6bbb4d103ae5184507 (diff)
downloadandroid_packages_apps_Trebuchet-37894424d1c3e96505759f2618696bbfd5609470.zip
android_packages_apps_Trebuchet-37894424d1c3e96505759f2618696bbfd5609470.tar.gz
android_packages_apps_Trebuchet-37894424d1c3e96505759f2618696bbfd5609470.tar.bz2
LauncherProvider: fix crash when disk is full
Stacktrace: android.database.sqlite.SQLiteFullException: database or disk is full (code 13) at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(SQLiteConnection.java) at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:750) at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:754) at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:64) at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1604) at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1550) at com.android.launcher3.LauncherProvider.update(LauncherProvider.java:360) at android.content.ContentProvider$Transport.update(ContentProvider.java:359) at android.content.ContentResolver.update(ContentResolver.java:1672) at com.android.launcher3.model.ModelWriter$UpdateItemRunnable.run(ModelWriter.java:290) at com.android.launcher3.util.LooperExecutor.execute(LooperExecutor.java:39) at com.android.launcher3.model.ModelWriter.updateItemInDatabase(ModelWriter.java:197) at com.android.launcher3.model.PackageUpdatedTask.execute(PackageUpdatedTask.java:258) at com.android.launcher3.model.BaseModelUpdateTask.run(BaseModelUpdateTask.java:67) at android.os.Handler.handleCallback(Handler.java:869) at android.os.Handler.dispatchMessage(Handler.java:101) at android.os.Looper.loop(Looper.java:206) at android.os.HandlerThread.run(HandlerThread.java:65) Issue: SHIFTOS-SW-18 Change-Id: I4c4fa9239b9ff14a6614187c450d12b6006fde82 Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
-rw-r--r--src/com/android/launcher3/LauncherProvider.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index b31df98..ea1c1d1 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -34,6 +34,7 @@ import android.content.res.Resources;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteFullException;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.database.sqlite.SQLiteStatement;
@@ -194,7 +195,18 @@ public class LauncherProvider extends ContentProvider {
throw new RuntimeException("Error: attempting to add item without specifying an id");
}
helper.checkId(table, values);
- return db.insert(table, nullColumnHack, values);
+
+ long inserted;
+ try {
+ inserted = db.insert(table, nullColumnHack, values);
+ } catch (SQLiteFullException e) {
+ Log.e(TAG, "Could not insert database entry", e);
+ inserted = 0L;
+ }
+ if (Utilities.IS_DEBUG_DEVICE && inserted < 0) {
+ Log.d(TAG, "Could not insert database entry", new RuntimeException());
+ }
+ return inserted;
}
private void reloadLauncherIfExternal() {
@@ -357,7 +369,13 @@ public class LauncherProvider extends ContentProvider {
addModifiedTime(values);
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- int count = db.update(args.table, values, args.where, args.args);
+ int count;
+ try {
+ count = db.update(args.table, values, args.where, args.args);
+ } catch (SQLiteFullException e) {
+ Log.e(TAG, "Could not update database", e);
+ count = 0;
+ }
if (count > 0) notifyListeners();
reloadLauncherIfExternal();