| // Copyright 2024 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.component.sandbox; |
| |
| // TODO(b/337248133): This type was copied from fuchsia.component.decl. |
| // When the sandbox library is exposed in the SDK, delete the decl Availiability |
| // in favor of this one. |
| /// Describes the expected availability of the capability. |
| /// |
| /// Some capabilities may not be present on all system configurations. In those |
| /// cases, the availability will be declared as `OPTIONAL` along the chains of |
| /// exposes/offers/uses, and the capability would be routed from `void` on |
| /// system configurations where it does not make sense to route or provide a |
| /// particular capability (e.g. graphical capabilities on a headless system). |
| @available(added=HEAD) |
| type Availability = strict enum { |
| /// The capability must be available. Failure to route the capability is an |
| /// error. |
| REQUIRED = 1; |
| |
| /// Inside a use declaration: the component can function if it fails to |
| /// obtain the capability. |
| /// |
| /// Inside an offer/expose declaration: the capability may not be available |
| /// in some system configurations. As a corollary, the target component must |
| /// not have a required dependency on the capability. |
| OPTIONAL = 2; |
| |
| /// If the target of the corresponding offer or expose declaration requires |
| /// the capability, then the behavior is equivalent to required. If the |
| /// target has an optional dependency on the capability, then the behavior |
| /// is equivalent to optional. This is useful for container components that |
| /// would like to change their routing availability based on ones inside. |
| /// |
| /// This value is not allowed inside a use declaration. |
| SAME_AS_TARGET = 3; |
| |
| /// The source may omit the route completely without even having to route |
| /// from `void`. |
| /// |
| /// [`TRANSITIONAL`] is used for soft transitions that introduce new |
| /// capabilities. |
| TRANSITIONAL = 4; |
| }; |