Help us shape the future of Go! Take the 2026 Go Developer Survey

stats

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TransactionIPowerStatsGetPowerEntityInfo    = binder.FirstCallTransaction + 0
	TransactionIPowerStatsGetStateResidency     = binder.FirstCallTransaction + 1
	TransactionIPowerStatsGetEnergyConsumerInfo = binder.FirstCallTransaction + 2
	TransactionIPowerStatsGetEnergyConsumed     = binder.FirstCallTransaction + 3
	TransactionIPowerStatsGetEnergyMeterInfo    = binder.FirstCallTransaction + 4
	TransactionIPowerStatsReadEnergyMeter       = binder.FirstCallTransaction + 5
)
View Source
const (
	MethodIPowerStatsGetPowerEntityInfo    = "getPowerEntityInfo"
	MethodIPowerStatsGetStateResidency     = "getStateResidency"
	MethodIPowerStatsGetEnergyConsumerInfo = "getEnergyConsumerInfo"
	MethodIPowerStatsGetEnergyConsumed     = "getEnergyConsumed"
	MethodIPowerStatsGetEnergyMeterInfo    = "getEnergyMeterInfo"
	MethodIPowerStatsReadEnergyMeter       = "readEnergyMeter"
)
View Source
const DescriptorIPowerStats = "android.hardware.power.stats.IPowerStats"

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Id        int32
	Name      string
	Subsystem string
}

func (*Channel) MarshalParcel

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

func (*Channel) UnmarshalParcel

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

type EnergyConsumer

type EnergyConsumer struct {
	Id      int32
	Ordinal int32
	Type    EnergyConsumerType
	Name    string
}

func (*EnergyConsumer) MarshalParcel

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

func (*EnergyConsumer) UnmarshalParcel

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

type EnergyConsumerAttribution

type EnergyConsumerAttribution struct {
	Uid       int32
	EnergyUWs int64
}

func (*EnergyConsumerAttribution) MarshalParcel

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

func (*EnergyConsumerAttribution) UnmarshalParcel

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

type EnergyConsumerResult

type EnergyConsumerResult struct {
	Id          int32
	TimestampMs int64
	EnergyUWs   int64
	Attribution []EnergyConsumerAttribution
}

func (*EnergyConsumerResult) MarshalParcel

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

func (*EnergyConsumerResult) UnmarshalParcel

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

type EnergyConsumerType

type EnergyConsumerType int32
const (
	EnergyConsumerTypeOTHER       EnergyConsumerType = 0
	EnergyConsumerTypeBLUETOOTH   EnergyConsumerType = 1
	EnergyConsumerTypeCpuCluster  EnergyConsumerType = 2
	EnergyConsumerTypeDISPLAY     EnergyConsumerType = 3
	EnergyConsumerTypeGNSS        EnergyConsumerType = 4
	EnergyConsumerTypeMobileRadio EnergyConsumerType = 5
	EnergyConsumerTypeWIFI        EnergyConsumerType = 6
	EnergyConsumerTypeCAMERA      EnergyConsumerType = 7
)

type EnergyMeasurement

type EnergyMeasurement struct {
	Id          int32
	TimestampMs int64
	DurationMs  int64
	EnergyUWs   int64
}

func (*EnergyMeasurement) MarshalParcel

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

func (*EnergyMeasurement) UnmarshalParcel

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

type IPowerStats

type IPowerStats interface {
	AsBinder() binder.IBinder
	GetPowerEntityInfo(ctx context.Context) ([]PowerEntity, error)
	GetStateResidency(ctx context.Context, powerEntityIds []int32) ([]StateResidencyResult, error)
	GetEnergyConsumerInfo(ctx context.Context) ([]EnergyConsumer, error)
	GetEnergyConsumed(ctx context.Context, energyConsumerIds []int32) ([]EnergyConsumerResult, error)
	GetEnergyMeterInfo(ctx context.Context) ([]Channel, error)
	ReadEnergyMeter(ctx context.Context, channelIds []int32) ([]EnergyMeasurement, error)
}

