summaryrefslogtreecommitdiffstats
path: root/java/com/android/incallui/ExternalCallNotifier.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-03-15 14:41:07 -0700
committerEric Erfanian <erfanian@google.com>2017-03-15 16:24:23 -0700
commitd5e47f6da5b08b13ecdfa7f1edc7e12aeb83fab9 (patch)
treeb54abbb51fb7d66e7755a1fbb5db023ff601090b /java/com/android/incallui/ExternalCallNotifier.java
parent30436e7e6d3f2c8755a91b2b6222b74d465a9e87 (diff)
downloadandroid_packages_apps_Dialer-d5e47f6da5b08b13ecdfa7f1edc7e12aeb83fab9.tar.gz
android_packages_apps_Dialer-d5e47f6da5b08b13ecdfa7f1edc7e12aeb83fab9.tar.bz2
android_packages_apps_Dialer-d5e47f6da5b08b13ecdfa7f1edc7e12aeb83fab9.zip
Update Dialer source from latest green build.
* Refactor voicemail component * Add new enriched calling components Test: treehugger, manual aosp testing Change-Id: I521a0f86327d4b42e14d93927c7d613044ed5942
Diffstat (limited to 'java/com/android/incallui/ExternalCallNotifier.java')
-rw-r--r--java/com/android/incallui/ExternalCallNotifier.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java
index 466e12a6d..6ec94a631 100644
--- a/java/com/android/incallui/ExternalCallNotifier.java
+++ b/java/com/android/incallui/ExternalCallNotifier.java
@@ -41,6 +41,8 @@ import com.android.contacts.common.compat.CallCompat;
import com.android.contacts.common.preference.ContactsPreferences;
import com.android.contacts.common.util.BitmapUtil;
import com.android.contacts.common.util.ContactDisplayUtils;
+import com.android.dialer.notification.NotificationChannelManager;
+import com.android.dialer.notification.NotificationChannelManager.Channel;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCallDelegate;
import com.android.incallui.call.ExternalCallList;
@@ -57,9 +59,9 @@ import java.util.Map;
public class ExternalCallNotifier implements ExternalCallList.ExternalCallListener {
/** Tag used with the notification manager to uniquely identify external call notifications. */
- private static final String NOTIFICATION_TAG = "EXTERNAL_CALL";
+ private static final int NOTIFICATION_ID = R.id.notification_external_call;
- private static final int SUMMARY_ID = -1;
+ private static final String NOTIFICATION_GROUP = "ExternalCallNotifier";
private final Context mContext;
private final ContactInfoCache mContactInfoCache;
private Map<Call, NotificationInfo> mNotifications = new ArrayMap<>();
@@ -186,14 +188,15 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
NotificationManager notificationManager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.cancel(NOTIFICATION_TAG, mNotifications.get(call).getNotificationId());
+ notificationManager.cancel(
+ String.valueOf(mNotifications.get(call).getNotificationId()), NOTIFICATION_ID);
mNotifications.remove(call);
if (mShowingSummary && mNotifications.size() <= 1) {
// Where a summary notification is showing and there is now not enough notifications to
// necessitate a summary, cancel the summary.
- notificationManager.cancel(NOTIFICATION_TAG, SUMMARY_ID);
+ notificationManager.cancel(NOTIFICATION_GROUP, NOTIFICATION_ID);
mShowingSummary = false;
// If there is still a single call requiring a notification, re-post the notification as a
@@ -234,7 +237,7 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
builder.setOngoing(true);
// Make the notification prioritized over the other normal notifications.
builder.setPriority(Notification.PRIORITY_HIGH);
- builder.setGroup(NOTIFICATION_TAG);
+ builder.setGroup(NOTIFICATION_GROUP);
boolean isVideoCall = VideoProfile.isVideo(info.getCall().getDetails().getVideoState());
// Set the content ("Ongoing call on another device")
@@ -249,6 +252,9 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
builder.setColor(mContext.getResources().getColor(R.color.dialer_theme_color));
builder.addPerson(info.getPersonReference());
+ NotificationChannelManager.applyChannel(
+ builder, mContext, Channel.EXTERNAL_CALL, info.getCall().getDetails().getAccountHandle());
+
// Where the external call supports being transferred to the local device, add an action
// to the notification to initiate the call pull process.
if (CallCompat.canPullExternalCall(info.getCall())) {
@@ -281,12 +287,19 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
publicBuilder.setSmallIcon(R.drawable.quantum_ic_call_white_24);
publicBuilder.setColor(mContext.getResources().getColor(R.color.dialer_theme_color));
+ NotificationChannelManager.applyChannel(
+ publicBuilder,
+ mContext,
+ Channel.EXTERNAL_CALL,
+ info.getCall().getDetails().getAccountHandle());
+
builder.setPublicVersion(publicBuilder.build());
Notification notification = builder.build();
NotificationManager notificationManager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.notify(NOTIFICATION_TAG, info.getNotificationId(), notification);
+ notificationManager.notify(
+ String.valueOf(info.getNotificationId()), NOTIFICATION_ID, notification);
if (!mShowingSummary && mNotifications.size() > 1) {
// If the number of notifications shown is > 1, and we're not already showing a group summary,
@@ -297,10 +310,12 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
summary.setOngoing(true);
// Make the notification prioritized over the other normal notifications.
summary.setPriority(Notification.PRIORITY_HIGH);
- summary.setGroup(NOTIFICATION_TAG);
+ summary.setGroup(NOTIFICATION_GROUP);
summary.setGroupSummary(true);
summary.setSmallIcon(R.drawable.quantum_ic_call_white_24);
- notificationManager.notify(NOTIFICATION_TAG, SUMMARY_ID, summary.build());
+ NotificationChannelManager.applyChannel(
+ summary, mContext, Channel.EXTERNAL_CALL, info.getCall().getDetails().getAccountHandle());
+ notificationManager.notify(NOTIFICATION_GROUP, NOTIFICATION_ID, summary.build());
mShowingSummary = true;
}
}