summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/os/BatteryStats.java11
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java39
2 files changed, 22 insertions, 28 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index af45fa0..d3c6fd5 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -2443,8 +2443,10 @@ public abstract class BatteryStats implements Parcelable {
pw.print(prefix); pw.print(" Capacity: ");
printmAh(pw, helper.getPowerProfile().getBatteryCapacity());
pw.print(", Computed drain: "); printmAh(pw, helper.getComputedPower());
- pw.print(", Min drain: "); printmAh(pw, helper.getMinDrainedPower());
- pw.print(", Max drain: "); printmAh(pw, helper.getMaxDrainedPower());
+ pw.print(", actual drain: "); printmAh(pw, helper.getMinDrainedPower());
+ if (helper.getMinDrainedPower() != helper.getMaxDrainedPower()) {
+ pw.print("-"); printmAh(pw, helper.getMaxDrainedPower());
+ }
pw.println();
for (int i=0; i<sippers.size(); i++) {
BatterySipper bs = sippers.get(i);
@@ -3351,7 +3353,10 @@ public abstract class BatteryStats implements Parcelable {
}
hprinter.printNextItem(pw, rec, baseTime, checkin,
(flags&DUMP_VERBOSE) != 0);
- } else if (rec.eventCode != HistoryItem.EVENT_NONE) {
+ } else if (false && rec.eventCode != HistoryItem.EVENT_NONE) {
+ // This is an attempt to aggregate the previous state and generate
+ // fake events to reflect that state at the point where we start
+ // printing real events. It doesn't really work right, so is turned off.
if (tracker == null) {
tracker = new HistoryEventTracker();
}
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 24e55e4..ed9f9bc 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -2342,7 +2342,13 @@ public final class BatteryStatsImpl extends BatteryStats {
// Only care about partial wake locks, since full wake locks
// will be canceled when the user puts the screen to sleep.
aggregateLastWakeupUptimeLocked(uptime);
- historyName = historyName == null || mRecordAllWakeLocks ? name : historyName;
+ if (mRecordAllWakeLocks) {
+ if (mActiveEvents.updateState(HistoryItem.EVENT_WAKE_LOCK_START, name, uid, 0)) {
+ addHistoryEventLocked(elapsedRealtime, uptime,
+ HistoryItem.EVENT_WAKE_LOCK_START, name, uid);
+ }
+ }
+ historyName = historyName == null ? name : historyName;
if (mWakeLockNesting == 0) {
mHistoryCur.states |= HistoryItem.STATE_WAKE_LOCK_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Start wake lock to: "
@@ -2352,7 +2358,7 @@ public final class BatteryStatsImpl extends BatteryStats {
mHistoryCur.wakelockTag.uid = mInitialAcquireWakeUid = uid;
mWakeLockImportant = !unimportantForLogging;
addHistoryRecordLocked(elapsedRealtime, uptime);
- } else if (!mRecordAllWakeLocks && !mWakeLockImportant && !unimportantForLogging) {
+ } else if (!mWakeLockImportant && !unimportantForLogging) {
if (mHistoryLastWritten.wakelockTag != null) {
// We'll try to update the last tag.
mHistoryLastWritten.wakelockTag = null;
@@ -2362,14 +2368,6 @@ public final class BatteryStatsImpl extends BatteryStats {
addHistoryRecordLocked(elapsedRealtime, uptime);
}
mWakeLockImportant = true;
- } else if (mRecordAllWakeLocks) {
- if (mActiveEvents.updateState(HistoryItem.EVENT_WAKE_LOCK_START, historyName,
- uid, 0)) {
- mWakeLockNesting++;
- return;
- }
- addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_WAKE_LOCK_START,
- historyName, uid);
}
mWakeLockNesting++;
}
@@ -2387,28 +2385,19 @@ public final class BatteryStatsImpl extends BatteryStats {
uid = mapUid(uid);
if (type == WAKE_TYPE_PARTIAL) {
mWakeLockNesting--;
- historyName = historyName == null || mRecordAllWakeLocks ? name : historyName;
+ if (mRecordAllWakeLocks) {
+ if (mActiveEvents.updateState(HistoryItem.EVENT_WAKE_LOCK_FINISH, name, uid, 0)) {
+ addHistoryEventLocked(elapsedRealtime, uptime,
+ HistoryItem.EVENT_WAKE_LOCK_FINISH, name, uid);
+ }
+ }
if (mWakeLockNesting == 0) {
mHistoryCur.states &= ~HistoryItem.STATE_WAKE_LOCK_FLAG;
if (DEBUG_HISTORY) Slog.v(TAG, "Stop wake lock to: "
+ Integer.toHexString(mHistoryCur.states));
- if (mRecordAllWakeLocks
- || (historyName != null && !historyName.equals(mInitialAcquireWakeName))
- || uid != mInitialAcquireWakeUid) {
- mHistoryCur.wakelockTag = mHistoryCur.localWakelockTag;
- mHistoryCur.wakelockTag.string = historyName;
- mHistoryCur.wakelockTag.uid = uid;
- }
mInitialAcquireWakeName = null;
mInitialAcquireWakeUid = -1;
addHistoryRecordLocked(elapsedRealtime, uptime);
- } else if (mRecordAllWakeLocks) {
- if (mActiveEvents.updateState(HistoryItem.EVENT_WAKE_LOCK_FINISH, historyName,
- uid, 0)) {
- return;
- }
- addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_WAKE_LOCK_FINISH,
- historyName, uid);
}
}
if (uid >= 0) {