Support CDMA emergency callback. (1/2)

1. Update emergency callback mode notification icon and update creation of
the notification to use a builder.
2. For CDMA calls, if phone is in ECM mode, disable mute in the
Connection PhoneCapabilities.

Bug: 16182748
Change-Id: I698eb7d377346467fc4b87a0bec53d89f96797b1
diff --git a/src/com/android/phone/EmergencyCallbackModeExitDialog.java b/src/com/android/phone/EmergencyCallbackModeExitDialog.java
index 7758b23..921b7f7 100644
--- a/src/com/android/phone/EmergencyCallbackModeExitDialog.java
+++ b/src/com/android/phone/EmergencyCallbackModeExitDialog.java
@@ -205,7 +205,7 @@
         case EXIT_ECM_DIALOG:
             CharSequence text = getDialogText(mEcmTimeout);
             mAlertDialog = new AlertDialog.Builder(EmergencyCallbackModeExitDialog.this)
-                    .setIcon(R.drawable.picture_emergency32x32)
+                    .setIcon(R.drawable.ic_emergency_callback_mode)
                     .setTitle(R.string.phone_in_ecm_notification_title)
                     .setMessage(text)
                     .setPositiveButton(R.string.alert_dialog_yes,
@@ -233,7 +233,7 @@
 
         case EXIT_ECM_IN_EMERGENCY_CALL_DIALOG:
             mAlertDialog = new AlertDialog.Builder(EmergencyCallbackModeExitDialog.this)
-                    .setIcon(R.drawable.picture_emergency32x32)
+                    .setIcon(R.drawable.ic_emergency_callback_mode)
                     .setTitle(R.string.phone_in_ecm_notification_title)
                     .setMessage(R.string.alert_dialog_in_ecm_call)
                     .setNeutralButton(R.string.alert_dialog_dismiss,
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index 5309eaf..e1f7fb3 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -25,6 +25,7 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.res.Resources;
+import android.graphics.BitmapFactory;
 import android.os.AsyncResult;
 import android.os.Binder;
 import android.os.CountDownTimer;
@@ -163,16 +164,19 @@
      * Shows notification for Emergency Callback Mode
      */
     private void showNotification(long millisUntilFinished) {
-
-        // Set the icon and text
-        Notification notification = new Notification(
-                R.drawable.picture_emergency25x25,
-                getText(R.string.phone_entered_ecm_text), 0);
+        final Notification.Builder builder = new Notification.Builder(getApplicationContext());
+        builder.setOngoing(true);
+        builder.setPriority(Notification.PRIORITY_HIGH);
+        builder.setSmallIcon(R.drawable.ic_emergency_callback_mode);
+        builder.setTicker(getText(R.string.phone_entered_ecm_text));
+        builder.setContentTitle(getText(R.string.phone_in_ecm_notification_title));
+        builder.setColor(getResources().getColor(R.color.dialer_theme_color));
 
         // PendingIntent to launch Emergency Callback Mode Exit activity if the user selects
         // this notification
         PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                 new Intent(EmergencyCallbackModeExitDialog.ACTION_SHOW_ECM_EXIT_DIALOG), 0);
+        builder.setContentIntent(contentIntent);
 
         // Format notification string
         String text = null;
@@ -184,14 +188,10 @@
             text = String.format(getResources().getQuantityText(
                      R.plurals.phone_in_ecm_notification_time, minutes).toString(), time);
         }
-        // Set the info in the notification
-        notification.setLatestEventInfo(this, getText(R.string.phone_in_ecm_notification_title),
-                text, contentIntent);
-
-        notification.flags = Notification.FLAG_ONGOING_EVENT;
+        builder.setContentText(text);
 
         // Show notification
-        mNotificationManager.notify(R.string.phone_in_ecm_notification_title, notification);
+        mNotificationManager.notify(R.string.phone_in_ecm_notification_title, builder.build());
     }
 
     /**