health

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2026 License: CC0-1.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionIHealthRegisterCallback           = binder.FirstCallTransaction + 0
	TransactionIHealthUnregisterCallback         = binder.FirstCallTransaction + 1
	TransactionIHealthUpdate                     = binder.FirstCallTransaction + 2
	TransactionIHealthGetChargeCounterUah        = binder.FirstCallTransaction + 3
	TransactionIHealthGetCurrentNowMicroamps     = binder.FirstCallTransaction + 4
	TransactionIHealthGetCurrentAverageMicroamps = binder.FirstCallTransaction + 5
	TransactionIHealthGetCapacity                = binder.FirstCallTransaction + 6
	TransactionIHealthGetEnergyCounterNwh        = binder.FirstCallTransaction + 7
	TransactionIHealthGetChargeStatus            = binder.FirstCallTransaction + 8
	TransactionIHealthGetStorageInfo             = binder.FirstCallTransaction + 9
	TransactionIHealthGetDiskStats               = binder.FirstCallTransaction + 10
	TransactionIHealthGetHealthInfo              = binder.FirstCallTransaction + 11
	TransactionIHealthSetChargingPolicy          = binder.FirstCallTransaction + 12
	TransactionIHealthGetChargingPolicy          = binder.FirstCallTransaction + 13
	TransactionIHealthGetBatteryHealthData       = binder.FirstCallTransaction + 14
)
View Source
const (
	MethodIHealthRegisterCallback           = "registerCallback"
	MethodIHealthUnregisterCallback         = "unregisterCallback"
	MethodIHealthUpdate                     = "update"
	MethodIHealthGetChargeCounterUah        = "getChargeCounterUah"
	MethodIHealthGetCurrentNowMicroamps     = "getCurrentNowMicroamps"
	MethodIHealthGetCurrentAverageMicroamps = "getCurrentAverageMicroamps"
	MethodIHealthGetCapacity                = "getCapacity"
	MethodIHealthGetEnergyCounterNwh        = "getEnergyCounterNwh"
	MethodIHealthGetChargeStatus            = "getChargeStatus"
	MethodIHealthGetStorageInfo             = "getStorageInfo"
	MethodIHealthGetDiskStats               = "getDiskStats"
	MethodIHealthGetHealthInfo              = "getHealthInfo"
	MethodIHealthSetChargingPolicy          = "setChargingPolicy"
	MethodIHealthGetChargingPolicy          = "getChargingPolicy"
	MethodIHealthGetBatteryHealthData       = "getBatteryHealthData"
)
View Source
const (
	IHealthStatusUnknown      int32 = 2
	IHealthStatusCallbackDied int32 = 4
)
View Source
const DescriptorIHealth = "android.hardware.health.IHealth"
View Source
const DescriptorIHealthInfoCallback = "android.hardware.health.IHealthInfoCallback"
View Source
const (
	HealthInfoBatteryChargeTimeToFullNowSecondsUnsupported int32 = -1
)
View Source
const (
	MethodIHealthInfoCallbackHealthInfoChanged = "healthInfoChanged"
)
View Source
const (
	TransactionIHealthInfoCallbackHealthInfoChanged = binder.FirstCallTransaction + 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatteryCapacityLevel

type BatteryCapacityLevel int32
const (
	BatteryCapacityLevelUNSUPPORTED BatteryCapacityLevel = -1
	BatteryCapacityLevelUNKNOWN     BatteryCapacityLevel = 0
	BatteryCapacityLevelCRITICAL    BatteryCapacityLevel = 1
	BatteryCapacityLevelLOW         BatteryCapacityLevel = 2
	BatteryCapacityLevelNORMAL      BatteryCapacityLevel = 3
	BatteryCapacityLevelHIGH        BatteryCapacityLevel = 4
	BatteryCapacityLevelFULL        BatteryCapacityLevel = 5
)

type BatteryChargingPolicy

type BatteryChargingPolicy int32
const (
	BatteryChargingPolicyINVALID  BatteryChargingPolicy = 0
	BatteryChargingPolicyDEFAULT  BatteryChargingPolicy = 1
	BatteryChargingPolicyLongLife BatteryChargingPolicy = 2
	BatteryChargingPolicyADAPTIVE BatteryChargingPolicy = 3
)

type BatteryChargingState

type BatteryChargingState int32
const (
	BatteryChargingStateINVALID  BatteryChargingState = 0
	BatteryChargingStateNORMAL   BatteryChargingState = 1
	BatteryChargingStateTooCold  BatteryChargingState = 2
	BatteryChargingStateTooHot   BatteryChargingState = 3
	BatteryChargingStateLongLife BatteryChargingState = 4
	BatteryChargingStateADAPTIVE BatteryChargingState = 5
)

type BatteryHealth

type BatteryHealth int32
const (
	BatteryHealthUNKNOWN            BatteryHealth = 1
	BatteryHealthGOOD               BatteryHealth = 2
	BatteryHealthOVERHEAT           BatteryHealth = 3
	BatteryHealthDEAD               BatteryHealth = 4
	BatteryHealthOverVoltage        BatteryHealth = 5
	BatteryHealthUnspecifiedFailure BatteryHealth = 6
	BatteryHealthCOLD               BatteryHealth = 7
	BatteryHealthFAIR               BatteryHealth = 8
	BatteryHealthNotAvailable       BatteryHealth = 11
	BatteryHealthINCONSISTENT       BatteryHealth = 12
)

type BatteryHealthData

type BatteryHealthData struct {
	BatteryManufacturingDateSeconds int64
	BatteryFirstUsageSeconds        int64
	BatteryStateOfHealth            int64
	BatterySerialNumber             string
	BatteryPartStatus               BatteryPartStatus
}

func (*BatteryHealthData) MarshalParcel

func (s *BatteryHealthData) MarshalParcel(
	p *parcel.Parcel,
) error

func (*BatteryHealthData) UnmarshalParcel

func (s *BatteryHealthData) UnmarshalParcel(
	p *parcel.Parcel,
) error

type BatteryPartStatus

type BatteryPartStatus int32
const (
	BatteryPartStatusUNSUPPORTED BatteryPartStatus = 0
	BatteryPartStatusORIGINAL    BatteryPartStatus = 1
	BatteryPartStatusREPLACED    BatteryPartStatus = 2
)

type BatteryStatus

type BatteryStatus int32
const (
	BatteryStatusUNKNOWN     BatteryStatus = 1
	BatteryStatusCHARGING    BatteryStatus = 2
	BatteryStatusDISCHARGING BatteryStatus = 3
	BatteryStatusNotCharging BatteryStatus = 4
	BatteryStatusFULL        BatteryStatus = 5
)

type DiskStats

type DiskStats struct {
	Reads        int64
	ReadMerges   int64
	ReadSectors  int64
	ReadTicks    int64
	Writes       int64
	WriteMerges  int64
	WriteSectors int64
	WriteTicks   int64
	IoInFlight   int64
	IoTicks      int64
	IoInQueue    int64
}

func (*DiskStats) MarshalParcel

func (s *DiskStats) MarshalParcel(
	p *parcel.Parcel,
) error

func (*DiskStats) UnmarshalParcel

func (s *DiskStats) UnmarshalParcel(
	p *parcel.Parcel,
) error

type HealthInfo

type HealthInfo struct {
	ChargerAcOnline                    bool
	ChargerUsbOnline                   bool
	ChargerWirelessOnline              bool
	ChargerDockOnline                  bool
	MaxChargingCurrentMicroamps        int32
	MaxChargingVoltageMicrovolts       int32
	BatteryStatus                      BatteryStatus
	BatteryHealth                      BatteryHealth
	BatteryPresent                     bool
	BatteryLevel                       int32
	BatteryVoltageMillivolts           int32
	BatteryTemperatureTenthsCelsius    int32
	BatteryCurrentMicroamps            int32
	BatteryCycleCount                  int32
	BatteryFullChargeUah               int32
	BatteryChargeCounterUah            int32
	BatteryTechnology                  string
	BatteryCurrentAverageMicroamps     int32
	DiskStats                          []DiskStats
	StorageInfos                       []StorageInfo
	BatteryCapacityLevel               BatteryCapacityLevel
	BatteryChargeTimeToFullNowSeconds  int64
	BatteryFullChargeDesignCapacityUah int32
	ChargingState                      BatteryChargingState
	ChargingPolicy                     BatteryChargingPolicy
	BatteryHealthData                  *BatteryHealthData
}

func (*HealthInfo) MarshalParcel

func (s *HealthInfo) MarshalParcel(
	p *parcel.Parcel,
) error

func (*HealthInfo) UnmarshalParcel

func (s *HealthInfo) UnmarshalParcel(
	p *parcel.Parcel,
) error

type HealthInfoCallbackProxy

type HealthInfoCallbackProxy struct {
	Remote binder.IBinder
}

func NewHealthInfoCallbackProxy

func NewHealthInfoCallbackProxy(
	remote binder.IBinder,
) *HealthInfoCallbackProxy

func (*HealthInfoCallbackProxy) AsBinder

func (p *HealthInfoCallbackProxy) AsBinder() binder.IBinder

func (*HealthInfoCallbackProxy) HealthInfoChanged

func (p *HealthInfoCallbackProxy) HealthInfoChanged(
	ctx context.Context,
	info HealthInfo,
) error

type HealthInfoCallbackStub

type HealthInfoCallbackStub struct {
	Impl      IHealthInfoCallback
	Transport binder.VersionAwareTransport
}

HealthInfoCallbackStub dispatches incoming binder transactions to a typed IHealthInfoCallback implementation.

func (*HealthInfoCallbackStub) Descriptor

func (s *HealthInfoCallbackStub) Descriptor() string

func (*HealthInfoCallbackStub) OnTransaction

func (s *HealthInfoCallbackStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

type HealthProxy

type HealthProxy struct {
	Remote binder.IBinder
}

func NewHealthProxy

func NewHealthProxy(
	remote binder.IBinder,
) *HealthProxy

func (*HealthProxy) AsBinder

func (p *HealthProxy) AsBinder() binder.IBinder

func (*HealthProxy) GetBatteryHealthData

func (p *HealthProxy) GetBatteryHealthData(
	ctx context.Context,
) (BatteryHealthData, error)

func (*HealthProxy) GetCapacity

func (p *HealthProxy) GetCapacity(
	ctx context.Context,
) (int32, error)

func (*HealthProxy) GetChargeCounterUah

func (p *HealthProxy) GetChargeCounterUah(
	ctx context.Context,
) (int32, error)

func (*HealthProxy) GetChargeStatus

func (p *HealthProxy) GetChargeStatus(
	ctx context.Context,
) (BatteryStatus, error)

func (*HealthProxy) GetChargingPolicy

func (p *HealthProxy) GetChargingPolicy(
	ctx context.Context,
) (BatteryChargingPolicy, error)

func (*HealthProxy) GetCurrentAverageMicroamps

func (p *HealthProxy) GetCurrentAverageMicroamps(
	ctx context.Context,
) (int32, error)

func (*HealthProxy) GetCurrentNowMicroamps

func (p *HealthProxy) GetCurrentNowMicroamps(
	ctx context.Context,
) (int32, error)

func (*HealthProxy) GetDiskStats

func (p *HealthProxy) GetDiskStats(
	ctx context.Context,
) ([]DiskStats, error)

func (*HealthProxy) GetEnergyCounterNwh

func (p *HealthProxy) GetEnergyCounterNwh(
	ctx context.Context,
) (int64, error)

func (*HealthProxy) GetHealthInfo

func (p *HealthProxy) GetHealthInfo(
	ctx context.Context,
) (HealthInfo, error)

func (*HealthProxy) GetStorageInfo

func (p *HealthProxy) GetStorageInfo(
	ctx context.Context,
) ([]StorageInfo, error)

func (*HealthProxy) RegisterCallback

func (p *HealthProxy) RegisterCallback(
	ctx context.Context,
	callback IHealthInfoCallback,
) error

func (*HealthProxy) SetChargingPolicy

func (p *HealthProxy) SetChargingPolicy(
	ctx context.Context,
	in_value BatteryChargingPolicy,
) error

func (*HealthProxy) UnregisterCallback

func (p *HealthProxy) UnregisterCallback(
	ctx context.Context,
	callback IHealthInfoCallback,
) error

func (*HealthProxy) Update

func (p *HealthProxy) Update(
	ctx context.Context,
) error

type HealthStub

type HealthStub struct {
	Impl      IHealth
	Transport binder.VersionAwareTransport
}

HealthStub dispatches incoming binder transactions to a typed IHealth implementation.

func (*HealthStub) Descriptor

func (s *HealthStub) Descriptor() string

func (*HealthStub) OnTransaction

func (s *HealthStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

type IHealth

type IHealth interface {
	AsBinder() binder.IBinder
	RegisterCallback(ctx context.Context, callback IHealthInfoCallback) error
	UnregisterCallback(ctx context.Context, callback IHealthInfoCallback) error
	Update(ctx context.Context) error
	GetChargeCounterUah(ctx context.Context) (int32, error)
	GetCurrentNowMicroamps(ctx context.Context) (int32, error)
	GetCurrentAverageMicroamps(ctx context.Context) (int32, error)
	GetCapacity(ctx context.Context) (int32, error)
	GetEnergyCounterNwh(ctx context.Context) (int64, error)
	GetChargeStatus(ctx context.Context) (BatteryStatus, error)
	GetStorageInfo(ctx context.Context) ([]StorageInfo, error)
	GetDiskStats(ctx context.Context) ([]DiskStats, error)
	GetHealthInfo(ctx context.Context) (HealthInfo, error)
	SetChargingPolicy(ctx context.Context, in_value BatteryChargingPolicy) error
	GetChargingPolicy(ctx context.Context) (BatteryChargingPolicy, error)
	GetBatteryHealthData(ctx context.Context) (BatteryHealthData, error)
}

func NewHealthStub

func NewHealthStub(
	impl IHealthServer,
) IHealth

NewHealthStub creates a server-side IHealth wrapping the given server implementation. The returned value satisfies IHealth and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type IHealthInfoCallback

type IHealthInfoCallback interface {
	AsBinder() binder.IBinder
	HealthInfoChanged(ctx context.Context, info HealthInfo) error
}

func NewHealthInfoCallbackStub

func NewHealthInfoCallbackStub(
	impl IHealthInfoCallbackServer,
) IHealthInfoCallback

NewHealthInfoCallbackStub creates a server-side IHealthInfoCallback wrapping the given server implementation. The returned value satisfies IHealthInfoCallback and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type IHealthInfoCallbackServer

type IHealthInfoCallbackServer interface {
	HealthInfoChanged(ctx context.Context, info HealthInfo) error
}

IHealthInfoCallbackServer is the server-side interface that user implementations provide to NewHealthInfoCallbackStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type IHealthServer

type IHealthServer interface {
	RegisterCallback(ctx context.Context, callback IHealthInfoCallback) error
	UnregisterCallback(ctx context.Context, callback IHealthInfoCallback) error
	Update(ctx context.Context) error
	GetChargeCounterUah(ctx context.Context) (int32, error)
	GetCurrentNowMicroamps(ctx context.Context) (int32, error)
	GetCurrentAverageMicroamps(ctx context.Context) (int32, error)
	GetCapacity(ctx context.Context) (int32, error)
	GetEnergyCounterNwh(ctx context.Context) (int64, error)
	GetChargeStatus(ctx context.Context) (BatteryStatus, error)
	GetStorageInfo(ctx context.Context) ([]StorageInfo, error)
	GetDiskStats(ctx context.Context) ([]DiskStats, error)
	GetHealthInfo(ctx context.Context) (HealthInfo, error)
	SetChargingPolicy(ctx context.Context, in_value BatteryChargingPolicy) error
	GetChargingPolicy(ctx context.Context) (BatteryChargingPolicy, error)
	GetBatteryHealthData(ctx context.Context) (BatteryHealthData, error)
}

IHealthServer is the server-side interface that user implementations provide to NewHealthStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type StorageInfo

type StorageInfo struct {
	Eol       int32
	LifetimeA int32
	LifetimeB int32
	Version   string
}

func (*StorageInfo) MarshalParcel

func (s *StorageInfo) MarshalParcel(
	p *parcel.Parcel,
) error

func (*StorageInfo) UnmarshalParcel

func (s *StorageInfo) UnmarshalParcel(
	p *parcel.Parcel,
) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL