summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-11-11 21:34:09 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-11-11 21:34:09 +0000
commit60b5da1c83d602f2c5a83a40db7ad2dde446e56a (patch)
tree822a9d77eea611810b5ec03eed5ad86630e1d279
parent727fa7ac44ee8138509711a0a126e4fdc8ca9f3b (diff)
parent57a623bc7084b33ae3a78215ba5489af0e1bc782 (diff)
downloadplatform_packages_apps_Car_Dialer-android10-mainline-resolv-release.tar.gz
platform_packages_apps_Car_Dialer-android10-mainline-resolv-release.tar.bz2
platform_packages_apps_Car_Dialer-android10-mainline-resolv-release.zip
Snap for 6001391 from 57a623bc7084b33ae3a78215ba5489af0e1bc782 to qt-aml-resolv-releaseandroid10-mainline-resolv-release
Change-Id: I5ec6eb6399541cd41cb0fc19c71181e5979f0776
-rw-r--r--res/layout/keypad_button.xml14
-rw-r--r--res/values/strings.xml16
-rw-r--r--res/values/styles.xml10
-rw-r--r--src/com/android/car/dialer/notification/MissedCallNotificationController.java28
4 files changed, 45 insertions, 23 deletions
diff --git a/res/layout/keypad_button.xml b/res/layout/keypad_button.xml
index ac1c793a..b8a32ae1 100644
--- a/res/layout/keypad_button.xml
+++ b/res/layout/keypad_button.xml
@@ -23,25 +23,19 @@ limitations under the License.
<TextView
android:id="@+id/keypad_number"
android:layout_gravity="center_horizontal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
android:visibility="gone"
- style="@style/KeypadNumber" />
+ style="@style/KeypadNumber"/>
<TextView
android:id="@+id/keypad_letters"
android:layout_gravity="center_horizontal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
android:textAllCaps="true"
android:visibility="gone"
- style="@style/KeypadLetter" />
+ style="@style/KeypadLetter"/>
<ImageView
android:id="@+id/keypad_image"
android:layout_gravity="center_horizontal"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:tint="@color/car_key2"
- android:visibility="gone" />
+ android:visibility="gone"
+ style="@style/KeypadImage"/>
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 23ecf128..3a610898 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -17,13 +17,16 @@
<!-- Name of the phone dialer application [CHAR LIMIT=30]-->
<string name="phone_app_name">Phone</string>
<!-- Full-screen error text for when the phone can not be used because Bluetooth isn't connected [CHAR LIMIT=NONE]-->
- <string name="no_hfp">To complete your call, first connect your phone to your car via Bluetooth.</string>
+ <string name="no_hfp">
+ To complete your call, first connect your phone to your car via Bluetooth.
+ </string>
<!-- Error text shown on the dialer facet when bluetooth is not supported -->
<string name="bluetooth_unavailable">Bluetooth is not available.</string>
<!-- Error text shown on the dialer facet for when bluetooth is disabled -->
<string name="bluetooth_disabled">To make or receive calls, turn Bluetooth on.</string>
<!-- Error text shown on the dialer facet for when bluetooth is not paired -->
- <string name="bluetooth_unpaired">To make or receive calls, pair your phone with the car.</string>
+ <string name="bluetooth_unpaired">To make or receive calls, pair your phone with the car.
+ </string>
<!-- Button text for connecting to Bluetooth [CHAR LIMIT=40] -->
<string name="connect_bluetooth_button_text">Connect to Bluetooth</string>
<!-- Button text for making emergency call [CHAR LIMIT=40] -->
@@ -33,7 +36,8 @@
<!-- Message informing user that the contact has already been deleted [CHAR LIMIT=120] -->
<string name="error_contact_deleted">This contact might have been deleted.</string>
<!-- Toast text when user has inputted an invalid phone number [CHAR LIMIT=NONE] -->
- <string name="error_invalid_phone_number">Can\'t dial this number. Check it and try again.</string>
+ <string name="error_invalid_phone_number">Can\'t dial this number. Check it and try again.
+ </string>
<!-- Toast text when telephony service is not ready [CHAR LIMIT=NONE] -->
<string name="error_telephony_not_available">
Phone call is not available. Please try again later.
@@ -147,7 +151,11 @@
<!-- 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]-->
- <string name="notification_missed_call">Missed call</string>
+ <plurals name="notification_missed_call">
+ <item quantity="one">Missed call</item>
+ <item quantity="other">Missed calls(<xliff:g id="number" example="2">%1$d</xliff:g>)
+ </item>
+ </plurals>
<!-- Onhold User Profile Info -->
<!-- Text to show the call is onhold [CHAR LIMIT=40]-->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ac49ed15..daab8dea 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -23,15 +23,25 @@
<style name="TextAppearance.DialpadDisplayName" parent="@style/TextAppearance.Body1"/>
<style name="KeypadNumber">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
<item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
<item name="android:textSize">@dimen/car_key1_size</item>
</style>
<style name="KeypadLetter">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
<item name="android:textSize">@dimen/car_key2_size</item>
</style>
+ <style name="KeypadImage">
+ <item name="android:layout_width">32dp</item>
+ <item name="android:layout_height">32dp</item>
+ <item name="android:tint">@color/car_key2</item>
+ </style>
+
<!-- Phone -->
<style name="KeypadButtonStyle">
<item name="android:clickable">true</item>
diff --git a/src/com/android/car/dialer/notification/MissedCallNotificationController.java b/src/com/android/car/dialer/notification/MissedCallNotificationController.java
index bcd577d2..5b0fd864 100644
--- a/src/com/android/car/dialer/notification/MissedCallNotificationController.java
+++ b/src/com/android/car/dialer/notification/MissedCallNotificationController.java
@@ -40,7 +40,9 @@ import com.android.car.telephony.common.PhoneCallLog;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.CompletableFuture;
/** Controller that manages the missed call notifications. */
@@ -93,7 +95,7 @@ public final class MissedCallNotificationController {
private final UnreadMissedCallLiveData mUnreadMissedCallLiveData;
private final Observer<List<PhoneCallLog>> mUnreadMissedCallObserver;
private final List<PhoneCallLog> mCurrentPhoneCallLogList;
- private CompletableFuture<Void> mUpdateNotificationFuture;
+ private final Map<String, CompletableFuture<Void>> mUpdateFutures;
@TargetApi(26)
private MissedCallNotificationController(Context context) {
@@ -109,6 +111,8 @@ public final class MissedCallNotificationController {
mUnreadMissedCallLiveData = UnreadMissedCallLiveData.newInstance(context);
mUnreadMissedCallObserver = this::updateNotifications;
mUnreadMissedCallLiveData.observeForever(mUnreadMissedCallObserver);
+
+ mUpdateFutures = new HashMap<>();
}
/**
@@ -134,18 +138,21 @@ public final class MissedCallNotificationController {
private void showMissedCallNotification(PhoneCallLog callLog) {
L.d(TAG, "show missed call notification %s", callLog);
- if (mUpdateNotificationFuture != null) {
- mUpdateNotificationFuture.cancel(true);
- }
String phoneNumber = callLog.getPhoneNumberString();
- mUpdateNotificationFuture = NotificationUtils.getDisplayNameAndRoundedAvatar(
+ String tag = getTag(callLog);
+ CompletableFuture<Void> updateFuture = mUpdateFutures.get(tag);
+ if (updateFuture != null) {
+ updateFuture.cancel(true);
+ }
+ updateFuture = NotificationUtils.getDisplayNameAndRoundedAvatar(
mContext, phoneNumber)
.thenAcceptAsync((pair) -> {
+ int callLogSize = callLog.getAllCallRecords().size();
Notification.Builder builder = new Notification.Builder(mContext, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_phone)
.setLargeIcon(pair.second)
- .setContentTitle(mContext.getString(R.string.notification_missed_call)
- + String.format(" (%d)", callLog.getAllCallRecords().size()))
+ .setContentTitle(mContext.getResources().getQuantityString(
+ R.plurals.notification_missed_call, callLogSize, callLogSize))
.setContentText(pair.first)
.setContentIntent(getContentPendingIntent())
.setDeleteIntent(getDeleteIntent())
@@ -161,15 +168,18 @@ public final class MissedCallNotificationController {
}
mNotificationManager.notify(
- getTag(callLog),
+ tag,
NOTIFICATION_ID,
builder.build());
}, mContext.getMainExecutor());
+ mUpdateFutures.put(tag, updateFuture);
}
private void cancelMissedCallNotification(PhoneCallLog phoneCallLog) {
L.d(TAG, "cancel missed call notification %s", phoneCallLog);
- mNotificationManager.cancel(getTag(phoneCallLog), NOTIFICATION_ID);
+ String tag = getTag(phoneCallLog);
+ mNotificationManager.cancel(tag, NOTIFICATION_ID);
+ mUpdateFutures.remove(tag);
}
private PendingIntent getContentPendingIntent() {