Silence SQLiteExceptions thrown by providers
Added catch to silence sqlexceptions from crashing
the app and logging silent feedback. Based on crash reports
this seemed to happen because some OEMs removed contact_presence
column in cp2.
Test: Manually threw SQLiteException to test behavior
and verified app is stable.
Bug: 32943841
Change-Id: I1b52b608f5dcb9275b33945281392dae9c83a20b
diff --git a/src/com/android/contacts/common/list/FavoritesAndContactsLoader.java b/src/com/android/contacts/common/list/FavoritesAndContactsLoader.java
index 422cf7c..25dd711 100644
--- a/src/com/android/contacts/common/list/FavoritesAndContactsLoader.java
+++ b/src/com/android/contacts/common/list/FavoritesAndContactsLoader.java
@@ -19,6 +19,7 @@
import android.content.CursorLoader;
import android.database.Cursor;
import android.database.MergeCursor;
+import android.database.sqlite.SQLiteException;
import android.os.Bundle;
import android.provider.ContactsContract.Contacts;
@@ -73,8 +74,9 @@
// correctly handles null cursors.
try {
return super.loadInBackground();
- } catch (NullPointerException | SecurityException e) {
- // Ignore NPEs and SecurityExceptions thrown by providers
+
+ } catch (NullPointerException | SQLiteException | SecurityException e) {
+ // Ignore NPEs, SQLiteExceptions and SecurityExceptions thrown by providers
}
return null;
}