summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2022-04-01 20:32:40 +0000
committerXin Li <delphij@google.com>2022-04-01 20:32:40 +0000
commitf0108749d6ec1bf5dadb359111eba84c11f82576 (patch)
tree8e34dbe2ec1e1796f0e6f11af6cb14798748764c
parent7cf8a84386cfe7682087d0ae8fa6eec15edd8095 (diff)
parent1a222dc1c6156f5fdffb7985f480e0622d3229db (diff)
downloadDialer-f0108749d6ec1bf5dadb359111eba84c11f82576.tar.gz
Merge Android 12 QPR3 ab/8391262
Bug: 226662282 Merged-In: Id92d548179566319aa08b16c56b4fce88ddcd04d Change-Id: Ie1b56daea3fe293373499d59b031d414a803c5cc
-rw-r--r--res/values/overlayable.xml5
-rw-r--r--res/values/redirections.xml3
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/com/android/car/dialer/notification/InCallNotificationController.java19
4 files changed, 26 insertions, 5 deletions
diff --git a/res/values/overlayable.xml b/res/values/overlayable.xml
index 891b6ad7..46b7473a 100644
--- a/res/values/overlayable.xml
+++ b/res/values/overlayable.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<!-- Copyright (C) 2021 The Android Open Source Project
+<!-- Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@@ -184,6 +184,7 @@ REGENERATE USING packages/apps/Car/tests/tools/rro/generate-overlayable.py
<item type="drawable" name="button_active_state_circle"/>
<item type="drawable" name="dialer_ripple_background"/>
<item type="drawable" name="ic_add_favorite"/>
+ <item type="drawable" name="ic_answer_icon"/>
<item type="drawable" name="ic_app_icon"/>
<item type="drawable" name="ic_arrow_right"/>
<item type="drawable" name="ic_audio_route_earpiece"/>
@@ -203,6 +204,7 @@ REGENERATE USING packages/apps/Car/tests/tools/rro/generate-overlayable.py
<item type="drawable" name="ic_call_missed"/>
<item type="drawable" name="ic_call_received"/>
<item type="drawable" name="ic_contact"/>
+ <item type="drawable" name="ic_decline_icon"/>
<item type="drawable" name="ic_dialpad"/>
<item type="drawable" name="ic_dialpad_activatable"/>
<item type="drawable" name="ic_direction"/>
@@ -435,6 +437,7 @@ REGENERATE USING packages/apps/Car/tests/tools/rro/generate-overlayable.py
<item type="string" name="no_hfp"/>
<item type="string" name="no_phone_numbers"/>
<item type="string" name="notification_incoming_call"/>
+ <item type="string" name="notification_incoming_call_join_number"/>
<item type="string" name="one"/>
<item type="string" name="one_letters"/>
<item type="string" name="ongoing_conf_title"/>
diff --git a/res/values/redirections.xml b/res/values/redirections.xml
index fe3238f5..34be7fcc 100644
--- a/res/values/redirections.xml
+++ b/res/values/redirections.xml
@@ -29,4 +29,7 @@
<drawable name="ic_audio_route_speaker">@drawable/ic_speaker_phone</drawable>
<drawable name="ic_audio_route_speaker_activatable">@drawable/ic_speaker_phone_activatable
</drawable>
+
+ <drawable name="ic_answer_icon">@null</drawable>
+ <drawable name="ic_decline_icon">@null</drawable>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 47c2f422..1f2b32d6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -180,6 +180,10 @@
<string name="in_call_notification_channel_name">Incoming call notification</string>
<!-- Text for incoming call notification [CHAR LIMIT=40]-->
<string name="notification_incoming_call">Incoming call</string>
+ <!-- Text for incoming call notification with phone number -->
+ <string name="notification_incoming_call_join_number">
+ Incoming call * <xliff:g id="phone_number" example="511">%1$s</xliff:g>
+ </string>
<!-- Name of missed call notification channel in app info [CHAR LIMIT=50] -->
<string name="missed_call_notification_channel_name">Missed call notification</string>
<!-- Title for missed call notification [CHAR LIMIT=40]-->
diff --git a/src/com/android/car/dialer/notification/InCallNotificationController.java b/src/com/android/car/dialer/notification/InCallNotificationController.java
index 022ccbdf..dc253e43 100644
--- a/src/com/android/car/dialer/notification/InCallNotificationController.java
+++ b/src/com/android/car/dialer/notification/InCallNotificationController.java
@@ -26,6 +26,7 @@ import android.graphics.drawable.Icon;
import android.telecom.Call;
import android.text.TextUtils;
+import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import com.android.car.dialer.R;
@@ -104,9 +105,9 @@ public final class InCallNotificationController {
.setContentTitle(TelecomUtils.getBidiWrappedNumber(callNumber))
.setContentText(mContext.getString(R.string.notification_incoming_call))
.setActions(
- getAction(call, R.string.answer_call,
+ getAction(call, R.string.answer_call, R.drawable.ic_answer_icon,
NotificationService.ACTION_ANSWER_CALL),
- getAction(call, R.string.decline_call,
+ getAction(call, R.string.decline_call, R.drawable.ic_decline_icon,
NotificationService.ACTION_DECLINE_CALL));
mNotificationManager.notify(
callNumber,
@@ -121,6 +122,15 @@ public final class InCallNotificationController {
.setLargeIcon(pair.second)
.setContentTitle(TelecomUtils.getBidiWrappedNumber(pair.first));
+ String readableNumber = TelecomUtils.getReadableNumber(
+ mContext, callNumber);
+ if (!TextUtils.equals(readableNumber, pair.first)) {
+ mNotificationBuilder.setContentText(
+ mContext.getString(
+ R.string.notification_incoming_call_join_number,
+ TelecomUtils.getBidiWrappedNumber(readableNumber)));
+ }
+
mNotificationManager.notify(
callNumber,
NOTIFICATION_ID,
@@ -157,14 +167,15 @@ public final class InCallNotificationController {
}
private Notification.Action getAction(Call call, @StringRes int actionText,
- String intentAction) {
+ @DrawableRes int actionIcon, String intentAction) {
CharSequence text = mContext.getString(actionText);
+ Icon icon = Icon.createWithResource(mContext, actionIcon);
PendingIntent intent = PendingIntent.getService(
mContext,
0,
getIntent(intentAction, call),
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
- return new Notification.Action.Builder(null, text, intent).build();
+ return new Notification.Action.Builder(icon, text, intent).build();
}
private Intent getIntent(String action, Call call) {