public interface

BatteryManagerPrivileged

masonamerica.platform.BatteryManagerPrivileged

Class Overview

A privileged extension of the existing BatteryManager.

Summary

Nested Classes
enum BatteryManagerPrivileged.BatteryMode An enumeration of all possible charge suppliers. 
enum BatteryManagerPrivileged.State An enumeration of all possible charger/battery states. 
enum BatteryManagerPrivileged.Status An enumeration of all possible charge status's. 
Public Methods
abstract int getBatteryLevel()
Get the current battery level.
abstract BatteryManagerPrivileged.Status getChargingStatus()
Get the current charging Status
abstract BatteryManagerPrivileged.State getState(BatteryManagerPrivileged.BatteryMode mode)
Get the current state for a given battery mode.
abstract void reset()
A corollary interface that mimics: adb shell dumpsys reset Allows you to "reset" the current device from any modifications done via the BatteryManagerPrivileged interface or adb.
abstract void setBatteryLevel(int level)
A corollary interface that mimics: adb shell dumpsys battery set level Allows you to set the battery level of current battery/charging.
abstract void setChargingStatus(BatteryManagerPrivileged.Status status)
A corollary interface that mimics: adb shell dumpsys battery set status Allows you to set the Status of battery/charging
abstract void setState(BatteryManagerPrivileged.BatteryMode mode, BatteryManagerPrivileged.State state)
A corollary interface that mimics: adb shell dumpsys battery set Allowing you set the State of a given BatteryMode
abstract void unplug()
A corollary interface that mimics: adb shell dumpsys battery unplug Allows you to "unplug" the current device from any external source.

Public Methods

public abstract int getBatteryLevel ()

Get the current battery level.

Returns
int int that represents the battery level (between 0-100)

public abstract BatteryManagerPrivileged.Status getChargingStatus ()

Get the current charging Status

Returns
BatteryManagerPrivileged.Status Status

public abstract BatteryManagerPrivileged.State getState (BatteryManagerPrivileged.BatteryMode mode)

Get the current state for a given battery mode.

Parameters
mode BatteryManagerPrivileged.BatteryMode: The target BatteryMode
Returns
BatteryManagerPrivileged.State The State of the BatteryMode, State#ONLINE or State#OFFLINE

public abstract void reset ()

A corollary interface that mimics: adb shell dumpsys reset Allows you to "reset" the current device from any modifications done via the BatteryManagerPrivileged interface or adb.

public abstract void setBatteryLevel (int level)

A corollary interface that mimics: adb shell dumpsys battery set level Allows you to set the battery level of current battery/charging.

Parameters
level int: The Integer value (between 0-100) of the current charge.

public abstract void setChargingStatus (BatteryManagerPrivileged.Status status)

A corollary interface that mimics: adb shell dumpsys battery set status Allows you to set the Status of battery/charging

Parameters
status BatteryManagerPrivileged.Status: The Status to use for charging

public abstract void setState (BatteryManagerPrivileged.BatteryMode mode, BatteryManagerPrivileged.State state)

A corollary interface that mimics: adb shell dumpsys battery set Allowing you set the State of a given BatteryMode

Parameters
mode BatteryManagerPrivileged.BatteryMode: The target BatteryMode
state BatteryManagerPrivileged.State: The state that the BatteryMode should be set to

public abstract void unplug ()

A corollary interface that mimics: adb shell dumpsys battery unplug Allows you to "unplug" the current device from any external source.