diff options
Diffstat (limited to 'src/com/android/dialer/calllog')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 7 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 11 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogQueryHandler.java | 13 |
3 files changed, 25 insertions, 6 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 0ee7e935d..3dccf27bb 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -260,10 +260,11 @@ public class CallLogAdapter extends GroupingListAdapter mCallLogListItemHelper = new CallLogListItemHelper(phoneCallDetailsHelper, resources, mTelecomCallLogCache); mCallLogGroupBuilder = new CallLogGroupBuilder(this); - mPrefs = PreferenceManager.getDefaultSharedPreferences(context); - maybeShowVoicemailPromoCard(); mFilteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(mContext.getContentResolver()); + + mPrefs = PreferenceManager.getDefaultSharedPreferences(context); + maybeShowVoicemailPromoCard(); } public void onSaveInstanceState(Bundle outState) { @@ -306,7 +307,7 @@ public class CallLogAdapter extends GroupingListAdapter mBlockedIdCache.clear(); } - public void startCache() { + public void onResume() { if (PermissionsUtil.hasPermission(mContext, android.Manifest.permission.READ_CONTACTS)) { mContactInfoCache.start(); } diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index dff213bce..369730d96 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -42,6 +42,7 @@ import android.view.ViewGroup; import com.android.contacts.common.GeoUtil; import com.android.contacts.common.util.PermissionsUtil; import com.android.dialer.R; +import com.android.dialer.filterednumber.FilteredNumbersUtil; import com.android.dialer.util.EmptyLoader; import com.android.dialer.voicemail.VoicemailPlaybackPresenter; import com.android.dialer.widget.EmptyContentView; @@ -124,6 +125,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis private boolean mRefreshDataRequired = true; private boolean mHasReadCallLogPermission = false; + private boolean mShouldHideBlockedCalls = false; // Exactly same variable is in Fragment as a package private. private boolean mMenuVisible = true; @@ -209,6 +211,8 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis resolver.registerContentObserver(Status.CONTENT_URI, true, mVoicemailStatusObserver); setHasOptionsMenu(true); + mShouldHideBlockedCalls = FilteredNumbersUtil.shouldHideBlockedCalls(getActivity()); + if (mCallTypeFilter == Calls.VOICEMAIL_TYPE) { mVoicemailPlaybackPresenter = VoicemailPlaybackPresenter .getInstance(activity, state); @@ -339,9 +343,14 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis mRefreshDataRequired = true; updateEmptyMessage(mCallTypeFilter); } + if (mShouldHideBlockedCalls != FilteredNumbersUtil.shouldHideBlockedCalls(getActivity())) { + mShouldHideBlockedCalls = !mShouldHideBlockedCalls; + mRefreshDataRequired = true; + } + mHasReadCallLogPermission = hasReadCallLogPermission; refreshData(); - mAdapter.startCache(); + mAdapter.onResume(); rescheduleDisplayUpdate(); 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() |