diff options
-rw-r--r-- | src/com/android/dialer/filterednumber/FilteredNumbersUtil.java | 5 | ||||
-rw-r--r-- | tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java | 24 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java index e3870ded9..498b10a45 100644 --- a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java +++ b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java @@ -33,6 +33,7 @@ import android.widget.Toast; import com.android.contacts.common.testing.NeededForTesting; import com.android.dialer.R; +import com.android.dialer.compat.FilteredNumberCompat; import com.android.dialer.database.FilteredNumberAsyncQueryHandler; import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnHasBlockedNumbersListener; import com.android.dialer.database.FilteredNumberContract.FilteredNumber; @@ -298,6 +299,10 @@ public class FilteredNumbersUtil { } public static void maybeNotifyCallBlockingDisabled(final Context context) { + // The Dialer is not responsible for this notification after migrating + if (FilteredNumberCompat.useNewFiltering()) { + return; + } // Skip if the user has already received a notification for the most recent emergency call. if (PreferenceManager.getDefaultSharedPreferences(context) .getBoolean(NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY, false)) { diff --git a/tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java b/tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java index d2e7f0a1c..d496b1845 100644 --- a/tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java +++ b/tests/src/com/android/dialer/filterednumber/FilteredNumbersUtilTest.java @@ -15,12 +15,20 @@ */ package com.android.dialer.filterednumber; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; + +import android.content.Context; import android.preference.PreferenceManager; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.SmallTest; +import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.test.mocks.ContactsMockContext; import com.android.contacts.common.test.mocks.MockContentProvider.Query; +import com.android.dialer.compat.FilteredNumberCompat; import com.android.dialer.database.FilteredNumberContract; import com.android.dialer.database.FilteredNumberContract.FilteredNumber; import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; @@ -31,10 +39,10 @@ public class FilteredNumbersUtilTest extends AndroidTestCase { private static final String COUNTRY_ISO = "US"; // Wed Nov 11 2015 15:00:00 - private static final long EARLIER_TIME = 1447282800000l; + private static final long EARLIER_TIME = 1447282800000L; // Wed Nov 11 2015 15:01:40 - private static final long LATER_TIME = 1447282900000l; + private static final long LATER_TIME = 1447282900000L; private static final String[] FILTERED_NUMBER_PROJECTION = new String[] { FilteredNumberColumns.CREATION_TIME }; @@ -98,6 +106,18 @@ public class FilteredNumbersUtilTest extends AndroidTestCase { COUNTRY_ISO, 0)); } + public void testMaybeNotifyCallBlockingDisabled_Migrated() { + if (!CompatUtils.isNCompatible()) { + return; + } + FilteredNumberCompat.setIsEnabledForTest(true); + FilteredNumberCompat.setHasMigratedToNewBlocking(true); + Context mockContext = mock(Context.class); + + FilteredNumbersUtil.maybeNotifyCallBlockingDisabled(mockContext); + verifyZeroInteractions(mockContext); + } + private void setupShouldBlockVoicemailQuery(long creationTimeMs) { Query query = mContext.getContactsProvider().expectQuery(FilteredNumber.CONTENT_URI) .withProjection(FILTERED_NUMBER_PROJECTION) |