diff options
author | Andrew Lee <anwlee@google.com> | 2015-10-19 23:57:25 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-10-20 14:18:18 -0700 |
commit | b980fc4386cdc24a605fc682d0fef0c5dc54c327 (patch) | |
tree | 63d6f383e5d7da937c8abc7a001c447db64d0cdf /src/com/android/dialer/filterednumber/FilteredNumbersUtil.java | |
parent | d0a5d1421e52caad8073c3e08fbb645c069344df (diff) |
Add setting for hiding blocked calls.
+ Add settings switch to blocked number settings.
+ Add utility for checking/setting whether calls should be blocked.
+ Filter out blocked calls in call log query, if appropriate.
+ Refresh call log fragment after a change in setting.
Followup work: delete voicemails for calls by blocked numbers after
the time when the user blocked them.
Bug: 24134270
Change-Id: I85088697559ef6fb446b82617f14f1c6fa893df1
Diffstat (limited to 'src/com/android/dialer/filterednumber/FilteredNumbersUtil.java')
-rw-r--r-- | src/com/android/dialer/filterednumber/FilteredNumbersUtil.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java index 68f262cf9..0e162acfa 100644 --- a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java +++ b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java @@ -19,6 +19,7 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.os.AsyncTask; +import android.preference.PreferenceManager; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; @@ -42,6 +43,8 @@ import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; */ public class FilteredNumbersUtil { + private static final String HIDE_BLOCKED_CALLS_PREF_KEY = "hide_blocked_calls"; + public interface CheckForSendToVoicemailContactListener { public void onComplete(boolean hasSendToVoicemailContact); } @@ -213,6 +216,24 @@ public class FilteredNumbersUtil { return isBlocked; } + public static boolean shouldHideBlockedCalls(Context context) { + if (context == null) { + return false; + } + return PreferenceManager.getDefaultSharedPreferences(context) + .getBoolean(FilteredNumbersUtil.HIDE_BLOCKED_CALLS_PREF_KEY, false); + } + + public static void setShouldHideBlockedCalls(Context context, boolean shouldHide) { + if (context == null) { + return; + } + PreferenceManager.getDefaultSharedPreferences(context) + .edit() + .putBoolean(FilteredNumbersUtil.HIDE_BLOCKED_CALLS_PREF_KEY, shouldHide) + .apply(); + } + public static boolean canBlockNumber(Context context, String number) { if (PhoneNumberUtils.isEmergencyNumber(number)) { return false; |