diff options
author | Adam Cohen <adamcohen@google.com> | 2014-12-04 10:34:57 -0800 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2015-09-27 21:11:12 -0700 |
commit | 4acad0596ea7784c34cf8ea6ffdf7a691f3ba315 (patch) | |
tree | ee29e3361749235341fe6c521f162fb6a46115cf | |
parent | b6564f6d50db3cda1ac017c3c73a66b92bd6039e (diff) | |
download | packages_apps_Trebuchet-4acad0596ea7784c34cf8ea6ffdf7a691f3ba315.tar.gz packages_apps_Trebuchet-4acad0596ea7784c34cf8ea6ffdf7a691f3ba315.tar.bz2 packages_apps_Trebuchet-4acad0596ea7784c34cf8ea6ffdf7a691f3ba315.zip |
Avoid db exception on L and above
Bug 18554839
Change-Id: I43f391b7cc376f697ce7b5b363e8be3aa85814b5
-rw-r--r-- | src/com/android/launcher3/WidgetPreviewLoader.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java index e4d06bfc3..85c86ef35 100644 --- a/src/com/android/launcher3/WidgetPreviewLoader.java +++ b/src/com/android/launcher3/WidgetPreviewLoader.java @@ -166,21 +166,19 @@ public class WidgetPreviewLoader { LauncherAppState.getSharedPreferencesKey(), Context.MODE_PRIVATE); final String lastVersionName = sp.getString(ANDROID_INCREMENTAL_VERSION_NAME_KEY, null); final String versionName = android.os.Build.VERSION.INCREMENTAL; - final boolean isLollipop = Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP; + final boolean isLollipopOrGreater = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; if (!versionName.equals(lastVersionName)) { try { // clear all the previews whenever the system version changes, to ensure that // previews are up-to-date for any apps that might have been updated with the system clearDb(); } catch (SQLiteReadOnlyDatabaseException e) { - if (isLollipop) { + if (isLollipopOrGreater) { // Workaround for Bug. 18554839, if we fail to clear the db due to the read-only // issue, then ignore this error and leave the old previews } else { throw e; } - } catch (Exception e) { - throw e; } finally { SharedPreferences.Editor editor = sp.edit(); editor.putString(ANDROID_INCREMENTAL_VERSION_NAME_KEY, versionName); |