summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/ExternalCallNotifier.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-06-19 11:26:01 -0700
committerEric Erfanian <erfanian@google.com>2017-06-19 11:30:45 -0700
commit2f1c7586bcce334ca69022eb8dc6d8965ceb6a05 (patch)
treebf00ada449ee3de31ec983a14e84159200aa18c2 /java/com/android/incallui/ExternalCallNotifier.java
parent3d0ca68e466482971a4cf46576c50cb2bd42bcb5 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/159428781. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/152373142 (4/06/2017) to cl/159428781 (6/19/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: Ie60a84b3936efd0ea3d95d7c86bf96d2b1663030
Diffstat (limited to 'java/com/android/incallui/ExternalCallNotifier.java')
-rw-r--r--java/com/android/incallui/ExternalCallNotifier.java52
1 files changed, 24 insertions, 28 deletions
diff --git a/java/com/android/incallui/ExternalCallNotifier.java b/java/com/android/incallui/ExternalCallNotifier.java
index 0c2493c60..f01a29458 100644
--- a/java/com/android/incallui/ExternalCallNotifier.java
+++ b/java/com/android/incallui/ExternalCallNotifier.java
@@ -29,6 +29,7 @@ import android.net.Uri;
import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.support.v4.os.BuildCompat;
import android.telecom.Call;
import android.telecom.PhoneAccount;
import android.telecom.VideoProfile;
@@ -41,8 +42,7 @@ 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.dialer.notification.NotificationChannelId;
import com.android.incallui.call.DialerCall;
import com.android.incallui.call.DialerCallDelegate;
import com.android.incallui.call.ExternalCallList;
@@ -59,9 +59,10 @@ 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 int NOTIFICATION_ID = R.id.notification_external_call;
+ private static final String NOTIFICATION_TAG = "EXTERNAL_CALL";
+
+ private static final int NOTIFICATION_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<>();
@@ -188,15 +189,14 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
NotificationManager notificationManager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.cancel(
- String.valueOf(mNotifications.get(call).getNotificationId()), NOTIFICATION_ID);
+ notificationManager.cancel(NOTIFICATION_TAG, mNotifications.get(call).getNotificationId());
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_GROUP, NOTIFICATION_ID);
+ notificationManager.cancel(NOTIFICATION_TAG, NOTIFICATION_SUMMARY_ID);
mShowingSummary = false;
// If there is still a single call requiring a notification, re-post the notification as a
@@ -237,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_GROUP);
+ builder.setGroup(NOTIFICATION_TAG);
boolean isVideoCall = VideoProfile.isVideo(info.getCall().getDetails().getVideoState());
// Set the content ("Ongoing call on another device")
@@ -251,9 +251,9 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
builder.setLargeIcon(info.getLargeIcon());
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());
+ if (BuildCompat.isAtLeastO()) {
+ builder.setChannelId(NotificationChannelId.DEFAULT);
+ }
// Where the external call supports being transferred to the local device, add an action
// to the notification to initiate the call pull process.
@@ -286,20 +286,16 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
Notification.Builder publicBuilder = new Notification.Builder(mContext);
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());
+ if (BuildCompat.isAtLeastO()) {
+ publicBuilder.setChannelId(NotificationChannelId.DEFAULT);
+ }
builder.setPublicVersion(publicBuilder.build());
Notification notification = builder.build();
NotificationManager notificationManager =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.notify(
- String.valueOf(info.getNotificationId()), NOTIFICATION_ID, notification);
+ notificationManager.notify(NOTIFICATION_TAG, info.getNotificationId(), notification);
if (!mShowingSummary && mNotifications.size() > 1) {
// If the number of notifications shown is > 1, and we're not already showing a group summary,
@@ -310,12 +306,13 @@ 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_GROUP);
+ summary.setGroup(NOTIFICATION_TAG);
summary.setGroupSummary(true);
summary.setSmallIcon(R.drawable.quantum_ic_call_white_24);
- NotificationChannelManager.applyChannel(
- summary, mContext, Channel.EXTERNAL_CALL, info.getCall().getDetails().getAccountHandle());
- notificationManager.notify(NOTIFICATION_GROUP, NOTIFICATION_ID, summary.build());
+ if (BuildCompat.isAtLeastO()) {
+ summary.setChannelId(NotificationChannelId.DEFAULT);
+ }
+ notificationManager.notify(NOTIFICATION_TAG, NOTIFICATION_SUMMARY_ID, summary.build());
mShowingSummary = true;
}
}
@@ -384,11 +381,10 @@ public class ExternalCallNotifier implements ExternalCallList.ExternalCallListen
ContactInfoCache.ContactCacheEntry contactInfo,
android.telecom.Call call) {
- if (call.getDetails().hasProperty(android.telecom.Call.Details.PROPERTY_CONFERENCE)
- && !call.getDetails()
- .hasProperty(android.telecom.Call.Details.PROPERTY_GENERIC_CONFERENCE)) {
-
- return context.getResources().getString(R.string.conference_call_name);
+ if (call.getDetails().hasProperty(android.telecom.Call.Details.PROPERTY_CONFERENCE)) {
+ return CallerInfoUtils.getConferenceString(
+ context,
+ call.getDetails().hasProperty(android.telecom.Call.Details.PROPERTY_GENERIC_CONFERENCE));
}
String preferredName =