summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-02-29 14:05:59 -0800
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:17:18 -0700
commit73c6eb4fcf1ea4acbec7ae94670c3d0a65166ca2 (patch)
tree06c13c8c91f3fff79ce7df52bdf8498eb416f3e3
parentca7e9a72fd1a180b63e2cf0f1d05784e7af2c6fb (diff)
downloadandroid_packages_apps_Trebuchet-73c6eb4fcf1ea4acbec7ae94670c3d0a65166ca2.zip
android_packages_apps_Trebuchet-73c6eb4fcf1ea4acbec7ae94670c3d0a65166ca2.tar.gz
android_packages_apps_Trebuchet-73c6eb4fcf1ea4acbec7ae94670c3d0a65166ca2.tar.bz2
Trebuchet: Handle random crash during theme change / user switch
Sometimes the IconCacheDB fails to open in writable mode during a theme change or user switch. Don't bother updating the icon cache when this happens. It will update later just fine. Issue-id: CYNGNOS-2083 Change-Id: I022ef436ff07880c188642456afad847ad9f41d3
-rw-r--r--src/com/android/launcher3/IconCache.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index 1200b97..ca5545d 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -29,6 +29,7 @@ import android.content.res.Resources;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
+import android.database.sqlite.SQLiteReadOnlyDatabaseException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -390,8 +391,12 @@ public class IconCache {
values.put(IconDB.COLUMN_USER, userSerial);
values.put(IconDB.COLUMN_LAST_UPDATED, info.lastUpdateTime);
values.put(IconDB.COLUMN_VERSION, info.versionCode);
- mIconDb.getWritableDatabase().insertWithOnConflict(IconDB.TABLE_NAME, null, values,
- SQLiteDatabase.CONFLICT_REPLACE);
+ try {
+ mIconDb.getWritableDatabase().insertWithOnConflict(IconDB.TABLE_NAME, null, values,
+ SQLiteDatabase.CONFLICT_REPLACE);
+ } catch (SQLiteReadOnlyDatabaseException e) {
+ Log.e(TAG, "Can't add icon to read only db", e);
+ }
}
@Thunk ContentValues updateCacheAndGetContentValues(LauncherActivityInfoCompat app,