Google is committed to advancing racial equity for Black communities. See how.

fuchsia.settings.policy

PROTOCOLS

VolumePolicyController

Defined in fuchsia.settings.policy/volume_policy.fidl

Provides access to enumerating and modifying policies for the fuchsia.settings.Audio API.

Policies are automatically persisted across reboots and take effect again on boot.

AddPolicy

Adds a policy for the given target.

Returns a policy_id for the added policy, which can be used to remove the policy with RemovePolicy.

If the policy being added contradicts an existing policy, the add call will return an error. An example would be specifying a max volume for a stream that is lower than an existing min volume.

If the transform specified in the PolicyParameters is not enumerated in the available_transforms of the policy property, the connection will be closed.

Adding a policy will immediately adjust the audio setting values if they don't yet conform to the policy, such as reducing the volume if it's greater than a specified maximum volume.

Request

NameType
target Target
parameters PolicyParameters

Response

NameType
result VolumePolicyController_AddPolicy_Result

GetProperties

Gets a list of volume policy properties, including possible transforms and active policies for the property.

Request

<EMPTY>

Response

NameType
properties vector<Property>

RemovePolicy

Removes a policy with the given policy id.

Any client of this API can remove policies set by any other client.

Request

NameType
policy_id PolicyId

Response

NameType
result VolumePolicyController_RemovePolicy_Result

STRUCTS

VolumePolicyController_AddPolicy_Response

Defined in fuchsia.settings.policy/volume_policy.fidl

FieldTypeDescriptionDefault
policy_id PolicyId No default

VolumePolicyController_RemovePolicy_Response

Defined in fuchsia.settings.policy/volume_policy.fidl

<EMPTY>

ENUMS

Error strict

Type: uint32

Defined in fuchsia.settings.policy/error.fidl

Common error code used across policies.

NameValueDescription
FAILED 1

Generic internal failure.

UNKNOWN_POLICY 2

The specified policy ID is not known.

This may happen if another client removed a policy between a Get call and a RemovePolicy call.

INVALID_POLICY 3

The specified policy contradicts an existing policy.

This may happen if another client added a policy between a Get call and an AddPolicy call.

Transform strict

Type: uint8

Defined in fuchsia.settings.policy/volume_policy.fidl

Possible transforms for a policy target.

A transform is an operation that is applied to a policy property when the fuchsia.settings.Audio API is used. Multiple transforms of the same time can be active for a single property.

NameValueDescription
MAX 1

Limits the maximum value of an audio stream to a certain level.

Max volume limits are transparent to clients of fuchsia.settings.Audio. Clients will always be able to set the volume to 1.0 (max) to prevent user confusion about not being able to set the volume to max. The internal volume, which is communicated to AudioCore to set the true volume level, will always be clamped to the specified maximum.

Externally, the volume percentage will always be a percentage of the max allowed by policy. For example, if the max limit is set to 0.8, a client setting the volume to 1.0 translates to 0.8 internally. An external volume of 0.5 would be scaled to 0.4 internally.

If a min volume limit is present, the minimum external volume will be the min volume limit divided by the max volume limit. For example, if the max volume limit is 0.8 and the min volume limit is 0.2, the lowest possible external volume is 0.25, since 0.2 is 25% of 0.8. The min range is not transparent to clients to prevent the confusion of volume being at 0% but still being able to hear audio.

MIN 2

Limits the minimum value of an audio stream to a certain level.

If the volume is below the specified minimum level when the policy is added, it will automatically be raised to the specified minimum. Calls to set the volume below the minimum level will not fail, but the actual volume will stay above the specified minimum level.

Note that the minimum volume limit is a limit on the internal "true" volume level. If a maximum volume policy is set, the minimum that clients of fuchsia.settings.Audio will see is higher. See the documentation of the MAX volume transform for more information.

TABLES

Policy

Defined in fuchsia.settings.policy/volume_policy.fidl

Definition for a policy that is applied to the fuchsia.settings.Audio API.

OrdinalFieldTypeDescription
1 policy_id PolicyId

Unique identifier for this policy.

Returned from AddPolicy and also used by RemovePolicy.

2 parameters PolicyParameters

Parameters for this policy.

Property

Defined in fuchsia.settings.policy/volume_policy.fidl

A controllable property of the fuchsia.settings.Audio API that can have transforms applied to it.

OrdinalFieldTypeDescription
1 target Target

Unique aspect of settings that this property controls.

Only one property may control any given target.

2 available_transforms vector<Transform>

List of available transform types for this property.

3 active_policies vector<Policy>

List of active policies for this property.

Volume

Defined in fuchsia.settings.policy/volume_policy.fidl

OrdinalFieldTypeDescription
1 volume float32

A volume between 0.0 and 1.0 inclusive.

UNIONS

PolicyParameters strict

Defined in fuchsia.settings.policy/volume_policy.fidl

Specifies the type of policy transform and its arguments.

The chosen union field implies the type of transform that the arguments apply to.

Ordinal
VariantTypeDescription
1 min Volume

This parameter should be included for the MIN transform and specifies the volume level to clamp the audio stream to.

2 max Volume

This parameter should be included for the MAX transform and specifies the volume level to clamp the audio stream to.

Target strict

Defined in fuchsia.settings.policy/volume_policy.fidl

Specifies what aspect of the settings a property controls.

Ordinal
VariantTypeDescription
1 stream fuchsia.media/AudioRenderUsage

An audio stream that can have policies applied to it.

VolumePolicyController_AddPolicy_Result strict

Defined in fuchsia.settings.policy/volume_policy.fidl

Ordinal
VariantTypeDescription
1 response VolumePolicyController_AddPolicy_Response
2 err Error

VolumePolicyController_RemovePolicy_Result strict

Defined in fuchsia.settings.policy/volume_policy.fidl

Ordinal
VariantTypeDescription
1 response VolumePolicyController_RemovePolicy_Response
2 err Error

TYPE ALIASES

NameValueDescription
PolicyId uint32