Skip to content

Commit

Permalink
Log unknown call ids
Browse files Browse the repository at this point in the history
Refs #532
  • Loading branch information
jberkel committed Mar 6, 2015
1 parent 4a8f487 commit 8eb6348
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public MessageGenerator(Context context,
final String address = msgMap.get(CallLog.Calls.NUMBER);
final int callType = toInt(msgMap.get(CallLog.Calls.TYPE));

if (TextUtils.isEmpty(address) || !mCallLogTypes.isTypeEnabled(callType)) {
if (!mCallLogTypes.isTypeEnabled(callType)) {
if (LOCAL_LOGV) Log.v(TAG, "ignoring call log entry: " + msgMap);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ public class MessageGeneratorTest {
assertThat(msg.getRecipients(Message.RecipientType.TO)[0]).isEqualTo(me);
}

@Test public void testShouldGenerateMessageForCallLogIncomingUnknown() throws Exception {
PersonRecord record = new PersonRecord(0, null, null, "-1");
Message msg = generator.messageForDataType(mockCalllogMessage("", CallLog.Calls.INCOMING_TYPE, record), DataType.CALLLOG);
assertThat(msg).isNotNull();
assertThat(msg.getSubject()).isEqualTo("Call with Unknown");
assertThat(msg.getFrom()[0].toString()).isEqualTo("Unknown <unknown.number@unknown.email>");
assertThat(msg.getRecipients(Message.RecipientType.TO)[0]).isEqualTo(me);
}

@Test public void testShouldGenerateCallLogMessageWithCorrectEncoding() throws Exception {
PersonRecord record = new PersonRecord(-1, "Test Testor", null, null);
Message msg = generator.messageForDataType(mockCalllogMessage("1234", CallLog.Calls.OUTGOING_TYPE, record), DataType.CALLLOG);
Expand Down

0 comments on commit 8eb6348

Please sign in to comment.