Various proc stats UI improvements.
- Option to include system processes. - Option to use uss instead of pss sizes. - Option to select type of stats: background processes, foreground (top) processes, cached processes. - Details now shows max mem usage. Change-Id: Ic994564ce846bc1021bf35576feeb9ef095b0e48
This commit is contained in:
@@ -340,7 +340,7 @@ public class BatteryHistoryChart extends View {
|
||||
long uSecTime = mStats.computeBatteryRealtime(SystemClock.elapsedRealtime() * 1000,
|
||||
BatteryStats.STATS_SINCE_CHARGED);
|
||||
mStatsPeriod = uSecTime;
|
||||
String durationString = Utils.formatElapsedTime(getContext(), mStatsPeriod / 1000);
|
||||
String durationString = Utils.formatElapsedTime(getContext(), mStatsPeriod / 1000, true);
|
||||
mDurationString = getContext().getString(R.string.battery_stats_on_battery,
|
||||
durationString);
|
||||
mChargingLabel = getContext().getString(R.string.battery_stats_charging_label);
|
||||
@@ -382,7 +382,7 @@ public class BatteryHistoryChart extends View {
|
||||
mHavePhoneSignal = true;
|
||||
}
|
||||
if (mHistEnd <= mHistStart) mHistEnd = mHistStart+1;
|
||||
mTotalDurationString = Utils.formatElapsedTime(getContext(), mHistEnd - mHistStart);
|
||||
mTotalDurationString = Utils.formatElapsedTime(getContext(), mHistEnd - mHistStart, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -333,7 +333,7 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener
|
||||
mUsesGps = true;
|
||||
// Fall through
|
||||
default:
|
||||
value = Utils.formatElapsedTime(getActivity(), mValues[i]);
|
||||
value = Utils.formatElapsedTime(getActivity(), mValues[i], true);
|
||||
}
|
||||
ViewGroup item = (ViewGroup) inflater.inflate(R.layout.power_usage_detail_item_text,
|
||||
null);
|
||||
|
@@ -35,9 +35,13 @@ public class Utils {
|
||||
* @param millis the elapsed time in milli seconds
|
||||
* @return the formatted elapsed time
|
||||
*/
|
||||
public static String formatElapsedTime(Context context, double millis) {
|
||||
public static String formatElapsedTime(Context context, double millis, boolean inclSeconds) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int seconds = (int) Math.floor(millis / 1000);
|
||||
if (!inclSeconds) {
|
||||
// Round up.
|
||||
seconds += 30;
|
||||
}
|
||||
|
||||
int days = 0, hours = 0, minutes = 0;
|
||||
if (seconds > SECONDS_PER_DAY) {
|
||||
@@ -52,15 +56,28 @@ public class Utils {
|
||||
minutes = seconds / SECONDS_PER_MINUTE;
|
||||
seconds -= minutes * SECONDS_PER_MINUTE;
|
||||
}
|
||||
if (days > 0) {
|
||||
sb.append(context.getString(R.string.battery_history_days,
|
||||
days, hours, minutes, seconds));
|
||||
} else if (hours > 0) {
|
||||
sb.append(context.getString(R.string.battery_history_hours, hours, minutes, seconds));
|
||||
} else if (minutes > 0) {
|
||||
sb.append(context.getString(R.string.battery_history_minutes, minutes, seconds));
|
||||
if (inclSeconds) {
|
||||
if (days > 0) {
|
||||
sb.append(context.getString(R.string.battery_history_days,
|
||||
days, hours, minutes, seconds));
|
||||
} else if (hours > 0) {
|
||||
sb.append(context.getString(R.string.battery_history_hours,
|
||||
hours, minutes, seconds));
|
||||
} else if (minutes > 0) {
|
||||
sb.append(context.getString(R.string.battery_history_minutes, minutes, seconds));
|
||||
} else {
|
||||
sb.append(context.getString(R.string.battery_history_seconds, seconds));
|
||||
}
|
||||
} else {
|
||||
sb.append(context.getString(R.string.battery_history_seconds, seconds));
|
||||
if (days > 0) {
|
||||
sb.append(context.getString(R.string.battery_history_days_no_seconds,
|
||||
days, hours, minutes));
|
||||
} else if (hours > 0) {
|
||||
sb.append(context.getString(R.string.battery_history_hours_no_seconds,
|
||||
hours, minutes));
|
||||
} else {
|
||||
sb.append(context.getString(R.string.battery_history_minutes_no_seconds, minutes));
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user