summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2015-06-23 19:14:35 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-06-23 19:14:35 +0000
commitea37fdecc39ae59e78bfa423fb79e3b2b1ec7e33 (patch)
treebfb32d5d9a49bfb6e0d78a64700df536aa1f569c
parent0371d431e0954ba818f29c63b03bdc4927a09e7c (diff)
parent41f8def240346c6e65af7f31fce2628d802dd880 (diff)
downloadpackages_providers_ContactsProvider-ea37fdecc39ae59e78bfa423fb79e3b2b1ec7e33.zip
packages_providers_ContactsProvider-ea37fdecc39ae59e78bfa423fb79e3b2b1ec7e33.tar.gz
packages_providers_ContactsProvider-ea37fdecc39ae59e78bfa423fb79e3b2b1ec7e33.tar.bz2
am 41f8def2: Merge "Fix read voicemails being marked as "new"." into mnc-dev
* commit '41f8def240346c6e65af7f31fce2628d802dd880': Fix read voicemails being marked as "new".
-rw-r--r--src/com/android/providers/contacts/VoicemailContentTable.java2
-rw-r--r--tests/src/com/android/providers/contacts/VoicemailProviderTest.java28
2 files changed, 29 insertions, 1 deletions
diff --git a/src/com/android/providers/contacts/VoicemailContentTable.java b/src/com/android/providers/contacts/VoicemailContentTable.java
index 87a2349..5cf1f35 100644
--- a/src/com/android/providers/contacts/VoicemailContentTable.java
+++ b/src/com/android/providers/contacts/VoicemailContentTable.java
@@ -142,7 +142,7 @@ public class VoicemailContentTable implements VoicemailTable.Delegate {
copiedValues.put(Calls.TYPE, Calls.VOICEMAIL_TYPE);
// A voicemail is marked as new unless it is marked as read or explicitly overridden.
boolean isRead = values.containsKey(Calls.IS_READ) ?
- values.get(Calls.IS_READ).equals(1) : false;
+ values.getAsBoolean(Calls.IS_READ) : false;
if (!values.containsKey(Calls.NEW)) {
copiedValues.put(Calls.NEW, !isRead);
}
diff --git a/tests/src/com/android/providers/contacts/VoicemailProviderTest.java b/tests/src/com/android/providers/contacts/VoicemailProviderTest.java
index dc4335c..aa35b7a 100644
--- a/tests/src/com/android/providers/contacts/VoicemailProviderTest.java
+++ b/tests/src/com/android/providers/contacts/VoicemailProviderTest.java
@@ -88,6 +88,28 @@ public class VoicemailProviderTest extends BaseVoicemailProviderTest {
assertEquals(1, countFilesInTestDirectory());
}
+ public void testInsertReadMessageIsNotNew() throws Exception {
+ ContentValues values = getTestReadVoicemailValues();
+ Uri uri = mResolver.insert(voicemailUri(), values);
+ String[] projection = {Voicemails.NUMBER, Voicemails.DATE, Voicemails.DURATION,
+ Voicemails.TRANSCRIPTION, Voicemails.IS_READ, Voicemails.HAS_CONTENT,
+ Voicemails.SOURCE_DATA, Voicemails.STATE,
+ };
+ Cursor c = mResolver.query(uri, projection, Calls.NEW + "=0", null,
+ null);
+ try {
+ assertEquals("Record count", 1, c.getCount());
+ c.moveToFirst();
+ assertEquals(1, countFilesInTestDirectory());
+ assertCursorValues(c, values);
+ } catch (Error e) {
+ TestUtils.dumpCursor(c);
+ throw e;
+ } finally {
+ c.close();
+ }
+ }
+
// Test to ensure that media content can be written and read back.
public void testFileContent() throws Exception {
Uri uri = insertVoicemail();
@@ -673,6 +695,12 @@ public class VoicemailProviderTest extends BaseVoicemailProviderTest {
return values;
}
+ private ContentValues getTestReadVoicemailValues() {
+ ContentValues values = getTestVoicemailValues();
+ values.put(Voicemails.IS_READ, 1);
+ return values;
+ }
+
private Uri insertTestStatusEntry() {
return mResolver.insert(statusUri(), getTestStatusValues());
}