summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/blocking
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-05-04 08:23:17 -0700
committerEric Erfanian <erfanian@google.com>2017-05-04 14:04:39 -0700
commit10b34a5ebf12e97ecba0caf3c8e30b476b038a96 (patch)
tree3a325b0effac02fbd228b8ddf2f96589e5df72cd /java/com/android/dialer/blocking
parent8369df095a73a77b3715f8ae7ba06089cebca4ce (diff)
Update Dialer to V10 RC16
This release was created following the instructions at: go/dialer-aosp-release Subsequent dialer releases will follow as O bugs are fixed, until we reach our final RC. Version: 10 Candidate: RC16 Branch: dialer-android_release_branch/153304843.1 dialer-android/dialer-android_20170416.00/dialer-android_20170416.00_RC16 This release contains the following bug fixes since RC00: Bug: 37324705 35304403 36067503 35304446 33203808 37280992 37346084 35766990 37481880 37424493 36470282 37347691 37519015 37168472 35805360 37545472 27704934 36515614 35766990 37577470 34739750 35801628 36788693 35264204 36708536 37628370 36904650 37314436 37642171 37530847 37637799 37666625 37548549 37648036 37636412 37323529 37630507 35919141 37198343 37548572 36178218 37640315 37663896 37720467 37275944 37710497 31634477 37744796 37348506 37744796 37568534 37672424 34872683 34873026 37681461 34873295 37748373 37526812 37618638 37663896 37536088 37727455 37165687 36651204 36900708 37323529 36902926 37256480 37328353 37432034 37436952 34093562 37720889 37321935 37780300 37781115 37755902 36588206 34258266 37290464 37698062 37618638 37473004 37432034 37918676 37870494 37722091 Test: make, on device Change-Id: I99e1a484ccd578c1f8a13e7a6a4b4952f0791297
Diffstat (limited to 'java/com/android/dialer/blocking')
-rw-r--r--java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java4
-rw-r--r--java/com/android/dialer/blocking/FilteredNumberProvider.java7
-rw-r--r--java/com/android/dialer/blocking/FilteredNumbersUtil.java52
3 files changed, 10 insertions, 53 deletions
diff --git a/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java b/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java
index bd4156846..12a2086d4 100644
--- a/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java
+++ b/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java
@@ -201,7 +201,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
*/
@TargetApi(VERSION_CODES.M)
@Nullable
- public Integer getBlockedIdSynchronousForCalllogOnly(@Nullable String number, String countryIso) {
+ public Integer getBlockedIdSynchronous(@Nullable String number, String countryIso) {
Assert.isWorkerThread();
if (number == null) {
return null;
@@ -251,7 +251,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
blockedNumberCache.put(number, blockedId);
return blockedId;
} catch (SecurityException e) {
- LogUtil.e("FilteredNumberAsyncQueryHandler.getBlockedIdSynchronousForCalllogOnly", null, e);
+ LogUtil.e("FilteredNumberAsyncQueryHandler.getBlockedIdSynchronous", null, e);
return null;
}
}
diff --git a/java/com/android/dialer/blocking/FilteredNumberProvider.java b/java/com/android/dialer/blocking/FilteredNumberProvider.java
index 5d369038c..8ed781e73 100644
--- a/java/com/android/dialer/blocking/FilteredNumberProvider.java
+++ b/java/com/android/dialer/blocking/FilteredNumberProvider.java
@@ -26,12 +26,12 @@ import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
-import android.util.Log;
-import com.android.contacts.common.GeoUtil;
+import com.android.dialer.common.LogUtil;
import com.android.dialer.database.Database;
import com.android.dialer.database.DialerDatabaseHelper;
import com.android.dialer.database.FilteredNumberContract;
import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns;
+import com.android.dialer.location.GeoUtil;
/** Filtered number content provider. */
public class FilteredNumberProvider extends ContentProvider {
@@ -39,7 +39,6 @@ public class FilteredNumberProvider extends ContentProvider {
private static final int FILTERED_NUMBERS_TABLE = 1;
private static final int FILTERED_NUMBERS_TABLE_ID = 2;
private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
- private static final String TAG = FilteredNumberProvider.class.getSimpleName();
private DialerDatabaseHelper mDialerDatabaseHelper;
@Override
@@ -80,7 +79,7 @@ public class FilteredNumberProvider extends ContentProvider {
c.setNotificationUri(
getContext().getContentResolver(), FilteredNumberContract.FilteredNumber.CONTENT_URI);
} else {
- Log.d(TAG, "CURSOR WAS NULL");
+ LogUtil.d("FilteredNumberProvider.query", "CURSOR WAS NULL");
}
return c;
}
diff --git a/java/com/android/dialer/blocking/FilteredNumbersUtil.java b/java/com/android/dialer/blocking/FilteredNumbersUtil.java
index cbef73ca5..a95e8d789 100644
--- a/java/com/android/dialer/blocking/FilteredNumbersUtil.java
+++ b/java/com/android/dialer/blocking/FilteredNumbersUtil.java
@@ -27,19 +27,17 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
import android.provider.Settings;
import android.support.annotation.Nullable;
+import android.support.annotation.VisibleForTesting;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.widget.Toast;
import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler.OnHasBlockedNumbersListener;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.database.FilteredNumberContract.FilteredNumber;
-import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns;
import com.android.dialer.logging.InteractionEvent;
import com.android.dialer.logging.Logger;
import com.android.dialer.notification.NotificationChannelManager;
import com.android.dialer.notification.NotificationChannelManager.Channel;
import com.android.dialer.util.PermissionsUtil;
-import java.util.concurrent.TimeUnit;
/** Utility to help with tasks related to filtered numbers. */
public class FilteredNumbersUtil {
@@ -47,8 +45,9 @@ public class FilteredNumbersUtil {
public static final String CALL_BLOCKING_NOTIFICATION_TAG = "call_blocking";
public static final int CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_NOTIFICATION_ID =
R.id.notification_call_blocking_disabled_by_emergency_call;
- // Pref key for storing the time of end of the last emergency call in milliseconds after epoch.
- protected static final String LAST_EMERGENCY_CALL_MS_PREF_KEY = "last_emergency_call_ms";
+ // Pref key for storing the time of end of the last emergency call in milliseconds after epoch.\
+ @VisibleForTesting
+ public static final String LAST_EMERGENCY_CALL_MS_PREF_KEY = "last_emergency_call_ms";
// Pref key for storing whether a notification has been dispatched to notify the user that call
// blocking has been disabled because of a recent emergency call.
protected static final String NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY =
@@ -186,47 +185,6 @@ public class FilteredNumbersUtil {
task.execute();
}
- /**
- * WARNING: This method should NOT be executed on the UI thread. Use {@code
- * FilteredNumberAsyncQueryHandler} to asynchronously check if a number is blocked.
- */
- public static boolean shouldBlockVoicemail(
- Context context, String number, String countryIso, long voicemailDateMs) {
- final String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso);
- if (TextUtils.isEmpty(normalizedNumber)) {
- return false;
- }
-
- if (hasRecentEmergencyCall(context)) {
- return false;
- }
-
- final Cursor cursor =
- context
- .getContentResolver()
- .query(
- FilteredNumber.CONTENT_URI,
- new String[] {FilteredNumberColumns.CREATION_TIME},
- FilteredNumberColumns.NORMALIZED_NUMBER + "=?",
- new String[] {normalizedNumber},
- null);
- if (cursor == null) {
- return false;
- }
- try {
- /*
- * Block if number is found and it was added before this voicemail was received.
- * The VVM's date is reported with precision to the minute, even though its
- * magnitude is in milliseconds, so we perform the comparison in minutes.
- */
- return cursor.moveToFirst()
- && TimeUnit.MINUTES.convert(voicemailDateMs, TimeUnit.MILLISECONDS)
- >= TimeUnit.MINUTES.convert(cursor.getLong(0), TimeUnit.MILLISECONDS);
- } finally {
- cursor.close();
- }
- }
-
public static long getLastEmergencyCallTimeMillis(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context)
.getLong(LAST_EMERGENCY_CALL_MS_PREF_KEY, 0);
@@ -292,7 +250,7 @@ public class FilteredNumbersUtil {
context.getString(R.string.call_blocking_disabled_notification_text))
.setAutoCancel(true);
- NotificationChannelManager.applyChannel(builder, context, Channel.MISC, null);
+ NotificationChannelManager.applyChannel(builder, context, Channel.DEFAULT, null);
builder.setContentIntent(
PendingIntent.getActivity(
context,