Merge "getStreamingServices for Embms"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3108cfe..972af37 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1185,12 +1185,8 @@
     <string name="phone_in_ecm_notification_title">Emergency Callback Mode</string>
     <!-- ECM: Notification body -->
     <string name="phone_in_ecm_call_notification_text">Data connection disabled</string>
-    <plurals name="phone_in_ecm_notification_time">
-        <!-- number of minutes is one -->
-        <item quantity="one">No data connection for <xliff:g id="count">%s</xliff:g> minute</item>
-        <!-- number of minutes is not equal to one -->
-        <item quantity="other">No data connection for <xliff:g id="count">%s</xliff:g> minutes</item>
-    </plurals>
+    <!-- ECM: Displays the time when ECM will end, Example: "No Data Connection until 10:45 AM" -->
+    <string name="phone_in_ecm_notification_complete_time">No data connection until <xliff:g id="completeTime">%s</xliff:g></string>
     <!-- ECM: Dialog box message for exiting from the notifications screen -->
     <plurals name="alert_dialog_exit_ecm">
         <!-- number of minutes is one -->
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index 9ed38ae..ce50d82 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -41,6 +41,8 @@
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.internal.telephony.TelephonyProperties;
 
+import java.text.SimpleDateFormat;
+
 /**
  * Application service that inserts/removes Emergency Callback Mode notification and
  * updates Emergency Callback Mode countdown clock in the notification
@@ -154,7 +156,6 @@
                 @Override
                 public void onTick(long millisUntilFinished) {
                     mTimeLeft = millisUntilFinished;
-                    EmergencyCallbackModeService.this.showNotification(millisUntilFinished);
                 }
 
                 @Override
@@ -199,10 +200,17 @@
         if(mInEmergencyCall) {
             text = getText(R.string.phone_in_ecm_call_notification_text).toString();
         } else {
-            int minutes = (int)(millisUntilFinished / 60000);
-            String time = String.format("%d:%02d", minutes, (millisUntilFinished % 60000) / 1000);
-            text = String.format(getResources().getQuantityText(
-                     R.plurals.phone_in_ecm_notification_time, minutes).toString(), time);
+            // Calculate the time in ms when the notification will be finished.
+            long finishedCountMs = millisUntilFinished + System.currentTimeMillis();
+            builder.setShowWhen(true);
+            builder.setChronometerCountDown(true);
+            builder.setUsesChronometer(true);
+            builder.setWhen(finishedCountMs);
+
+            String completeTime = SimpleDateFormat.getTimeInstance(SimpleDateFormat.SHORT).format(
+                    finishedCountMs);
+            text = getResources().getString(R.string.phone_in_ecm_notification_complete_time,
+                    completeTime);
         }
         builder.setContentText(text);
 
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index a5f9c07..0ff3e5d 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -57,6 +57,7 @@
 import android.telephony.RadioAccessFamily;
 import android.telephony.ServiceState;
 import android.telephony.SmsManager;
+import android.telephony.SignalStrength;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyHistogram;
@@ -3727,4 +3728,21 @@
             return false;
         }
     }
+
+    /**
+     * Get the current signal strength information for the given subscription.
+     * Because this information is not updated when the device is in a low power state
+     * it should not be relied-upon to be current.
+     * @param subId Subscription index
+     * @return the most recent cached signal strength info from the modem
+     */
+    @Override
+    public SignalStrength getSignalStrength(int subId) {
+        Phone p = getPhone(subId);
+        if (p == null) {
+            return null;
+        }
+
+        return p.getSignalStrength();
+    }
 }