diff options
author | Brad Ebinger <breadley@google.com> | 2016-08-12 15:41:49 -0700 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2016-08-16 13:44:34 -0700 |
commit | 0ba8619e7c1b380a6cf34fecafa4278f9f0b6a8f (patch) | |
tree | 14c991c729c901ac3c32983ecad5343dbf0c39ad /rcs | |
parent | 6ee48f5ce9454941bfb9ec30c1502a4738ed32e9 (diff) | |
download | ims-0ba8619e7c1b380a6cf34fecafa4278f9f0b6a8f.tar.gz |
RCS NPE when uppgrading to Nnougat-mr1-dev
1) Fixes a crash upon upgrade to N where a null cursor was received when
the data was damaged.
2) Adds permission to AndroidManifest for consistency.
Bug: 30838787
Change-Id: I91196f3753e381d643b242f65469904e5cb4d603
Diffstat (limited to 'rcs')
-rw-r--r-- | rcs/presencepolling/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | rcs/presencepolling/src/com/android/service/ims/presence/EABDbUtil.java | 15 |
2 files changed, 14 insertions, 4 deletions
diff --git a/rcs/presencepolling/AndroidManifest.xml b/rcs/presencepolling/AndroidManifest.xml index 8780c11..8d69796 100644 --- a/rcs/presencepolling/AndroidManifest.xml +++ b/rcs/presencepolling/AndroidManifest.xml @@ -35,6 +35,9 @@ <uses-sdk android:minSdkVersion="19"/> + <permission android:name="com.android.rcs.eab.permission.READ_WRITE_EAB" + android:protectionLevel="signatureOrSystem" /> + <protected-broadcast android:name="android.provider.rcs.eab.EAB_NEW_CONTACT_INSERTED" /> <protected-broadcast android:name="com.android.service.ims.presence.capability_polling_retry" /> <protected-broadcast android:name="com.android.service.ims.presence.periodical_capability_discovery" /> diff --git a/rcs/presencepolling/src/com/android/service/ims/presence/EABDbUtil.java b/rcs/presencepolling/src/com/android/service/ims/presence/EABDbUtil.java index 44ab61e..64d7343 100644 --- a/rcs/presencepolling/src/com/android/service/ims/presence/EABDbUtil.java +++ b/rcs/presencepolling/src/com/android/service/ims/presence/EABDbUtil.java @@ -72,8 +72,13 @@ public class EABDbUtil { null, sortOrder); ArrayList<PresenceContact> allEligibleContacts = new ArrayList<PresenceContact>(); - logger.debug("cursor count : " + cursor.getCount()); - if (cursor.moveToFirst()) { + if (cursor != null) { + logger.debug("cursor count : " + cursor.getCount()); + } else { + logger.debug("cursor = null"); + } + + if (cursor != null && cursor.moveToFirst()) { do { String id = cursor.getString(cursor.getColumnIndex(Contacts._ID)); Long time = cursor.getLong(cursor.getColumnIndex( @@ -94,7 +99,7 @@ public class EABDbUtil { + " = ?", new String[] { id }, null); ArrayList<String> phoneNumList = new ArrayList<String>(); - if (pCur.moveToFirst()) { + if (pCur != null && pCur.moveToFirst()) { do { String contactNumber = pCur.getString(pCur.getColumnIndex( ContactsContract.CommonDataKinds.Phone.NUMBER)); @@ -121,7 +126,9 @@ public class EABDbUtil { } } while (pCur.moveToNext()); } - pCur.close(); + if (pCur != null) { + pCur.close(); + } } while (cursor.moveToNext()); } if (null != cursor) { |