summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2016-01-15 02:29:16 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-01-15 02:29:16 +0000
commit23c2caf77bf64bd056961741dd1513c79a7eac2c (patch)
tree86e45ea6c01d7d6bdded00136f6993f648001c47 /src
parentc9287203c9013fd20826aab1b5e5f0e547c05b1b (diff)
parent201e021fe24e36ae2d94eadd4701933dd099d309 (diff)
Merge "Use telephony voicemail notification settings for vvm." into ub-contactsdialer-b-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/DefaultVoicemailNotifier.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
index 2b894a12d..d0156cf7f 100644
--- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
+++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
@@ -24,6 +24,7 @@ import com.google.common.collect.Maps;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
+import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
@@ -33,6 +34,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.PhoneLookup;
+import android.telecom.PhoneAccountHandle;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;
@@ -194,13 +196,26 @@ public class DefaultVoicemailNotifier {
// TODO: Use the photo of contact if all calls are from the same person.
final int icon = android.R.drawable.stat_notify_voicemail;
+ Uri ringtoneUri = null;
+ int notificationDefaults = 0;
+ if (callToNotify != null) {
+ PhoneAccountHandle accountHandle = new PhoneAccountHandle(
+ ComponentName.unflattenFromString(callToNotify.accountComponentName),
+ callToNotify.accountId);
+ ringtoneUri = VoicemailNotificationSettingsLookup
+ .getVoicemailRingtoneUri(mContext, accountHandle);
+ notificationDefaults = VoicemailNotificationSettingsLookup
+ .getNotificationDefaults(mContext, accountHandle);
+ }
+
Notification.Builder notificationBuilder = new Notification.Builder(mContext)
.setSmallIcon(icon)
.setContentTitle(title)
.setContentText(callers)
.setStyle(new Notification.BigTextStyle().bigText(transcription))
.setColor(resources.getColor(R.color.dialer_theme_color))
- .setDefaults(callToNotify != null ? Notification.DEFAULT_ALL : 0)
+ .setSound(ringtoneUri)
+ .setDefaults(notificationDefaults)
.setDeleteIntent(createMarkNewVoicemailsAsOldIntent())
.setAutoCancel(true);