func NewPowerStatsStub

func NewPowerStatsStub(
	impl IPowerStatsServer,
) IPowerStats

NewPowerStatsStub creates a server-side IPowerStats wrapping the given server implementation. The returned value satisfies IPowerStats 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 IPowerStatsServer

type IPowerStatsServer interface {
	GetPowerEntityInfo(ctx context.Context) ([]PowerEntity, error)
	GetStateResidency(ctx context.Context, powerEntityIds []int32) ([]StateResidencyResult, error)
	GetEnergyConsumerInfo(ctx context.Context) ([]EnergyConsumer, error)
	GetEnergyConsumed(ctx context.Context, energyConsumerIds []int32) ([]EnergyConsumerResult, error)
	GetEnergyMeterInfo(ctx context.Context) ([]Channel, error)
	ReadEnergyMeter(ctx context.Context, channelIds []int32) ([]EnergyMeasurement, error)
}

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

type PowerEntity

type PowerEntity struct {
	Id     int32
	Name   string
	States []State
}

func (*PowerEntity) MarshalParcel

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

func (*PowerEntity) UnmarshalParcel

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

type PowerStatsProxy

type PowerStatsProxy struct {
	Remote binder.IBinder
}

func NewPowerStatsProxy

func NewPowerStatsProxy(
	remote binder.IBinder,
) *PowerStatsProxy

func (*PowerStatsProxy) AsBinder

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

func (*PowerStatsProxy) GetEnergyConsumed

func (p *PowerStatsProxy) GetEnergyConsumed(
	ctx context.Context,
	energyConsumerIds []int32,
) ([]EnergyConsumerResult, error)

func (*PowerStatsProxy) GetEnergyConsumerInfo

func (p *PowerStatsProxy) GetEnergyConsumerInfo(
	ctx context.Context,
) ([]EnergyConsumer, error)

func (*PowerStatsProxy) GetEnergyMeterInfo

func (p *PowerStatsProxy) GetEnergyMeterInfo(
	ctx context.Context,
) ([]Channel, error)

func (*PowerStatsProxy) GetPowerEntityInfo

func (p *PowerStatsProxy) GetPowerEntityInfo(
	ctx context.Context,
) ([]PowerEntity, error)

func (*PowerStatsProxy) GetStateResidency

func (p *PowerStatsProxy) GetStateResidency(
	ctx context.Context,
	powerEntityIds []int32,
) ([]StateResidencyResult, error)

func (*PowerStatsProxy) ReadEnergyMeter

func (p *PowerStatsProxy) ReadEnergyMeter(
	ctx context.Context,
	channelIds []int32,
) ([]EnergyMeasurement, error)

type PowerStatsStub

type PowerStatsStub struct {
	Impl      IPowerStats
	Transport binder.VersionAwareTransport
}

PowerStatsStub dispatches incoming binder transactions to a typed IPowerStats implementation.

func (*PowerStatsStub) Descriptor

func (s *PowerStatsStub) Descriptor() string

func (*PowerStatsStub) OnTransaction

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

type State

type State struct {
	Id   int32
	Name string
}

func (*State) MarshalParcel

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

func (*State) UnmarshalParcel

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

type StateResidency

type StateResidency struct {
	Id                   int32
	TotalTimeInStateMs   int64
	TotalStateEntryCount int64
	LastEntryTimestampMs int64
}

func (*StateResidency) MarshalParcel

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

func (*StateResidency) UnmarshalParcel

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

type StateResidencyResult

type StateResidencyResult struct {
	Id                 int32
	StateResidencyData []StateResidency
}

func (*StateResidencyResult) MarshalParcel

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

func (*StateResidencyResult) UnmarshalParcel

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

Jump to

Keyboard shortcuts

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