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.ChargingSpeed An enumeration of all possible charging speeds. 
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 boolean getAdaptiveChargingEnabled()
Get adaptive charging state
abstract boolean getBatteryChargingEnabled()
Checks if battery charging is currently enabled.
abstract int getBatteryLevel()
Get the current battery level.
abstract BatteryManagerPrivileged.ChargingSpeed getChargingSpeed()
Get the current charging speed setting.
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 boolean getAdaptiveChargingEnabled ()

Get adaptive charging state

Returns
boolean true if adaptive charging is enabled; false otherwise.

public abstract boolean getBatteryChargingEnabled ()

Checks if battery charging is currently enabled.

Returns
boolean true if charging is enabled, false otherwise.

public abstract int getBatteryLevel ()

Get the current battery level.

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

public abstract BatteryManagerPrivileged.ChargingSpeed getChargingSpeed ()

Get the current charging speed setting.

Returns
BatteryManagerPrivileged.ChargingSpeed The current ChargingSpeed

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.