summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-02-29 14:05:59 -0800
committercretin45 <cretin45@gmail.com>2016-02-29 14:10:48 -0800
commit1cd45870bae7ed5ededf12fdf3e5233527dcaee2 (patch)
treec821b5865fd9d78ac21292550b5608cb123b0e04 /src
parentc5454ec15b2849bc25cbe5812a7334af0d4c6397 (diff)
downloadandroid_packages_apps_Trebuchet-1cd45870bae7ed5ededf12fdf3e5233527dcaee2.zip
android_packages_apps_Trebuchet-1cd45870bae7ed5ededf12fdf3e5233527dcaee2.tar.gz
android_packages_apps_Trebuchet-1cd45870bae7ed5ededf12fdf3e5233527dcaee2.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
Diffstat (limited to 'src')
-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,