summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2015-03-10 10:08:23 -0700
committerRaj Yengisetty <rajesh@cyngn.com>2015-03-12 10:22:58 -0700
commit0d2ed5aa12839d3fc15ac9c769b28f564da53df7 (patch)
tree327929fc325f0d09db0d9699d4fecbf6176e8ade
parenta680fc779a454729efd0a2fc8982f52117a79994 (diff)
downloadandroid_packages_apps_ContactsCommon-0d2ed5aa12839d3fc15ac9c769b28f564da53df7.tar.gz
android_packages_apps_ContactsCommon-0d2ed5aa12839d3fc15ac9c769b28f564da53df7.tar.bz2
android_packages_apps_ContactsCommon-0d2ed5aa12839d3fc15ac9c769b28f564da53df7.zip
ContactsCommon: fix FC when deleting SIM contacts after SIM is removed
Repro: - Create local contact - Export to SIM - Remove SIM - Go to delete menu option - Select all (*include* exported SIM contact) - Click check mark - Observe Contacts app force closes when deleting the exported contact Change-Id: I2bfecf8b19c8f1eae9559a4e6f46ff477da4dc74
-rw-r--r--src/com/android/contacts/common/SimContactsOperation.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/contacts/common/SimContactsOperation.java b/src/com/android/contacts/common/SimContactsOperation.java
index 55c7b79f..fe1d85c1 100644
--- a/src/com/android/contacts/common/SimContactsOperation.java
+++ b/src/com/android/contacts/common/SimContactsOperation.java
@@ -92,6 +92,9 @@ public class SimContactsOperation {
public Uri insert(ContentValues values, int subscription) {
Uri uri = getContentUri(subscription);
+ if (uri == null) {
+ return null;
+ }
String number = values.getAsString(SimContactsConstants.STR_NUMBER);
String anrs = values.getAsString(SimContactsConstants.STR_ANRS);
String emails = values.getAsString(SimContactsConstants.STR_EMAILS);
@@ -106,7 +109,9 @@ public class SimContactsOperation {
public int update(ContentValues values,int subscription) {
Uri uri = getContentUri(subscription);
-
+ if (uri == null) {
+ return -1;
+ }
int result;
String oldNumber = values.getAsString(SimContactsConstants.STR_NUMBER);
String newNumber = values.getAsString(SimContactsConstants.STR_NEW_NUMBER);
@@ -136,6 +141,10 @@ public class SimContactsOperation {
anrs = PhoneNumberUtils.stripSeparators(anrs);
Uri uri = getContentUri(subscription);
+ if (uri == null) {
+ return -1;
+ }
+
if (!TextUtils.isEmpty(name)) {
buf.append("tag='");
@@ -168,6 +177,9 @@ public class SimContactsOperation {
long[] subId = SubscriptionManager.getSubId(subscription);
if (subId != null && TelephonyManager.getDefault().isMultiSimEnabled()) {
+ if (subId.length < 1 || subId[0] < 0) {
+ return null;
+ }
uri = Uri.parse(SimContactsConstants.SIM_SUB_URI + subId[0]);
} else {
uri = Uri.parse(SimContactsConstants.SIM_URI);