Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66b60af9 authored by Yorke Lee's avatar Yorke Lee
Browse files

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
parent 7d661343
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −2
Original line number Diff line number Diff line
@@ -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) {
+10 −2
Original line number Diff line number Diff line
@@ -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);
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -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;
        }
    }