diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-08-31 16:17:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-31 16:17:04 +0000 |
commit | c39ea3c55fac807c0b98aabdf56c70dc8a49036c (patch) | |
tree | e282668a9587cf6c1ec7b604dea860400c75c6c7 /java/com/android/dialer/blocking/FilteredNumbersUtil.java | |
parent | 68038172793ee0e2ab3e2e56ddfbeb82879d1f58 (diff) | |
parent | 2ca4318cc1ee57dda907ba2069bd61d162b1baef (diff) |
Merge "Update Dialer source to latest internal Google revision."
Diffstat (limited to 'java/com/android/dialer/blocking/FilteredNumbersUtil.java')
-rw-r--r-- | java/com/android/dialer/blocking/FilteredNumbersUtil.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/java/com/android/dialer/blocking/FilteredNumbersUtil.java b/java/com/android/dialer/blocking/FilteredNumbersUtil.java index cdcf1f78d..fba3b86db 100644 --- a/java/com/android/dialer/blocking/FilteredNumbersUtil.java +++ b/java/com/android/dialer/blocking/FilteredNumbersUtil.java @@ -16,7 +16,6 @@ package com.android.dialer.blocking; import android.app.Notification; -import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ContentValues; import android.content.Context; @@ -27,6 +26,7 @@ import android.provider.ContactsContract.Contacts; import android.provider.Settings; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; +import android.support.v4.os.BuildCompat; import android.support.v4.os.UserManagerCompat; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; @@ -35,8 +35,8 @@ import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler.OnHasBlockedN import com.android.dialer.common.LogUtil; 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.notification.DialerNotificationManager; +import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.PermissionsUtil; import java.util.concurrent.TimeUnit; @@ -45,8 +45,7 @@ import java.util.concurrent.TimeUnit; 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; + public static final int CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_NOTIFICATION_ID = 10; // 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"; @@ -243,8 +242,6 @@ public class FilteredNumbersUtil { return; } - NotificationManager notificationManager = - (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification.Builder builder = new Notification.Builder(context) .setSmallIcon(R.drawable.quantum_ic_block_white_24) @@ -254,7 +251,9 @@ public class FilteredNumbersUtil { context.getString(R.string.call_blocking_disabled_notification_text)) .setAutoCancel(true); - NotificationChannelManager.applyChannel(builder, context, Channel.DEFAULT, null); + if (BuildCompat.isAtLeastO()) { + builder.setChannelId(NotificationChannelId.DEFAULT); + } builder.setContentIntent( PendingIntent.getActivity( context, @@ -262,7 +261,8 @@ public class FilteredNumbersUtil { FilteredNumberCompat.createManageBlockedNumbersIntent(context), PendingIntent.FLAG_UPDATE_CURRENT)); - notificationManager.notify( + DialerNotificationManager.notify( + context, CALL_BLOCKING_NOTIFICATION_TAG, CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_NOTIFICATION_ID, builder.build()); |