public abstract class BatteryStats extends Object implements Parcelable
Modifier and Type | Class and Description |
---|---|
static class |
BatteryStats.BitDescription |
static class |
BatteryStats.Counter
State for keeping track of counting information.
|
static class |
BatteryStats.HistoryItem |
static class |
BatteryStats.HistoryPrinter |
static class |
BatteryStats.Timer
State for keeping track of timing information.
|
static class |
BatteryStats.Uid
The statistics associated with a particular uid.
|
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static int |
AUDIO_TURNED_ON
A constant indicating an audio turn on timer
|
static int |
DATA_CONNECTION_1xRTT |
static int |
DATA_CONNECTION_CDMA |
static int |
DATA_CONNECTION_EDGE |
static int |
DATA_CONNECTION_EHRPD |
static int |
DATA_CONNECTION_EVDO_0 |
static int |
DATA_CONNECTION_EVDO_A |
static int |
DATA_CONNECTION_EVDO_B |
static int |
DATA_CONNECTION_GPRS |
static int |
DATA_CONNECTION_HSDPA |
static int |
DATA_CONNECTION_HSPA |
static int |
DATA_CONNECTION_HSUPA |
static int |
DATA_CONNECTION_IDEN |
static int |
DATA_CONNECTION_LTE |
static int |
DATA_CONNECTION_NONE |
static int |
DATA_CONNECTION_OTHER |
static int |
DATA_CONNECTION_UMTS |
static int |
FULL_WIFI_LOCK
A constant indicating a full wifi lock timer
|
static BatteryStats.BitDescription[] |
HISTORY_STATE_DESCRIPTIONS |
static int |
NUM_DATA_CONNECTION_TYPES |
static int |
NUM_SCREEN_BRIGHTNESS_BINS |
static int |
SCREEN_BRIGHTNESS_BRIGHT |
static int |
SCREEN_BRIGHTNESS_DARK |
static int |
SCREEN_BRIGHTNESS_DIM |
static int |
SCREEN_BRIGHTNESS_LIGHT |
static int |
SCREEN_BRIGHTNESS_MEDIUM |
static int |
SENSOR
A constant indicating a sensor timer.
|
static int |
STATS_CURRENT
Include only the current run in the stats.
|
static int |
STATS_LAST
Include only the last run in the stats.
|
static int |
STATS_SINCE_CHARGED
Include all of the data in the stats, including previously saved data.
|
static int |
STATS_SINCE_UNPLUGGED
Include only the run since the last time the device was unplugged in the stats.
|
static int |
VIDEO_TURNED_ON
A constant indicating a video turn on timer
|
static int |
WAKE_TYPE_FULL
A constant indicating a full wake lock timer.
|
static int |
WAKE_TYPE_PARTIAL
A constant indicating a partial wake lock timer.
|
static int |
WAKE_TYPE_WINDOW
A constant indicating a window wake lock timer.
|
static int |
WIFI_MULTICAST_ENABLED
A constant indicating a wifi multicast timer
|
static int |
WIFI_RUNNING
A constant indicating a a wifi running timer
|
static int |
WIFI_SCAN
A constant indicating a wifi scan
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
BatteryStats() |
Modifier and Type | Method and Description |
---|---|
abstract long |
computeBatteryRealtime(long curTime,
int which)
Returns the total, last, or current battery realtime in microseconds.
|
abstract long |
computeBatteryUptime(long curTime,
int which)
Returns the total, last, or current battery uptime in microseconds.
|
abstract long |
computeRealtime(long curTime,
int which)
Returns the total, last, or current realtime in microseconds.
|
abstract long |
computeUptime(long curTime,
int which)
Returns the total, last, or current uptime in microseconds.
|
void |
dumpCheckinLocked(PrintWriter pw,
int which,
int reqUid)
Checkin server version of dump to produce more compact, computer-readable log.
|
void |
dumpCheckinLocked(PrintWriter pw,
String[] args,
List<ApplicationInfo> apps) |
void |
dumpLocked(PrintWriter pw)
Dumps a human-readable summary of the battery statistics to the given PrintWriter.
|
void |
dumpLocked(PrintWriter pw,
String prefix,
int which,
int reqUid) |
abstract void |
finishIteratingHistoryLocked() |
abstract void |
finishIteratingOldHistoryLocked() |
abstract long |
getBatteryRealtime(long curTime)
Returns the current battery realtime in microseconds.
|
abstract long |
getBatteryUptime(long curTime)
Returns the current battery uptime in microseconds.
|
abstract long |
getBluetoothOnTime(long batteryRealtime,
int which)
Returns the time in microseconds that bluetooth has been on while the device was
running on battery.
|
abstract int |
getCpuSpeedSteps()
Returns the number of different speeds that the CPU can run at
|
abstract int |
getDischargeAmountScreenOff()
Get the amount the battery has discharged while the screen was off,
since the last time power was unplugged.
|
abstract int |
getDischargeAmountScreenOffSinceCharge()
Get the amount the battery has discharged while the screen was off,
since the last time the device was charged.
|
abstract int |
getDischargeAmountScreenOn()
Get the amount the battery has discharged while the screen was on,
since the last time power was unplugged.
|
abstract int |
getDischargeAmountScreenOnSinceCharge()
Get the amount the battery has discharged while the screen was on,
since the last time the device was charged.
|
abstract int |
getDischargeCurrentLevel()
Returns the current battery percentage level if we are in a discharge cycle, otherwise
returns the level at the last plug event.
|
abstract int |
getDischargeStartLevel()
Returns the battery percentage level at the last time the device was unplugged from power, or
the last time it booted on battery power.
|
abstract long |
getGlobalWifiRunningTime(long batteryRealtime,
int which)
Returns the time in microseconds that wifi has been on and the driver has
been in the running state while the device was running on battery.
|
abstract int |
getHighDischargeAmountSinceCharge()
Get the amount the battery has discharged since the stats were
last reset after charging, as an upper-end approximation.
|
abstract long |
getHistoryBaseTime()
Return the base time offset for the battery history.
|
abstract int |
getInputEventCount(int which) |
abstract boolean |
getIsOnBattery()
Return whether we are currently running on battery.
|
abstract Map<String,? extends BatteryStats.Timer> |
getKernelWakelockStats() |
abstract int |
getLowDischargeAmountSinceCharge()
Get the amount the battery has discharged since the stats were
last reset after charging, as a lower-end approximation.
|
abstract boolean |
getNextHistoryLocked(BatteryStats.HistoryItem out) |
abstract boolean |
getNextOldHistoryLocked(BatteryStats.HistoryItem out) |
abstract int |
getPhoneDataConnectionCount(int dataType,
int which)
Returns the number of times the phone has entered the given data
connection type.
|
abstract long |
getPhoneDataConnectionTime(int dataType,
long batteryRealtime,
int which)
Returns the time in microseconds that the phone has been running with
the given data connection.
|
abstract long |
getPhoneOnTime(long batteryRealtime,
int which)
Returns the time in microseconds that the phone has been on while the device was
running on battery.
|
abstract long |
getPhoneSignalScanningTime(long batteryRealtime,
int which)
Returns the time in microseconds that the phone has been trying to
acquire a signal.
|
abstract int |
getPhoneSignalStrengthCount(int strengthBin,
int which)
Returns the number of times the phone has entered the given signal strength.
|
abstract long |
getPhoneSignalStrengthTime(int strengthBin,
long batteryRealtime,
int which)
Returns the time in microseconds that the phone has been running with
the given signal strength.
|
abstract long |
getRadioDataUptime()
Returns the time that the radio was on for data transfers.
|
long |
getRadioDataUptimeMs()
Deprecated.
use getRadioDataUptime
|
abstract long |
getScreenBrightnessTime(int brightnessBin,
long batteryRealtime,
int which)
Returns the time in microseconds that the screen has been on with
the given brightness
|
abstract long |
getScreenOnTime(long batteryRealtime,
int which)
Returns the time in microseconds that the screen has been on while the device was
running on battery.
|
abstract int |
getStartCount()
Returns the number of times the device has been started.
|
abstract SparseArray<? extends BatteryStats.Uid> |
getUidStats()
Returns a SparseArray containing the statistics for each uid.
|
abstract long |
getWifiOnTime(long batteryRealtime,
int which)
Returns the time in microseconds that wifi has been on while the device was
running on battery.
|
void |
prepareForDumpLocked() |
abstract boolean |
startIteratingHistoryLocked() |
abstract boolean |
startIteratingOldHistoryLocked() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
describeContents, writeToParcel
public static final int WAKE_TYPE_PARTIAL
public static final int WAKE_TYPE_FULL
public static final int WAKE_TYPE_WINDOW
public static final int SENSOR
public static final int WIFI_RUNNING
public static final int FULL_WIFI_LOCK
public static final int WIFI_SCAN
public static final int WIFI_MULTICAST_ENABLED
public static final int AUDIO_TURNED_ON
public static final int VIDEO_TURNED_ON
public static final int STATS_SINCE_CHARGED
public static final int STATS_LAST
public static final int STATS_CURRENT
public static final int STATS_SINCE_UNPLUGGED
public static final int SCREEN_BRIGHTNESS_DARK
public static final int SCREEN_BRIGHTNESS_DIM
public static final int SCREEN_BRIGHTNESS_MEDIUM
public static final int SCREEN_BRIGHTNESS_LIGHT
public static final int SCREEN_BRIGHTNESS_BRIGHT
public static final int NUM_SCREEN_BRIGHTNESS_BINS
public static final int DATA_CONNECTION_NONE
public static final int DATA_CONNECTION_GPRS
public static final int DATA_CONNECTION_EDGE
public static final int DATA_CONNECTION_UMTS
public static final int DATA_CONNECTION_CDMA
public static final int DATA_CONNECTION_EVDO_0
public static final int DATA_CONNECTION_EVDO_A
public static final int DATA_CONNECTION_1xRTT
public static final int DATA_CONNECTION_HSDPA
public static final int DATA_CONNECTION_HSUPA
public static final int DATA_CONNECTION_HSPA
public static final int DATA_CONNECTION_IDEN
public static final int DATA_CONNECTION_EVDO_B
public static final int DATA_CONNECTION_LTE
public static final int DATA_CONNECTION_EHRPD
public static final int DATA_CONNECTION_OTHER
public static final int NUM_DATA_CONNECTION_TYPES
public static final BatteryStats.BitDescription[] HISTORY_STATE_DESCRIPTIONS
public abstract boolean startIteratingHistoryLocked()
public abstract boolean getNextHistoryLocked(BatteryStats.HistoryItem out)
public abstract void finishIteratingHistoryLocked()
public abstract boolean startIteratingOldHistoryLocked()
public abstract boolean getNextOldHistoryLocked(BatteryStats.HistoryItem out)
public abstract void finishIteratingOldHistoryLocked()
public abstract long getHistoryBaseTime()
public abstract int getStartCount()
public abstract long getScreenOnTime(long batteryRealtime, int which)
public abstract long getScreenBrightnessTime(int brightnessBin, long batteryRealtime, int which)
public abstract int getInputEventCount(int which)
public abstract long getPhoneOnTime(long batteryRealtime, int which)
public abstract long getPhoneSignalStrengthTime(int strengthBin, long batteryRealtime, int which)
public abstract long getPhoneSignalScanningTime(long batteryRealtime, int which)
public abstract int getPhoneSignalStrengthCount(int strengthBin, int which)
public abstract long getPhoneDataConnectionTime(int dataType, long batteryRealtime, int which)
public abstract int getPhoneDataConnectionCount(int dataType, int which)
public abstract long getWifiOnTime(long batteryRealtime, int which)
public abstract long getGlobalWifiRunningTime(long batteryRealtime, int which)
public abstract long getBluetoothOnTime(long batteryRealtime, int which)
public abstract boolean getIsOnBattery()
public abstract SparseArray<? extends BatteryStats.Uid> getUidStats()
public abstract long getBatteryUptime(long curTime)
curTime
- the amount of elapsed realtime in microseconds.public long getRadioDataUptimeMs()
public abstract long getRadioDataUptime()
public abstract long getBatteryRealtime(long curTime)
curTime
- the amount of elapsed realtime in microseconds.public abstract int getDischargeStartLevel()
public abstract int getDischargeCurrentLevel()
public abstract int getLowDischargeAmountSinceCharge()
public abstract int getHighDischargeAmountSinceCharge()
public abstract int getDischargeAmountScreenOn()
public abstract int getDischargeAmountScreenOnSinceCharge()
public abstract int getDischargeAmountScreenOff()
public abstract int getDischargeAmountScreenOffSinceCharge()
public abstract long computeBatteryUptime(long curTime, int which)
curTime
- the elapsed realtime in microseconds.which
- one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT.public abstract long computeBatteryRealtime(long curTime, int which)
curTime
- the current elapsed realtime in microseconds.which
- one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT.public abstract long computeUptime(long curTime, int which)
curTime
- the current elapsed realtime in microseconds.which
- one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT.public abstract long computeRealtime(long curTime, int which)
curTime
- the current elapsed realtime in microseconds.which
- one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT.public abstract Map<String,? extends BatteryStats.Timer> getKernelWakelockStats()
public abstract int getCpuSpeedSteps()
public final void dumpCheckinLocked(PrintWriter pw, int which, int reqUid)
public final void dumpLocked(PrintWriter pw, String prefix, int which, int reqUid)
public void prepareForDumpLocked()
public void dumpLocked(PrintWriter pw)
pw
- a Printer to receive the dump output.public void dumpCheckinLocked(PrintWriter pw, String[] args, List<ApplicationInfo> apps)