power

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: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelMessageChannelMessageContentsTagReserved       int32 = 0
	ChannelMessageChannelMessageContentsTagTargetDuration int32 = 1
	ChannelMessageChannelMessageContentsTagHint           int32 = 2
	ChannelMessageChannelMessageContentsTagMode           int32 = 3
	ChannelMessageChannelMessageContentsTagWorkDuration   int32 = 4
)
View Source
const (
	TransactionIPowerSetMode                     = binder.FirstCallTransaction + 0
	TransactionIPowerIsModeSupported             = binder.FirstCallTransaction + 1
	TransactionIPowerSetBoost                    = binder.FirstCallTransaction + 2
	TransactionIPowerIsBoostSupported            = binder.FirstCallTransaction + 3
	TransactionIPowerCreateHintSession           = binder.FirstCallTransaction + 4
	TransactionIPowerGetHintSessionPreferredRate = binder.FirstCallTransaction + 5
	TransactionIPowerCreateHintSessionWithConfig = binder.FirstCallTransaction + 6
	TransactionIPowerGetSessionChannel           = binder.FirstCallTransaction + 7
	TransactionIPowerCloseSessionChannel         = binder.FirstCallTransaction + 8
)
View Source
const (
	MethodIPowerSetMode                     = "setMode"
	MethodIPowerIsModeSupported             = "isModeSupported"
	MethodIPowerSetBoost                    = "setBoost"
	MethodIPowerIsBoostSupported            = "isBoostSupported"
	MethodIPowerCreateHintSession           = "createHintSession"
	MethodIPowerGetHintSessionPreferredRate = "getHintSessionPreferredRate"
	MethodIPowerCreateHintSessionWithConfig = "createHintSessionWithConfig"
	MethodIPowerGetSessionChannel           = "getSessionChannel"
	MethodIPowerCloseSessionChannel         = "closeSessionChannel"
)
View Source
const (
	TransactionIPowerHintSessionUpdateTargetWorkDuration = binder.FirstCallTransaction + 0
	TransactionIPowerHintSessionReportActualWorkDuration = binder.FirstCallTransaction + 1
	TransactionIPowerHintSessionPause                    = binder.FirstCallTransaction + 2
	TransactionIPowerHintSessionResume                   = binder.FirstCallTransaction + 3
	TransactionIPowerHintSessionClose                    = binder.FirstCallTransaction + 4
	TransactionIPowerHintSessionSendHint                 = binder.FirstCallTransaction + 5
	TransactionIPowerHintSessionSetThreads               = binder.FirstCallTransaction + 6
	TransactionIPowerHintSessionSetMode                  = binder.FirstCallTransaction + 7
	TransactionIPowerHintSessionGetSessionConfig         = binder.FirstCallTransaction + 8
)
View Source
const (
	MethodIPowerHintSessionUpdateTargetWorkDuration = "updateTargetWorkDuration"
	MethodIPowerHintSessionReportActualWorkDuration = "reportActualWorkDuration"
	MethodIPowerHintSessionPause                    = "pause"
	MethodIPowerHintSessionResume                   = "resume"
	MethodIPowerHintSessionClose                    = "close"
	MethodIPowerHintSessionSendHint                 = "sendHint"
	MethodIPowerHintSessionSetThreads               = "setThreads"
	MethodIPowerHintSessionSetMode                  = "setMode"
	MethodIPowerHintSessionGetSessionConfig         = "getSessionConfig"
)
View Source
const DescriptorIPower = "android.hardware.power.IPower"
View Source
const DescriptorIPowerHintSession = "android.hardware.power.IPowerHintSession"

Variables

This section is empty.

Functions

This section is empty.

Types

type Boost

type Boost int32
const (
	BoostINTERACTION           Boost = 0
	BoostDisplayUpdateImminent Boost = 1
	BoostMlAcc                 Boost = 2
	BoostAudioLaunch           Boost = 3
	BoostCameraLaunch          Boost = 4
	BoostCameraShot            Boost = 5
)

type ChannelConfig

type ChannelConfig struct {
	ChannelDescriptor   fmq.MQDescriptor
	EventFlagDescriptor *fmq.MQDescriptor
	ReadFlagBitmask     int32
	WriteFlagBitmask    int32
}

func (*ChannelConfig) MarshalParcel

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

func (*ChannelConfig) UnmarshalParcel

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

type ChannelMessage

type ChannelMessage struct {
	SessionID      int32
	TimeStampNanos int64
	Data           ChannelMessageChannelMessageContents
}

