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/calllog/CallLogQueryHandler.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/calllog/CallLogQueryHandler.java')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogQueryHandler.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/CallLogQueryHandler.java b/src/com/android/dialer/calllog/CallLogQueryHandler.java index 81e49d2d4..01489c1dc 100644 --- a/src/com/android/dialer/calllog/CallLogQueryHandler.java +++ b/src/com/android/dialer/calllog/CallLogQueryHandler.java @@ -36,6 +36,7 @@ import android.util.Log; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; import com.android.contacts.common.util.PermissionsUtil; +import com.android.dialer.filterednumber.FilteredNumbersUtil; import com.android.dialer.util.AppCompatConstants; import com.android.dialer.util.TelecomUtil; import com.android.dialer.voicemail.VoicemailStatusHelperImpl; @@ -177,7 +178,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler { if (callType > CALL_TYPE_ALL) { where.append(" AND "); - where.append(String.format("(%s = ?)", Calls.TYPE)); + where.append("(" + Calls.TYPE + " = ?)"); selectionArgs.add(Integer.toString(callType)); } else { where.append(" AND NOT "); @@ -186,10 +187,18 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler { if (newerThan > 0) { where.append(" AND "); - where.append(String.format("(%s > ?)", Calls.DATE)); + where.append("(" + Calls.DATE + " > ?)"); selectionArgs.add(Long.toString(newerThan)); } + final boolean shouldHideBlockedCalls = + FilteredNumbersUtil.shouldHideBlockedCalls(mContext); + if (shouldHideBlockedCalls) { + where.append(" AND "); + where.append("(" + Calls.TYPE + " != ?)"); + selectionArgs.add(Integer.toString(AppCompatConstants.CALLS_BLOCKED_TYPE)); + } + final int limit = (mLogLimit == -1) ? NUM_LOGS_TO_DISPLAY : mLogLimit; final String selection = where.length() > 0 ? where.toString() : null; Uri uri = TelecomUtil.getCallLogUri(mContext).buildUpon() |