diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 8abe30d..e3335b8 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -444,9 +444,13 @@
     }
 
     public static String getBatteryPercentage(Intent batteryChangedIntent) {
+        return String.valueOf(getBatteryLevel(batteryChangedIntent)) + "%";
+    }
+
+    public static int getBatteryLevel(Intent batteryChangedIntent) {
         int level = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
         int scale = batteryChangedIntent.getIntExtra(BatteryManager.EXTRA_SCALE, 100);
-        return String.valueOf(level * 100 / scale) + "%";
+        return (level * 100) / scale;
     }
 
     public static String getBatteryStatus(Resources res, Intent batteryChangedIntent) {
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
index 58471a3..da6729c 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
@@ -18,6 +18,7 @@
 
 import android.content.Intent;
 import android.os.BatteryManager;
+import android.text.format.Formatter;
 import com.android.settings.R;
 
 import android.content.Context;
@@ -413,24 +414,36 @@
         //mDurationString = getContext().getString(R.string.battery_stats_on_battery,
         //        durationString);
         mDurationString = Utils.formatElapsedTime(getContext(), mHistEnd - mHistStart, true);
-        mDrainString = com.android.settings.Utils.getBatteryPercentage(mBatteryBroadcast);
-        mChargeLabelString = com.android.settings.Utils.getBatteryStatus(getResources(),
-                mBatteryBroadcast);
-        final long drainTime = mStats.computeBatteryTimeRemaining(elapsedRealtimeUs);
-        final long chargeTime = mStats.computeChargeTimeRemaining(elapsedRealtimeUs);
+        int batteryLevel = com.android.settings.Utils.getBatteryLevel(mBatteryBroadcast);
         final int status = mBatteryBroadcast.getIntExtra(BatteryManager.EXTRA_STATUS,
                 BatteryManager.BATTERY_STATUS_UNKNOWN);
-        if (drainTime > 0) {
-            String timeString = Utils.formatShortElapsedTime(getContext(),drainTime / 1000);
-            mChargeDurationString = getContext().getResources().getString(
-                    R.string.power_discharge_remaining, timeString);
-        } else if (chargeTime > 0 && status != BatteryManager.BATTERY_STATUS_FULL) {
-            String timeString = Utils.formatShortElapsedTime(getContext(), chargeTime / 1000);
-            mChargeDurationString = getContext().getResources().getString(
-                    R.string.power_charge_remaining, timeString);
+        if (status == BatteryManager.BATTERY_STATUS_DISCHARGING) {
+            final long drainTime = mStats.computeBatteryTimeRemaining(elapsedRealtimeUs);
+            if (drainTime > 0) {
+                String timeString = Formatter.formatShortElapsedTime(getContext(),
+                        drainTime / 1000);
+                mChargeLabelString = getContext().getResources().getString(
+                        R.string.power_discharging_duration, batteryLevel, timeString);
+            } else {
+                mChargeLabelString = getContext().getResources().getString(
+                        R.string.power_discharging, batteryLevel);
+            }
         } else {
-            mChargeDurationString = "";
+            final long chargeTime = mStats.computeChargeTimeRemaining(elapsedRealtimeUs);
+            final String statusLabel = com.android.settings.Utils.getBatteryStatus(getResources(),
+                    mBatteryBroadcast);
+            if (chargeTime > 0 && status != BatteryManager.BATTERY_STATUS_FULL) {
+                String timeString = Formatter.formatShortElapsedTime(getContext(),
+                        chargeTime / 1000);
+                mChargeLabelString = getContext().getResources().getString(
+                        R.string.power_charging_duration, batteryLevel, statusLabel, timeString);
+            } else {
+                mChargeLabelString = getContext().getResources().getString(
+                        R.string.power_charging, batteryLevel, statusLabel);
+            }
         }
+        mDrainString = "";
+        mChargeDurationString = "";
     }
 
     @Override
diff --git a/src/com/android/settings/fuelgauge/Utils.java b/src/com/android/settings/fuelgauge/Utils.java
index c88b0d2..9a06c9f 100644
--- a/src/com/android/settings/fuelgauge/Utils.java
+++ b/src/com/android/settings/fuelgauge/Utils.java
@@ -81,45 +81,4 @@
         }
         return sb.toString();
     }
-
-    /**
-     * Returns elapsed time for the given millis, in the following format:
-     * 2d 5h; will include at most two units, can go down to seconds precision.
-     * @param context the application context
-     * @param millis the elapsed time in milli seconds
-     * @return the formatted elapsed time
-     */
-    public static String formatShortElapsedTime(Context context, double millis) {
-        int seconds = (int) Math.floor(millis / 1000);
-
-        int days = 0, hours = 0, minutes = 0;
-        if (seconds >= SECONDS_PER_DAY) {
-            days = seconds / SECONDS_PER_DAY;
-            seconds -= days * SECONDS_PER_DAY;
-        }
-        if (seconds >= SECONDS_PER_HOUR) {
-            hours = seconds / SECONDS_PER_HOUR;
-            seconds -= hours * SECONDS_PER_HOUR;
-        }
-        if (seconds >= SECONDS_PER_MINUTE) {
-            minutes = seconds / SECONDS_PER_MINUTE;
-            seconds -= minutes * SECONDS_PER_MINUTE;
-        }
-        if (days >= 4) {
-            return context.getString(R.string.battery_history_days_only, days);
-        } else if (days > 0) {
-            return context.getString(R.string.battery_history_days_and_hours, days, hours);
-        } else if (hours >= 12) {
-            return context.getString(R.string.battery_history_hours_only, hours);
-        } else if (hours > 0) {
-            return context.getString(R.string.battery_history_hours_and_minutes, hours, minutes);
-        } else if (minutes >= 10) {
-            return context.getString(R.string.battery_history_minutes_only, minutes);
-        } else if (minutes > 0) {
-            return context.getString(R.string.battery_history_minutes_and_seconds, minutes,
-                    seconds);
-        } else {
-            return context.getString(R.string.battery_history_seconds, seconds);
-        }
-    }
 }
