diff options
author | Raj Yengisetty <rajesh@cyngn.com> | 2015-03-10 10:08:23 -0700 |
---|---|---|
committer | Rajesh Yengisetty <rajesh@cyngn.com> | 2015-03-12 18:01:14 +0000 |
commit | e4a8e3e041b0657d6e98f8b6c293cc0296700f15 (patch) | |
tree | ef0dcdcd00aa132822c91a77b7b3fb91e6223f46 | |
parent | cbc27f11f19fcbe5b59bbce2daf9179530dea0d5 (diff) | |
download | android_packages_apps_ContactsCommon-e4a8e3e041b0657d6e98f8b6c293cc0296700f15.tar.gz android_packages_apps_ContactsCommon-e4a8e3e041b0657d6e98f8b6c293cc0296700f15.tar.bz2 android_packages_apps_ContactsCommon-e4a8e3e041b0657d6e98f8b6c293cc0296700f15.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
(cherry picked from commit 0d2ed5aa12839d3fc15ac9c769b28f564da53df7)
-rw-r--r-- | src/com/android/contacts/common/SimContactsOperation.java | 14 |
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); |