func (*ChannelMessage) MarshalParcel

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

func (*ChannelMessage) UnmarshalParcel

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

type ChannelMessageChannelMessageContents

type ChannelMessageChannelMessageContents struct {
	Tag            int32
	Reserved       []int64
	TargetDuration int64
	Hint           SessionHint
	Mode           ChannelMessageChannelMessageContentsSessionModeSetter
	WorkDuration   WorkDurationFixedV1
}

func (*ChannelMessageChannelMessageContents) GetHint

func (*ChannelMessageChannelMessageContents) GetMode

func (*ChannelMessageChannelMessageContents) GetReserved

func (u *ChannelMessageChannelMessageContents) GetReserved() ([]int64, bool)

func (*ChannelMessageChannelMessageContents) GetTargetDuration

func (u *ChannelMessageChannelMessageContents) GetTargetDuration() (int64, bool)

func (*ChannelMessageChannelMessageContents) GetWorkDuration

func (*ChannelMessageChannelMessageContents) MarshalParcel

func (u *ChannelMessageChannelMessageContents) MarshalParcel(
	p *parcel.Parcel,
) error

func (*ChannelMessageChannelMessageContents) SetHint

func (*ChannelMessageChannelMessageContents) SetMode

func (*ChannelMessageChannelMessageContents) SetReserved

func (u *ChannelMessageChannelMessageContents) SetReserved(
	v []int64,
)

func (*ChannelMessageChannelMessageContents) SetTargetDuration

func (u *ChannelMessageChannelMessageContents) SetTargetDuration(
	v int64,
)

func (*ChannelMessageChannelMessageContents) SetWorkDuration

func (*ChannelMessageChannelMessageContents) UnmarshalParcel

func (u *ChannelMessageChannelMessageContents) UnmarshalParcel(
	p *parcel.Parcel,
) error

type ChannelMessageChannelMessageContentsSessionModeSetter

type ChannelMessageChannelMessageContentsSessionModeSetter struct {
	ModeInt SessionMode
	Enabled bool
}

func (*ChannelMessageChannelMessageContentsSessionModeSetter) MarshalParcel

func (*ChannelMessageChannelMessageContentsSessionModeSetter) UnmarshalParcel

type IPower

type IPower interface {
	AsBinder() binder.IBinder
	SetMode(ctx context.Context, type_ Mode, enabled bool) error
	IsModeSupported(ctx context.Context, type_ Mode) (bool, error)
	SetBoost(ctx context.Context, type_ Boost, durationMs int32) error
	IsBoostSupported(ctx context.Context, type_ Boost) (bool, error)
	CreateHintSession(ctx context.Context, tgid int32, uid int32, threadIds []int32, durationNanos int64) (IPowerHintSession, error)
	GetHintSessionPreferredRate(ctx context.Context) (int64, error)
	CreateHintSessionWithConfig(ctx context.Context, tgid int32, uid int32, threadIds []int32, durationNanos int64, tag SessionTag, config SessionConfig) (IPowerHintSession, error)
	GetSessionChannel(ctx context.Context, tgid int32, uid int32) (ChannelConfig, error)
	CloseSessionChannel(ctx context.Context, tgid int32, uid int32) error
}

func NewPowerStub

func NewPowerStub(
	impl IPowerServer,
) IPower

NewPowerStub creates a server-side IPower wrapping the given server implementation. The returned value satisfies IPower 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 IPowerHintSession

type IPowerHintSession interface {
	AsBinder() binder.IBinder
	UpdateTargetWorkDuration(ctx context.Context, targetDurationNanos int64) error
	ReportActualWorkDuration(ctx context.Context, durations []WorkDuration) error
	Pause(ctx context.Context) error
	Resume(ctx context.Context) error
	Close(ctx context.Context) error
	SendHint(ctx context.Context, hint SessionHint) error
	SetThreads(ctx context.Context, threadIds []int32) error
	SetMode(ctx context.Context, type_ SessionMode, enabled bool) error
	GetSessionConfig(ctx context.Context) (SessionConfig, error)
}

func NewPowerHintSessionStub

func NewPowerHintSessionStub(
	impl IPowerHintSessionServer,
) IPowerHintSession

NewPowerHintSessionStub creates a server-side IPowerHintSession wrapping the given server implementation. The returned value satisfies IPowerHintSession 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 IPowerHintSessionServer

