summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-05-16 19:42:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-16 19:42:54 +0000
commit3fce73a866e58232b484ca26b58b1394b0121b6a (patch)
treeffd76ccf10d7ea1ca639a71c80764a724165bc45 /core
parent891e65c5ceff6a7859afab34f75f149b3aefa0c6 (diff)
parent9a7554300637902bbb25991ffba41a9b8f682eff (diff)
downloadframeworks_base-3fce73a866e58232b484ca26b58b1394b0121b6a.zip
frameworks_base-3fce73a866e58232b484ca26b58b1394b0121b6a.tar.gz
frameworks_base-3fce73a866e58232b484ca26b58b1394b0121b6a.tar.bz2
Merge "Fix recording of wake_lock_in."
Diffstat (limited to 'core')
-rw-r--r--core/java/android/os/BatteryStats.java5
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java18
2 files changed, 15 insertions, 8 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index cf0caed..af45fa0 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -531,7 +531,8 @@ public abstract class BatteryStats implements Parcelable {
public final static class HistoryItem implements Parcelable {
public HistoryItem next;
-
+
+ // The time of this event in milliseconds, as per SystemClock.elapsedRealtime().
public long time;
public static final byte CMD_UPDATE = 0; // These can be written as deltas
@@ -645,7 +646,7 @@ public abstract class BatteryStats implements Parcelable {
public int eventCode;
public HistoryTag eventTag;
- // Only set for CMD_CURRENT_TIME.
+ // Only set for CMD_CURRENT_TIME or CMD_RESET, as per System.currentTimeMillis().
public long currentTime;
// Meta-data when reading.
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 956c86d..8428f66 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -235,7 +235,8 @@ public final class BatteryStatsImpl extends BatteryStats {
int mWakeLockNesting;
boolean mWakeLockImportant;
- public boolean mRecordAllWakeLocks;
+ boolean mRecordAllWakeLocks;
+ boolean mNoAutoReset;
int mScreenState = Display.STATE_UNKNOWN;
StopwatchTimer mScreenOnTimer;
@@ -2314,9 +2315,6 @@ public final class BatteryStatsImpl extends BatteryStats {
}
}
- private String mInitialAcquireWakeName;
- private int mInitialAcquireWakeUid = -1;
-
public void setRecordAllWakeLocksLocked(boolean enabled) {
mRecordAllWakeLocks = enabled;
if (!enabled) {
@@ -2325,6 +2323,13 @@ public final class BatteryStatsImpl extends BatteryStats {
}
}
+ public void setNoAutoReset(boolean enabled) {
+ mNoAutoReset = enabled;
+ }
+
+ private String mInitialAcquireWakeName;
+ private int mInitialAcquireWakeUid = -1;
+
public void noteStartWakeLocked(int uid, int pid, String name, String historyName, int type,
boolean unimportantForLogging, long elapsedRealtime, long uptime) {
uid = mapUid(uid);
@@ -2355,6 +2360,7 @@ public final class BatteryStatsImpl extends BatteryStats {
} else if (mRecordAllWakeLocks) {
if (mActiveEvents.updateState(HistoryItem.EVENT_WAKE_LOCK_START, historyName,
uid, 0)) {
+ mWakeLockNesting++;
return;
}
addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_WAKE_LOCK_START,
@@ -5942,9 +5948,9 @@ public final class BatteryStatsImpl extends BatteryStats {
// we have gone through a significant charge (from a very low
// level to a now very high level).
boolean reset = false;
- if (oldStatus == BatteryManager.BATTERY_STATUS_FULL
+ if (!mNoAutoReset && (oldStatus == BatteryManager.BATTERY_STATUS_FULL
|| level >= 90
- || (mDischargeCurrentLevel < 20 && level >= 80)) {
+ || (mDischargeCurrentLevel < 20 && level >= 80))) {
doWrite = true;
resetAllStatsLocked();
mDischargeStartLevel = level;