summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-11-08 12:06:24 -0800
committerYorke Lee <yorkelee@google.com>2013-11-08 14:09:33 -0800
commit66b60af960e3bf2e3b425966026e4b8ed8d01a03 (patch)
tree1bbe44d89e4938b67ea9102c66b6b67416b5ac7e /src/com/android
parent7d661343d1ee126e2f34c7204315bbc61a2d9f36 (diff)
downloadpackages_apps_Dialer-66b60af960e3bf2e3b425966026e4b8ed8d01a03.tar.gz
packages_apps_Dialer-66b60af960e3bf2e3b425966026e4b8ed8d01a03.tar.bz2
packages_apps_Dialer-66b60af960e3bf2e3b425966026e4b8ed8d01a03.zip
Treat unknown call types as missed calls
Don't crash on unknown call types. Instead, just treat them as missed calls. Bug: 11586034 Change-Id: I4ca1721e1526ade36237251e7636d161ca8490be
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/dialer/calllog/CallDetailHistoryAdapter.java2
-rw-r--r--src/com/android/dialer/calllog/CallLogGroupBuilder.java3
-rw-r--r--src/com/android/dialer/calllog/CallTypeHelper.java12
-rw-r--r--src/com/android/dialer/calllog/CallTypeIconsView.java6
4 files changed, 17 insertions, 6 deletions
diff --git a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
index 52435aafe..8af3b82bb 100644
--- a/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
+++ b/src/com/android/dialer/calllog/CallDetailHistoryAdapter.java
@@ -150,7 +150,7 @@ public class CallDetailHistoryAdapter extends BaseAdapter {
DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR);
dateView.setText(dateValue);
// Set the duration
- if (callType == Calls.MISSED_TYPE || callType == Calls.VOICEMAIL_TYPE) {
+ if (Calls.VOICEMAIL_TYPE == callType || CallTypeHelper.isMissedCallType(callType)) {
durationView.setVisibility(View.GONE);
} else {
durationView.setVisibility(View.VISIBLE);
diff --git a/src/com/android/dialer/calllog/CallLogGroupBuilder.java b/src/com/android/dialer/calllog/CallLogGroupBuilder.java
index 1e4684e8f..213f1e774 100644
--- a/src/com/android/dialer/calllog/CallLogGroupBuilder.java
+++ b/src/com/android/dialer/calllog/CallLogGroupBuilder.java
@@ -78,8 +78,7 @@ public class CallLogGroupBuilder {
shouldGroup = false;
} else {
// Incoming, outgoing, and missed calls group together.
- shouldGroup = (callType == Calls.INCOMING_TYPE || callType == Calls.OUTGOING_TYPE ||
- callType == Calls.MISSED_TYPE);
+ shouldGroup = callType != Calls.VOICEMAIL_TYPE;
}
if (shouldGroup) {
diff --git a/src/com/android/dialer/calllog/CallTypeHelper.java b/src/com/android/dialer/calllog/CallTypeHelper.java
index 0f9b737f7..1c4f44f23 100644
--- a/src/com/android/dialer/calllog/CallTypeHelper.java
+++ b/src/com/android/dialer/calllog/CallTypeHelper.java
@@ -64,7 +64,7 @@ public class CallTypeHelper {
return mVoicemailName;
default:
- throw new IllegalArgumentException("invalid call type: " + callType);
+ return mMissedName;
}
}
@@ -86,7 +86,15 @@ public class CallTypeHelper {
return mNewVoicemailColor;
default:
- throw new IllegalArgumentException("invalid call type: " + callType);
+ // Don't highlight calls of unknown types. They are treated as missed calls by
+ // the rest of the UI, but since they will never be marked as read by
+ // {@link CallLogQueryHandler}, just don't ever highlight them anyway.
+ return null;
}
}
+
+ public static boolean isMissedCallType(int callType) {
+ return (callType != Calls.INCOMING_TYPE && callType != Calls.OUTGOING_TYPE &&
+ callType != Calls.VOICEMAIL_TYPE);
+ }
}
diff --git a/src/com/android/dialer/calllog/CallTypeIconsView.java b/src/com/android/dialer/calllog/CallTypeIconsView.java
index e83512861..a65f2c279 100644
--- a/src/com/android/dialer/calllog/CallTypeIconsView.java
+++ b/src/com/android/dialer/calllog/CallTypeIconsView.java
@@ -86,7 +86,11 @@ public class CallTypeIconsView extends View {
case Calls.VOICEMAIL_TYPE:
return mResources.voicemail;
default:
- throw new IllegalArgumentException("invalid call type: " + callType);
+ // It is possible for users to end up with calls with unknown call types in their
+ // call history, possibly due to 3rd party call log implementations (e.g. to
+ // distinguish between rejected and missed calls). Instead of crashing, just
+ // assume that all unknown call types are missed calls.
+ return mResources.missed;
}
}