Allow voicemail notification dismissal to be configurable.
If a device/carrier allows it, a voicemail notification in the
notification bar should be dismissable. Note that this change does not
wipe the notification completely, i.e. it will come back if the user
restarts the phone.
Add configuration values relevant to Verizon for non-dismissable
notifications.
Bug: 7888110
Change-Id: I7af4a610fb2ba330633157abcc59f8940372fd85
diff --git a/res/values-mcc310-mnc004/config.xml b/res/values-mcc310-mnc004/config.xml
index bbe9e7b..198e65f 100755
--- a/res/values-mcc310-mnc004/config.xml
+++ b/res/values-mcc310-mnc004/config.xml
@@ -19,4 +19,7 @@
<resources>
<!-- Flag indicating if dtmf tone type is enabled -->
<bool name="support_swap_after_merge" translatable="false">false</bool>
+ <!-- Determine whether the voicemail notification is persistent in the notification bar.
+ If true, the voicemail notifications cannot be dismissed from the notification bar. -->
+ <bool name="voicemail_notification_persistent">true</bool>
</resources>
diff --git a/res/values-mcc310-mnc120/config.xml b/res/values-mcc310-mnc120/config.xml
index 7c269e0..93a8079 100644
--- a/res/values-mcc310-mnc120/config.xml
+++ b/res/values-mcc310-mnc120/config.xml
@@ -19,4 +19,7 @@
<resources>
<!-- Flag indicating if dtmf tone type is enabled -->
<bool name="dtmf_type_enabled">true</bool>
+ <!-- Determine whether the voicemail notification is persistent in the notification bar.
+ If true, the voicemail notifications cannot be dismissed from the notification bar. -->
+ <bool name="voicemail_notification_persistent">true</bool>
</resources>
diff --git a/res/values-mcc311-mnc480/config.xml b/res/values-mcc311-mnc480/config.xml
index df95aa4..5cae0bc 100755
--- a/res/values-mcc311-mnc480/config.xml
+++ b/res/values-mcc311-mnc480/config.xml
@@ -20,4 +20,7 @@
<!-- Flag indicating if dtmf tone type is enabled -->
<bool name="dtmf_type_enabled">true</bool>
<bool name="support_swap_after_merge" translatable="false">false</bool>
+ <!-- Determine whether the voicemail notification is persistent in the notification bar.
+ If true, the voicemail notifications cannot be dismissed from the notification bar. -->
+ <bool name="voicemail_notification_persistent">true</bool>
</resources>
diff --git a/res/values-mcc311-mnc490/config.xml b/res/values-mcc311-mnc490/config.xml
index 7c269e0..93a8079 100644
--- a/res/values-mcc311-mnc490/config.xml
+++ b/res/values-mcc311-mnc490/config.xml
@@ -19,4 +19,7 @@
<resources>
<!-- Flag indicating if dtmf tone type is enabled -->
<bool name="dtmf_type_enabled">true</bool>
+ <!-- Determine whether the voicemail notification is persistent in the notification bar.
+ If true, the voicemail notifications cannot be dismissed from the notification bar. -->
+ <bool name="voicemail_notification_persistent">true</bool>
</resources>
diff --git a/res/values/config.xml b/res/values/config.xml
index 881762d..b7e3208 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -152,4 +152,8 @@
<!-- After a CDMA conference call is merged, the swap button should be displayed. -->
<bool name="support_swap_after_merge" translatable="false">true</bool>
+
+ <!-- Determine whether the voicemail notification is persistent in the notification bar.
+ If true, the voicemail notifications cannot be dismissed from the notification bar. -->
+ <bool name="voicemail_notification_persistent">false</bool>
</resources>
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index c38be71..d308a28 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -25,6 +25,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.UserInfo;
+import android.content.res.Resources;
import android.net.Uri;
import android.os.SystemProperties;
import android.os.UserHandle;
@@ -383,6 +384,7 @@
ringtoneUri = VoicemailNotificationSettingsUtil.getRingtoneUri(mPhone);
}
+ Resources res = mContext.getResources();
Notification.Builder builder = new Notification.Builder(mContext);
builder.setSmallIcon(resId)
.setWhen(System.currentTimeMillis())
@@ -391,8 +393,8 @@
.setContentText(notificationText)
.setContentIntent(pendingIntent)
.setSound(ringtoneUri)
- .setColor(mContext.getResources().getColor(R.color.dialer_theme_color))
- .setOngoing(true);
+ .setColor(res.getColor(R.color.dialer_theme_color))
+ .setOngoing(res.getBoolean(R.bool.voicemail_notification_persistent));
if (VoicemailNotificationSettingsUtil.isVibrationEnabled(phone)) {
builder.setDefaults(Notification.DEFAULT_VIBRATE);