Loading core/java/android/content/SyncManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -990,8 +990,8 @@ public class SyncManager implements OnAccountsUpdateListener { mBound = false; mContext.unbindService(this); } mSyncWakeLock.setWorkSource(null); mSyncWakeLock.release(); mSyncWakeLock.setWorkSource(null); } @Override Loading core/java/android/os/BatteryStats.java +51 −3 Original line number Diff line number Diff line Loading @@ -1095,6 +1095,16 @@ public abstract class BatteryStats implements Parcelable { } } private static long computeWakeLock(Timer timer, long batteryRealtime, int which) { if (timer != null) { // Convert from microseconds to milliseconds with rounding long totalTimeMicros = timer.getTotalTimeLocked(batteryRealtime, which); long totalTimeMillis = (totalTimeMicros + 500) / 1000; return totalTimeMillis; } return 0; } /** * * @param sb a StringBuilder object. Loading @@ -1109,9 +1119,7 @@ public abstract class BatteryStats implements Parcelable { long batteryRealtime, String name, int which, String linePrefix) { if (timer != null) { // Convert from microseconds to milliseconds with rounding long totalTimeMicros = timer.getTotalTimeLocked(batteryRealtime, which); long totalTimeMillis = (totalTimeMicros + 500) / 1000; long totalTimeMillis = computeWakeLock(timer, batteryRealtime, which); int count = timer.getCountLocked(which); if (totalTimeMillis != 0) { Loading Loading @@ -1735,6 +1743,8 @@ public abstract class BatteryStats implements Parcelable { Map<String, ? extends BatteryStats.Uid.Wakelock> wakelocks = u.getWakelockStats(); if (wakelocks.size() > 0) { long totalFull = 0, totalPartial = 0, totalWindow = 0; int count = 0; for (Map.Entry<String, ? extends BatteryStats.Uid.Wakelock> ent : wakelocks.entrySet()) { Uid.Wakelock wl = ent.getValue(); Loading @@ -1754,6 +1764,44 @@ public abstract class BatteryStats implements Parcelable { // Only print out wake locks that were held pw.println(sb.toString()); uidActivity = true; count++; } totalFull += computeWakeLock(wl.getWakeTime(WAKE_TYPE_FULL), batteryRealtime, which); totalPartial += computeWakeLock(wl.getWakeTime(WAKE_TYPE_PARTIAL), batteryRealtime, which); totalWindow += computeWakeLock(wl.getWakeTime(WAKE_TYPE_WINDOW), batteryRealtime, which); } if (count > 1) { if (totalFull != 0 || totalPartial != 0 || totalWindow != 0) { sb.setLength(0); sb.append(prefix); sb.append(" TOTAL wake: "); boolean needComma = false; if (totalFull != 0) { needComma = true; formatTimeMs(sb, totalFull); sb.append("full"); } if (totalPartial != 0) { if (needComma) { sb.append(", "); } needComma = true; formatTimeMs(sb, totalPartial); sb.append("partial"); } if (totalWindow != 0) { if (needComma) { sb.append(", "); } needComma = true; formatTimeMs(sb, totalWindow); sb.append("window"); } sb.append(" realtime"); pw.println(sb.toString()); } } } Loading core/java/com/android/internal/os/BatteryStatsImpl.java +11 −7 Original line number Diff line number Diff line Loading @@ -98,6 +98,10 @@ public final class BatteryStatsImpl extends BatteryStats { // in to one common name. private static final int MAX_WAKELOCKS_PER_UID = 30; // The system process gets more. It is special. Oh so special. // With, you know, special needs. Like this. private static final int MAX_WAKELOCKS_PER_UID_IN_SYSTEM = 50; private static final String BATCHED_WAKELOCK_NAME = "*overflow*"; private static int sNumSpeedSteps; Loading Loading @@ -2895,13 +2899,11 @@ public final class BatteryStatsImpl extends BatteryStats { String wakelockName = in.readString(); Uid.Wakelock wakelock = new Wakelock(); wakelock.readFromParcelLocked(unpluggables, in); if (mWakelockStats.size() < MAX_WAKELOCKS_PER_UID) { // We will just drop some random set of wakelocks if // the previous run of the system was an older version // that didn't impose a limit. mWakelockStats.put(wakelockName, wakelock); } } int numSensors = in.readInt(); mSensorStats.clear(); Loading Loading @@ -3904,7 +3906,9 @@ public final class BatteryStatsImpl extends BatteryStats { public StopwatchTimer getWakeTimerLocked(String name, int type) { Wakelock wl = mWakelockStats.get(name); if (wl == null) { if (mWakelockStats.size() > MAX_WAKELOCKS_PER_UID) { final int N = mWakelockStats.size(); if (N > MAX_WAKELOCKS_PER_UID && (mUid != Process.SYSTEM_UID || N > MAX_WAKELOCKS_PER_UID_IN_SYSTEM)) { name = BATCHED_WAKELOCK_NAME; wl = mWakelockStats.get(name); } Loading Loading
core/java/android/content/SyncManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -990,8 +990,8 @@ public class SyncManager implements OnAccountsUpdateListener { mBound = false; mContext.unbindService(this); } mSyncWakeLock.setWorkSource(null); mSyncWakeLock.release(); mSyncWakeLock.setWorkSource(null); } @Override Loading
core/java/android/os/BatteryStats.java +51 −3 Original line number Diff line number Diff line Loading @@ -1095,6 +1095,16 @@ public abstract class BatteryStats implements Parcelable { } } private static long computeWakeLock(Timer timer, long batteryRealtime, int which) { if (timer != null) { // Convert from microseconds to milliseconds with rounding long totalTimeMicros = timer.getTotalTimeLocked(batteryRealtime, which); long totalTimeMillis = (totalTimeMicros + 500) / 1000; return totalTimeMillis; } return 0; } /** * * @param sb a StringBuilder object. Loading @@ -1109,9 +1119,7 @@ public abstract class BatteryStats implements Parcelable { long batteryRealtime, String name, int which, String linePrefix) { if (timer != null) { // Convert from microseconds to milliseconds with rounding long totalTimeMicros = timer.getTotalTimeLocked(batteryRealtime, which); long totalTimeMillis = (totalTimeMicros + 500) / 1000; long totalTimeMillis = computeWakeLock(timer, batteryRealtime, which); int count = timer.getCountLocked(which); if (totalTimeMillis != 0) { Loading Loading @@ -1735,6 +1743,8 @@ public abstract class BatteryStats implements Parcelable { Map<String, ? extends BatteryStats.Uid.Wakelock> wakelocks = u.getWakelockStats(); if (wakelocks.size() > 0) { long totalFull = 0, totalPartial = 0, totalWindow = 0; int count = 0; for (Map.Entry<String, ? extends BatteryStats.Uid.Wakelock> ent : wakelocks.entrySet()) { Uid.Wakelock wl = ent.getValue(); Loading @@ -1754,6 +1764,44 @@ public abstract class BatteryStats implements Parcelable { // Only print out wake locks that were held pw.println(sb.toString()); uidActivity = true; count++; } totalFull += computeWakeLock(wl.getWakeTime(WAKE_TYPE_FULL), batteryRealtime, which); totalPartial += computeWakeLock(wl.getWakeTime(WAKE_TYPE_PARTIAL), batteryRealtime, which); totalWindow += computeWakeLock(wl.getWakeTime(WAKE_TYPE_WINDOW), batteryRealtime, which); } if (count > 1) { if (totalFull != 0 || totalPartial != 0 || totalWindow != 0) { sb.setLength(0); sb.append(prefix); sb.append(" TOTAL wake: "); boolean needComma = false; if (totalFull != 0) { needComma = true; formatTimeMs(sb, totalFull); sb.append("full"); } if (totalPartial != 0) { if (needComma) { sb.append(", "); } needComma = true; formatTimeMs(sb, totalPartial); sb.append("partial"); } if (totalWindow != 0) { if (needComma) { sb.append(", "); } needComma = true; formatTimeMs(sb, totalWindow); sb.append("window"); } sb.append(" realtime"); pw.println(sb.toString()); } } } Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +11 −7 Original line number Diff line number Diff line Loading @@ -98,6 +98,10 @@ public final class BatteryStatsImpl extends BatteryStats { // in to one common name. private static final int MAX_WAKELOCKS_PER_UID = 30; // The system process gets more. It is special. Oh so special. // With, you know, special needs. Like this. private static final int MAX_WAKELOCKS_PER_UID_IN_SYSTEM = 50; private static final String BATCHED_WAKELOCK_NAME = "*overflow*"; private static int sNumSpeedSteps; Loading Loading @@ -2895,13 +2899,11 @@ public final class BatteryStatsImpl extends BatteryStats { String wakelockName = in.readString(); Uid.Wakelock wakelock = new Wakelock(); wakelock.readFromParcelLocked(unpluggables, in); if (mWakelockStats.size() < MAX_WAKELOCKS_PER_UID) { // We will just drop some random set of wakelocks if // the previous run of the system was an older version // that didn't impose a limit. mWakelockStats.put(wakelockName, wakelock); } } int numSensors = in.readInt(); mSensorStats.clear(); Loading Loading @@ -3904,7 +3906,9 @@ public final class BatteryStatsImpl extends BatteryStats { public StopwatchTimer getWakeTimerLocked(String name, int type) { Wakelock wl = mWakelockStats.get(name); if (wl == null) { if (mWakelockStats.size() > MAX_WAKELOCKS_PER_UID) { final int N = mWakelockStats.size(); if (N > MAX_WAKELOCKS_PER_UID && (mUid != Process.SYSTEM_UID || N > MAX_WAKELOCKS_PER_UID_IN_SYSTEM)) { name = BATCHED_WAKELOCK_NAME; wl = mWakelockStats.get(name); } Loading