summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-12-09 00:59:01 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-12-09 00:59:01 +0000
commit9b07ba19908aa5c75d9f8d13e27995f7e10d8e38 (patch)
tree57af0f3a58f68b3d44a16209b3a11c17905eecf8 /core/java/android
parent3de2fd483c1eae4b77bb52b9cd900b6c2563a505 (diff)
parent0cfdd810ded6f8486a6b0a61044594f58ab5c052 (diff)
downloadframeworks_base-9b07ba19908aa5c75d9f8d13e27995f7e10d8e38.zip
frameworks_base-9b07ba19908aa5c75d9f8d13e27995f7e10d8e38.tar.gz
frameworks_base-9b07ba19908aa5c75d9f8d13e27995f7e10d8e38.tar.bz2
am 0cfdd810: am e52a2ea0: am 0029f0ac: Merge "Fix issue #17323751: Additional items in aggregated battery stats" into lmp-mr1-dev
* commit '0cfdd810ded6f8486a6b0a61044594f58ab5c052': Fix issue #17323751: Additional items in aggregated battery stats
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/BatteryStats.java70
-rw-r--r--core/java/android/util/Log.java5
-rw-r--r--core/java/android/util/Slog.java7
3 files changed, 72 insertions, 10 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 11fc69e..5fd697a 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -459,6 +459,20 @@ public abstract class BatteryStats implements Parcelable {
public abstract int getStarts(int which);
/**
+ * Returns the number of times the process has crashed.
+ *
+ * @param which one of STATS_SINCE_CHARGED, STATS_SINCE_UNPLUGGED, or STATS_CURRENT.
+ */
+ public abstract int getNumCrashes(int which);
+
+ /**
+ * Returns the number of times the process has ANRed.
+ *
+ * @param which one of STATS_SINCE_CHARGED, STATS_SINCE_UNPLUGGED, or STATS_CURRENT.
+ */
+ public abstract int getNumAnrs(int which);
+
+ /**
* Returns the cpu time spent in microseconds while the process was in the foreground.
* @param which one of STATS_SINCE_CHARGED, STATS_SINCE_UNPLUGGED, or STATS_CURRENT.
* @return foreground cpu time in microseconds
@@ -694,8 +708,10 @@ public abstract class BatteryStats implements Parcelable {
public static final int EVENT_USER_RUNNING = 0x0007;
// Events for foreground user.
public static final int EVENT_USER_FOREGROUND = 0x0008;
+ // Events for connectivity changed.
+ public static final int EVENT_CONNECTIVITY_CHANGED = 0x0009;
// Number of event types.
- public static final int EVENT_COUNT = 0x0009;
+ public static final int EVENT_COUNT = 0x000a;
// Mask to extract out only the type part of the event.
public static final int EVENT_TYPE_MASK = ~(EVENT_FLAG_START|EVENT_FLAG_FINISH);
@@ -1107,6 +1123,13 @@ public abstract class BatteryStats implements Parcelable {
public abstract int getLowPowerModeEnabledCount(int which);
/**
+ * Returns the number of times that connectivity state changed.
+ *
+ * {@hide}
+ */
+ public abstract int getNumConnectivityChange(int which);
+
+ /**
* Returns the time in microseconds that the phone has been on while the device was
* running on battery.
*
@@ -1306,11 +1329,11 @@ public abstract class BatteryStats implements Parcelable {
};
public static final String[] HISTORY_EVENT_NAMES = new String[] {
- "null", "proc", "fg", "top", "sync", "wake_lock_in", "job", "user", "userfg"
+ "null", "proc", "fg", "top", "sync", "wake_lock_in", "job", "user", "userfg", "conn"
};
public static final String[] HISTORY_EVENT_CHECKIN_NAMES = new String[] {
- "Enl", "Epr", "Efg", "Etp", "Esy", "Ewl", "Ejb", "Eur", "Euf"
+ "Enl", "Epr", "Efg", "Etp", "Esy", "Ewl", "Ejb", "Eur", "Euf", "Ecn"
};
/**
@@ -1871,6 +1894,7 @@ public abstract class BatteryStats implements Parcelable {
final long screenOnTime = getScreenOnTime(rawRealtime, which);
final long interactiveTime = getInteractiveTime(rawRealtime, which);
final long lowPowerModeEnabledTime = getLowPowerModeEnabledTime(rawRealtime, which);
+ final int connChanges = getNumConnectivityChange(which);
final long phoneOnTime = getPhoneOnTime(rawRealtime, which);
final long wifiOnTime = getWifiOnTime(rawRealtime, which);
final long wifiRunningTime = getGlobalWifiRunningTime(rawRealtime, which);
@@ -1941,7 +1965,7 @@ public abstract class BatteryStats implements Parcelable {
fullWakeLockTimeTotal / 1000, partialWakeLockTimeTotal / 1000,
0 /*legacy input event count*/, getMobileRadioActiveTime(rawRealtime, which) / 1000,
getMobileRadioActiveAdjustedTime(which) / 1000, interactiveTime / 1000,
- lowPowerModeEnabledTime / 1000);
+ lowPowerModeEnabledTime / 1000, connChanges);
// Dump screen brightness stats
Object[] args = new Object[NUM_SCREEN_BRIGHTNESS_BINS];
@@ -2271,12 +2295,14 @@ public abstract class BatteryStats implements Parcelable {
final long userMillis = ps.getUserTime(which) * 10;
final long systemMillis = ps.getSystemTime(which) * 10;
final long foregroundMillis = ps.getForegroundTime(which) * 10;
- final long starts = ps.getStarts(which);
+ final int starts = ps.getStarts(which);
+ final int numCrashes = ps.getNumCrashes(which);
+ final int numAnrs = ps.getNumAnrs(which);
if (userMillis != 0 || systemMillis != 0 || foregroundMillis != 0
- || starts != 0) {
+ || starts != 0 || numAnrs != 0 || numCrashes != 0) {
dumpLine(pw, uid, category, PROCESS_DATA, ent.getKey(), userMillis,
- systemMillis, foregroundMillis, starts);
+ systemMillis, foregroundMillis, starts, numAnrs, numCrashes);
}
}
}
@@ -2457,6 +2483,11 @@ public abstract class BatteryStats implements Parcelable {
sb.append("("); sb.append(formatRatioLocked(phoneOnTime, whichBatteryRealtime));
sb.append(") "); sb.append(getPhoneOnCount(which));
}
+ int connChanges = getNumConnectivityChange(which);
+ if (connChanges != 0) {
+ pw.print(prefix);
+ pw.print(" Connectivity changes: "); pw.println(connChanges);
+ }
// Calculate wakelock times across all uids.
long fullWakeLockTimeTotalMicros = 0;
@@ -3273,11 +3304,13 @@ public abstract class BatteryStats implements Parcelable {
systemTime = ps.getSystemTime(which);
foregroundTime = ps.getForegroundTime(which);
starts = ps.getStarts(which);
+ final int numCrashes = ps.getNumCrashes(which);
+ final int numAnrs = ps.getNumAnrs(which);
numExcessive = which == STATS_SINCE_CHARGED
? ps.countExcessivePowers() : 0;
if (userTime != 0 || systemTime != 0 || foregroundTime != 0 || starts != 0
- || numExcessive != 0) {
+ || numExcessive != 0 || numCrashes != 0 || numAnrs != 0) {
sb.setLength(0);
sb.append(prefix); sb.append(" Proc ");
sb.append(ent.getKey()); sb.append(":\n");
@@ -3285,9 +3318,26 @@ public abstract class BatteryStats implements Parcelable {
formatTime(sb, userTime); sb.append("usr + ");
formatTime(sb, systemTime); sb.append("krn ; ");
formatTime(sb, foregroundTime); sb.append("fg");
- if (starts != 0) {
+ if (starts != 0 || numCrashes != 0 || numAnrs != 0) {
sb.append("\n"); sb.append(prefix); sb.append(" ");
- sb.append(starts); sb.append(" proc starts");
+ boolean hasOne = false;
+ if (starts != 0) {
+ hasOne = true;
+ sb.append(starts); sb.append(" starts");
+ }
+ if (numCrashes != 0) {
+ if (hasOne) {
+ sb.append(", ");
+ }
+ hasOne = true;
+ sb.append(numCrashes); sb.append(" crashes");
+ }
+ if (numAnrs != 0) {
+ if (hasOne) {
+ sb.append(", ");
+ }
+ sb.append(numAnrs); sb.append(" anrs");
+ }
}
pw.println(sb.toString());
for (int e=0; e<numExcessive; e++) {
diff --git a/core/java/android/util/Log.java b/core/java/android/util/Log.java
index a9b3571..121485a 100644
--- a/core/java/android/util/Log.java
+++ b/core/java/android/util/Log.java
@@ -295,6 +295,11 @@ public final class Log {
return bytes;
}
+ static void wtfQuiet(int logId, String tag, String msg, boolean system) {
+ TerribleFailure what = new TerribleFailure(msg, null);
+ sWtfHandler.onTerribleFailure(tag, what, system);
+ }
+
/**
* Sets the terrible failure handler, for testing.
*
diff --git a/core/java/android/util/Slog.java b/core/java/android/util/Slog.java
index e92b846..58a2703 100644
--- a/core/java/android/util/Slog.java
+++ b/core/java/android/util/Slog.java
@@ -83,6 +83,13 @@ public final class Slog {
}
/**
+ * Like {@link #wtf(String, String)}, but does not output anything to the log.
+ */
+ public static void wtfQuiet(String tag, String msg) {
+ Log.wtfQuiet(Log.LOG_ID_SYSTEM, tag, msg, true);
+ }
+
+ /**
* Like {@link Log#wtfStack(String, String)}, but will never cause the caller to crash, and
* will always be handled asynchronously. Primarily for use by coding running within
* the system process.