summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/blocking
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2018-03-22 01:06:19 -0700
committerCopybara-Service <copybara-piper@google.com>2018-03-26 22:15:06 -0700
commit57fdc2b9ab68bff217d4c9c605ef89cefd66f678 (patch)
tree8588b9122e464ebe64930271c766a3120ee5ac60 /java/com/android/dialer/blocking
parent58d0b2a7cdd4b988f527f03a7cb4ba2a4b7cd145 (diff)
Increase minSdk to 24.
Manually set to M - MissedCallNotifierTest (not sure what the issue is here...) - CallLogGroupBuilderTest (because a check was removed, some NPEs are thrown) - MainSearchControllerTest (/system/etc/fonts.xml (No such file or directory)) Ignore Tests - a few random ones in incallui/answer/impl/hint (shared prefs aren't working for some reason) - VisualVoicemailUpdateTaskTest (disabled the whole test, issue unclear) Bug: 73902692 Test: tap PiperOrigin-RevId: 190030202 Change-Id: I1e9b61d758a61582c5a183ee884dd2181d1c10de
Diffstat (limited to 'java/com/android/dialer/blocking')
-rw-r--r--java/com/android/dialer/blocking/BlockedNumbersMigrator.java2
-rw-r--r--java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java7
-rw-r--r--java/com/android/dialer/blocking/FilteredNumberCompat.java26
3 files changed, 11 insertions, 24 deletions
diff --git a/java/com/android/dialer/blocking/BlockedNumbersMigrator.java b/java/com/android/dialer/blocking/BlockedNumbersMigrator.java
index 88f474a84..61ebf2f56 100644
--- a/java/com/android/dialer/blocking/BlockedNumbersMigrator.java
+++ b/java/com/android/dialer/blocking/BlockedNumbersMigrator.java
@@ -35,7 +35,7 @@ import java.util.Objects;
* Class which should be used to migrate numbers from {@link FilteredNumberContract} blocking to
* {@link android.provider.BlockedNumberContract} blocking.
*/
-@TargetApi(VERSION_CODES.M)
+@TargetApi(VERSION_CODES.N)
public class BlockedNumbersMigrator {
private final Context context;
diff --git a/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java b/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java
index 09fd5f0a8..8be479c99 100644
--- a/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java
+++ b/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java
@@ -37,6 +37,7 @@ import com.android.dialer.database.FilteredNumberContract.FilteredNumberTypes;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+/** TODO(calderwoodra): documentation */
public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
public static final int INVALID_ID = -1;
@@ -199,7 +200,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
*
* @return blocked id.
*/
- @TargetApi(VERSION_CODES.M)
+ @TargetApi(VERSION_CODES.N)
@Nullable
public Integer getBlockedIdSynchronous(@Nullable String number, String countryIso) {
Assert.isWorkerThread();
@@ -382,6 +383,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
null);
}
+ /** TODO(calderwoodra): documentation */
public interface OnCheckBlockedListener {
/**
@@ -392,6 +394,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
void onCheckComplete(Integer id);
}
+ /** TODO(calderwoodra): documentation */
public interface OnBlockNumberListener {
/**
@@ -402,6 +405,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
void onBlockComplete(Uri uri);
}
+ /** TODO(calderwoodra): documentation */
public interface OnUnblockNumberListener {
/**
@@ -413,6 +417,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
void onUnblockComplete(int rows, ContentValues values);
}
+ /** TODO(calderwoodra): documentation */
interface OnHasBlockedNumbersListener {
/**
diff --git a/java/com/android/dialer/blocking/FilteredNumberCompat.java b/java/com/android/dialer/blocking/FilteredNumberCompat.java
index bea84e8db..b0af45c97 100644
--- a/java/com/android/dialer/blocking/FilteredNumberCompat.java
+++ b/java/com/android/dialer/blocking/FilteredNumberCompat.java
@@ -16,16 +16,12 @@
package com.android.dialer.blocking;
-import android.annotation.TargetApi;
import android.app.FragmentManager;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import android.os.Build.VERSION;
-import android.os.Build.VERSION_CODES;
-import android.os.UserManager;
import android.preference.PreferenceManager;
import android.provider.BlockedNumberContract;
import android.provider.BlockedNumberContract.BlockedNumbers;
@@ -110,7 +106,7 @@ public class FilteredNumberCompat {
* otherwise.
*/
public static boolean canUseNewFiltering() {
- return VERSION.SDK_INT >= VERSION_CODES.N;
+ return true;
}
/**
@@ -162,16 +158,14 @@ public class FilteredNumberCompat {
private static Uri getBaseUri(Context context) {
// Explicit version check to aid static analysis
- return useNewFiltering(context) && VERSION.SDK_INT >= VERSION_CODES.N
- ? BlockedNumbers.CONTENT_URI
- : FilteredNumber.CONTENT_URI;
+ return useNewFiltering(context) ? BlockedNumbers.CONTENT_URI : FilteredNumber.CONTENT_URI;
}
/**
* Removes any null column names from the given projection array. This method is intended to be
* used to strip out any column names that aren't available in every version of number blocking.
* Example: {@literal getContext().getContentResolver().query( someUri, // Filtering ensures that
- * no non-existant columns are queried FilteredNumberCompat.filter(new String[]
+ * no non-existent columns are queried FilteredNumberCompat.filter(new String[]
* {FilteredNumberCompat.getIdColumnName(), FilteredNumberCompat.getTypeColumnName()},
* FilteredNumberCompat.getE164NumberColumnName() + " = ?", new String[] {e164Number}); }
*
@@ -249,9 +243,7 @@ public class FilteredNumberCompat {
*/
public static Intent createManageBlockedNumbersIntent(Context context) {
// Explicit version check to aid static analysis
- if (canUseNewFiltering()
- && hasMigratedToNewBlocking(context)
- && VERSION.SDK_INT >= VERSION_CODES.N) {
+ if (canUseNewFiltering() && hasMigratedToNewBlocking(context)) {
return context.getSystemService(TelecomManager.class).createManageBlockedNumbersIntent();
}
Intent intent = new Intent("com.android.dialer.action.BLOCKED_NUMBERS_SETTINGS");
@@ -270,11 +262,6 @@ public class FilteredNumberCompat {
return canAttemptBlockOperationsForTest;
}
- if (VERSION.SDK_INT < VERSION_CODES.N) {
- // Dialer blocking, must be primary user
- return context.getSystemService(UserManager.class).isSystemUser();
- }
-
// Great Wall blocking, must be primary user and the default or system dialer
// TODO(maxwelb): check that we're the system Dialer
return TelecomUtil.isDefaultDialer(context)
@@ -294,10 +281,6 @@ public class FilteredNumberCompat {
* otherwise.
*/
public static boolean canCurrentUserOpenBlockSettings(Context context) {
- if (VERSION.SDK_INT < VERSION_CODES.N) {
- // Dialer blocking, must be primary user
- return context.getSystemService(UserManager.class).isSystemUser();
- }
// BlockedNumberContract blocking, verify through Contract API
return TelecomUtil.isDefaultDialer(context)
&& safeBlockedNumbersContractCanCurrentUserBlockNumbers(context);
@@ -312,7 +295,6 @@ public class FilteredNumberCompat {
* @return the result of BlockedNumberContract#canCurrentUserBlockNumbers, or {@code false} if an
* exception was thrown.
*/
- @TargetApi(VERSION_CODES.N)
private static boolean safeBlockedNumbersContractCanCurrentUserBlockNumbers(Context context) {
try {
return BlockedNumberContract.canCurrentUserBlockNumbers(context);