From 3a6d4d6cbf720689ed725cd351649e23072a7eee Mon Sep 17 00:00:00 2001 From: maxwelb Date: Thu, 8 Mar 2018 17:02:34 -0800 Subject: Add flag for filtering emergency calls from call log Bug: 73368638 Test: CallLogAdapterTest PiperOrigin-RevId: 188414469 Change-Id: I7d7522c841a6b4054e2e387346973c597174ee87 --- java/com/android/dialer/app/calllog/CallLogAdapter.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'java') diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index 4b860fea1..7f8c889de 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -119,6 +119,8 @@ public class CallLogAdapter extends GroupingListAdapter public static final String ENABLE_CALL_LOG_MULTI_SELECT = "enable_call_log_multiselect"; public static final boolean ENABLE_CALL_LOG_MULTI_SELECT_FLAG = true; + @VisibleForTesting static final String FILTER_EMERGENCY_CALLS_FLAG = "filter_emergency_calls"; + protected final Activity activity; protected final VoicemailPlaybackPresenter voicemailPlaybackPresenter; /** Cache for repeated requests to Telecom/Telephony. */ @@ -840,7 +842,7 @@ public class CallLogAdapter extends GroupingListAdapter } private boolean isHiddenRow(@Nullable String number, long rowId) { - if (number != null && PhoneNumberUtils.isEmergencyNumber(number)) { + if (isHideableEmergencyNumberRow(number)) { return true; } if (hiddenRowIds.contains(rowId)) { @@ -849,6 +851,13 @@ public class CallLogAdapter extends GroupingListAdapter return false; } + private boolean isHideableEmergencyNumberRow(@Nullable String number) { + if (!ConfigProviderBindings.get(activity).getBoolean(FILTER_EMERGENCY_CALLS_FLAG, false)) { + return false; + } + return number != null && PhoneNumberUtils.isEmergencyNumber(number); + } + private void loadAndRender( final CallLogListItemViewHolder viewHolder, final long rowId, -- cgit v1.2.3