type IPowerHintSessionServer interface {
	UpdateTargetWorkDuration(ctx context.Context, targetDurationNanos int64) error
	ReportActualWorkDuration(ctx context.Context, durations []WorkDuration) error
	Pause(ctx context.Context) error
	Resume(ctx context.Context) error
	Close(ctx context.Context) error
	SendHint(ctx context.Context, hint SessionHint) error
	SetThreads(ctx context.Context, threadIds []int32) error
	SetMode(ctx context.Context, type_ SessionMode, enabled bool) error
	GetSessionConfig(ctx context.Context) (SessionConfig, error)
}

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

type IPowerServer

type IPowerServer interface {
	SetMode(ctx context.Context, type_ Mode, enabled bool) error
	IsModeSupported(ctx context.Context, type_ Mode) (bool, error)
	SetBoost(ctx context.Context, type_ Boost, durationMs int32) error
	IsBoostSupported(ctx context.Context, type_ Boost) (bool, error)
	CreateHintSession(ctx context.Context, tgid int32, uid int32, threadIds []int32, durationNanos int64) (IPowerHintSession, error)
	GetHintSessionPreferredRate(ctx context.Context) (int64, error)
	CreateHintSessionWithConfig(ctx context.Context, tgid int32, uid int32, threadIds []int32, durationNanos int64, tag SessionTag, config SessionConfig) (IPowerHintSession, error)
	GetSessionChannel(ctx context.Context, tgid int32, uid int32) (ChannelConfig, error)
	CloseSessionChannel(ctx context.Context, tgid int32, uid int32) error
}

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

type Mode

type Mode int32
const (
	ModeDoubleTapToWake          Mode = 0
	ModeLowPower                 Mode = 1
	ModeSustainedPerformance     Mode = 2
	ModeFixedPerformance         Mode = 3
	ModeVR                       Mode = 4
	ModeLAUNCH                   Mode = 5
	ModeExpensiveRendering       Mode = 6
	ModeINTERACTIVE              Mode = 7
	ModeDeviceIdle               Mode = 8
	ModeDisplayInactive          Mode = 9
	ModeAudioStreamingLowLatency Mode = 10
	ModeCameraStreamingSecure    Mode = 11
	ModeCameraStreamingLow       Mode = 12
	ModeCameraStreamingMid       Mode = 13
	ModeCameraStreamingHigh      Mode = 14
	ModeGAME                     Mode = 15
	ModeGameLoading              Mode = 16
	ModeDisplayChange            Mode = 17
	ModeAutomotiveProjection     Mode = 18
)

type PowerHintSessionProxy

type PowerHintSessionProxy struct {
	Remote binder.IBinder
}

func NewPowerHintSessionProxy

func NewPowerHintSessionProxy(
	remote binder.IBinder,
) *PowerHintSessionProxy

func (*PowerHintSessionProxy) AsBinder

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

func (*PowerHintSessionProxy) Close

func (p *PowerHintSessionProxy) Close(
	ctx context.Context,
) error

func (*PowerHintSessionProxy) GetSessionConfig

func (p *PowerHintSessionProxy) GetSessionConfig(
	ctx context.Context,
) (SessionConfig, error)

func (*PowerHintSessionProxy) Pause

func (p *PowerHintSessionProxy) Pause(
	ctx context.Context,
) error

func (*PowerHintSessionProxy) ReportActualWorkDuration

func (p *PowerHintSessionProxy) ReportActualWorkDuration(
	ctx context.Context,
	durations []WorkDuration,
) error

func (*PowerHintSessionProxy) Resume

func (p *PowerHintSessionProxy) Resume(
	ctx context.Context,
) error

func (*PowerHintSessionProxy) SendHint

func (p *PowerHintSessionProxy) SendHint(
	ctx context.Context,
	hint SessionHint,
) error

func (*PowerHintSessionProxy) SetMode

func (p *PowerHintSessionProxy) SetMode(
	ctx context.Context,
	type_ SessionMode,
	enabled bool,
) error

func (*PowerHintSessionProxy) SetThreads

func (p *PowerHintSessionProxy) SetThreads(
	ctx context.Context,
	threadIds []int32,
) error

func (*PowerHintSessionProxy) UpdateTargetWorkDuration

func (p *PowerHintSessionProxy) UpdateTargetWorkDuration(
	ctx context.Context,
	targetDurationNanos int64,
) error

type PowerHintSessionStub

type PowerHintSessionStub struct {
	Impl      IPowerHintSession
	Transport binder.VersionAwareTransport
}

