Update AOSP Dialer source from internal google3 repository at
cl/152373142.
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/151342913 (3/27/2017) to cl/152373142 (4/06/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: I2fbc88cf6867b90ac8b65f75e5e34468988c7217
diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java
index 6453d5b..405eede 100644
--- a/java/com/android/incallui/StatusBarNotifier.java
+++ b/java/com/android/incallui/StatusBarNotifier.java
@@ -66,6 +66,10 @@
import com.android.contacts.common.util.BitmapUtil;
import com.android.contacts.common.util.ContactDisplayUtils;
import com.android.dialer.common.LogUtil;
+import com.android.dialer.enrichedcall.EnrichedCallComponent;
+import com.android.dialer.enrichedcall.EnrichedCallManager;
+import com.android.dialer.enrichedcall.Session;
+import com.android.dialer.multimedia.MultimediaData;
import com.android.dialer.notification.NotificationChannelManager;
import com.android.dialer.notification.NotificationChannelManager.Channel;
import com.android.dialer.oem.MotorolaUtils;
@@ -86,7 +90,8 @@
import java.util.Objects;
/** This class adds Notifications to the status bar for the in-call experience. */
-public class StatusBarNotifier implements InCallPresenter.InCallStateListener {
+public class StatusBarNotifier
+ implements InCallPresenter.InCallStateListener, EnrichedCallManager.StateChangedListener {
// Notification types
// Indicates that no notification is currently showing.
@@ -116,7 +121,7 @@
private StatusBarCallListener mStatusBarCallListener;
private boolean mShowFullScreenIntent;
- StatusBarNotifier(@NonNull Context context, @NonNull ContactInfoCache contactInfoCache) {
+ public StatusBarNotifier(@NonNull Context context, @NonNull ContactInfoCache contactInfoCache) {
Objects.requireNonNull(context);
mContext = context;
mContactsPreferences = ContactsPreferencesFactory.newContactsPreferences(mContext);
@@ -181,6 +186,12 @@
updateNotification(callList);
}
+ @Override
+ public void onEnrichedCallStateChanged() {
+ LogUtil.enterBlock("StatusBarNotifier.onEnrichedCallStateChanged");
+ updateNotification(CallList.getInstance());
+ }
+
/**
* Updates the phone app's status bar notification *and* launches the incoming call UI in response
* to a new incoming call.
@@ -199,7 +210,7 @@
* @see #updateInCallNotification(CallList)
*/
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
- void updateNotification(CallList callList) {
+ public void updateNotification(CallList callList) {
updateInCallNotification(callList);
}
@@ -637,7 +648,7 @@
return R.drawable.ic_phone_paused_white_24dp;
} else if (call.getVideoTech().getSessionModificationState()
== SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
- return R.drawable.ic_videocam;
+ return R.drawable.quantum_ic_videocam_white_24;
} else if (call.hasProperty(PROPERTY_HIGH_DEF_AUDIO)
&& MotorolaUtils.shouldShowHdIconInNotification(mContext)) {
// Normally when a call is ongoing the status bar displays an icon of a phone with animated
@@ -671,14 +682,20 @@
}
if (isIncomingOrWaiting) {
- if (call.hasProperty(Details.PROPERTY_WIFI)) {
+ EnrichedCallManager manager = EnrichedCallComponent.get(mContext).getEnrichedCallManager();
+ Session session = null;
+ if (call.getNumber() != null) {
+ session = manager.getSession(call.getUniqueCallId(), call.getNumber());
+ }
+
+ if (call.isSpam()) {
+ resId = R.string.notification_incoming_spam_call;
+ } else if (session != null) {
+ resId = getECIncomingCallText(session);
+ } else if (call.hasProperty(Details.PROPERTY_WIFI)) {
resId = R.string.notification_incoming_call_wifi;
} else {
- if (call.isSpam()) {
- resId = R.string.notification_incoming_spam_call;
- } else {
- resId = R.string.notification_incoming_call;
- }
+ resId = R.string.notification_incoming_call;
}
} else if (call.getState() == DialerCall.State.ONHOLD) {
resId = R.string.notification_on_hold;
@@ -698,6 +715,66 @@
return mContext.getString(resId);
}
+ private int getECIncomingCallText(Session session) {
+ int resId;
+ MultimediaData data = session.getMultimediaData();
+ boolean hasImage = data.hasImageData();
+ boolean hasSubject = !TextUtils.isEmpty(data.getText());
+ boolean hasMap = data.getLocation() != null;
+ if (data.isImportant()) {
+ if (hasMap) {
+ if (hasImage) {
+ if (hasSubject) {
+ resId = R.string.important_notification_incoming_call_with_photo_message_location;
+ } else {
+ resId = R.string.important_notification_incoming_call_with_photo_location;
+ }
+ } else if (hasSubject) {
+ resId = R.string.important_notification_incoming_call_with_message_location;
+ } else {
+ resId = R.string.important_notification_incoming_call_with_location;
+ }
+ } else if (hasImage) {
+ if (hasSubject) {
+ resId = R.string.important_notification_incoming_call_with_photo_message;
+ } else {
+ resId = R.string.important_notification_incoming_call_with_photo;
+ }
+ } else {
+ resId = R.string.important_notification_incoming_call_with_message;
+ }
+ if (mContext.getString(resId).length() > 50) {
+ resId = R.string.important_notification_incoming_call_attachments;
+ }
+ } else {
+ if (hasMap) {
+ if (hasImage) {
+ if (hasSubject) {
+ resId = R.string.notification_incoming_call_with_photo_message_location;
+ } else {
+ resId = R.string.notification_incoming_call_with_photo_location;
+ }
+ } else if (hasSubject) {
+ resId = R.string.notification_incoming_call_with_message_location;
+ } else {
+ resId = R.string.notification_incoming_call_with_location;
+ }
+ } else if (hasImage) {
+ if (hasSubject) {
+ resId = R.string.notification_incoming_call_with_photo_message;
+ } else {
+ resId = R.string.notification_incoming_call_with_photo;
+ }
+ } else {
+ resId = R.string.notification_incoming_call_with_message;
+ }
+ }
+ if (mContext.getString(resId).length() > 50) {
+ resId = R.string.notification_incoming_call_attachments;
+ }
+ return resId;
+ }
+
/** Gets the most relevant call to display in the notification. */
private DialerCall getCallToShow(CallList callList) {
if (callList == null) {
@@ -755,7 +832,7 @@
createNotificationPendingIntent(mContext, ACTION_DECLINE_INCOMING_CALL);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.ic_close_dk),
+ Icon.createWithResource(mContext, R.drawable.quantum_ic_close_white_24),
getActionText(
R.string.notification_action_dismiss, R.color.notification_action_dismiss),
declinePendingIntent)
@@ -785,7 +862,7 @@
createNotificationPendingIntent(mContext, ACTION_ANSWER_VIDEO_INCOMING_CALL);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.ic_videocam),
+ Icon.createWithResource(mContext, R.drawable.quantum_ic_videocam_white_24),
getActionText(
R.string.notification_action_answer_video,
R.color.notification_action_answer_video),
@@ -801,7 +878,7 @@
createNotificationPendingIntent(mContext, ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.ic_videocam),
+ Icon.createWithResource(mContext, R.drawable.quantum_ic_videocam_white_24),
getActionText(
R.string.notification_action_accept, R.color.notification_action_accept),
acceptVideoPendingIntent)
@@ -816,7 +893,7 @@
createNotificationPendingIntent(mContext, ACTION_DECLINE_VIDEO_UPGRADE_REQUEST);
builder.addAction(
new Notification.Action.Builder(
- Icon.createWithResource(mContext, R.drawable.ic_videocam),
+ Icon.createWithResource(mContext, R.drawable.quantum_ic_videocam_white_24),
getActionText(
R.string.notification_action_dismiss, R.color.notification_action_dismiss),
declineVideoPendingIntent)