PowerHintSessionStub dispatches incoming binder transactions to a typed IPowerHintSession implementation.

func (*PowerHintSessionStub) Descriptor

func (s *PowerHintSessionStub) Descriptor() string

func (*PowerHintSessionStub) OnTransaction

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

type PowerProxy

type PowerProxy struct {
	Remote binder.IBinder
}

func NewPowerProxy

func NewPowerProxy(
	remote binder.IBinder,
) *PowerProxy

func (*PowerProxy) AsBinder

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

func (*PowerProxy) CloseSessionChannel

func (p *PowerProxy) CloseSessionChannel(
	ctx context.Context,
	tgid int32,
	uid int32,
) error

func (*PowerProxy) CreateHintSession

func (p *PowerProxy) CreateHintSession(
	ctx context.Context,
	tgid int32,
	uid int32,
	threadIds []int32,
	durationNanos int64,
) (IPowerHintSession, error)

func (*PowerProxy) CreateHintSessionWithConfig

func (p *PowerProxy) CreateHintSessionWithConfig(
	ctx context.Context,
	tgid int32,
	uid int32,
	threadIds []int32,
	durationNanos int64,
	tag SessionTag,
	config SessionConfig,
) (IPowerHintSession, error)

func (*PowerProxy) GetHintSessionPreferredRate

func (p *PowerProxy) GetHintSessionPreferredRate(
	ctx context.Context,
) (int64, error)

func (*PowerProxy) GetSessionChannel

func (p *PowerProxy) GetSessionChannel(
	ctx context.Context,
	tgid int32,
	uid int32,
) (ChannelConfig, error)

func (*PowerProxy) IsBoostSupported

func (p *PowerProxy) IsBoostSupported(
	ctx context.Context,
	type_ Boost,
) (bool, error)

func (*PowerProxy) IsModeSupported

func (p *PowerProxy) IsModeSupported(
	ctx context.Context,
	type_ Mode,
) (bool, error)

func (*PowerProxy) SetBoost

func (p *PowerProxy) SetBoost(
	ctx context.Context,
	type_ Boost,
	durationMs int32,
) error

func (*PowerProxy) SetMode

func (p *PowerProxy) SetMode(
	ctx context.Context,
	type_ Mode,
	enabled bool,
) error

type PowerStub

type PowerStub struct {
	Impl      IPower
	Transport binder.VersionAwareTransport
}

PowerStub dispatches incoming binder transactions to a typed IPower implementation.

func (*PowerStub) Descriptor

func (s *PowerStub) Descriptor() string

func (*PowerStub) OnTransaction

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

type SessionConfig

type SessionConfig struct {
	Id int64
}

func (*SessionConfig) MarshalParcel

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

func (*SessionConfig) UnmarshalParcel

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

type SessionHint

type SessionHint int32
const (
	SessionHintCpuLoadUp       SessionHint = 0
	SessionHintCpuLoadDown     SessionHint = 1
	SessionHintCpuLoadReset    SessionHint = 2
	SessionHintCpuLoadResume   SessionHint = 3
	SessionHintPowerEfficiency SessionHint = 4
	SessionHintGpuLoadUp       SessionHint = 5
	SessionHintGpuLoadDown     SessionHint = 6
	SessionHintGpuLoadReset    SessionHint = 7
)

type SessionMode

type SessionMode int32
const (
	SessionModePowerEfficiency SessionMode = 0
)

type SessionTag

type SessionTag int32
const (
	SessionTagOTHER          SessionTag = 0
	SessionTagSURFACEFLINGER SessionTag = 1
	SessionTagHWUI           SessionTag = 2
	SessionTagGAME           SessionTag = 3
	SessionTagAPP            SessionTag = 4
)

type WorkDuration

type WorkDuration struct {
	TimeStampNanos                int64
	DurationNanos                 int64
	WorkPeriodStartTimestampNanos int64
	CpuDurationNanos              int64
	GpuDurationNanos              int64
}

func (*WorkDuration) MarshalParcel

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

func (*WorkDuration) UnmarshalParcel

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

type WorkDurationFixedV1

type WorkDurationFixedV1 struct {
	DurationNanos                 int64
	WorkPeriodStartTimestampNanos int64
	CpuDurationNanos              int64
	GpuDurationNanos              int64
}

func (*WorkDurationFixedV1) MarshalParcel

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

func (*WorkDurationFixedV1) UnmarshalParcel

func (s *WorkDurationFixedV1) 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