Component manifests declare how capabilities are routed between components . The language of capability routing consists of the following three keywords:
use: When a component
usesa capability, the capability is installed in the component's namespace. A component may
useany capability that has been
offer: A component may
offera capability to a target, which is either a child or collection. When a capability is offered to a child, the child instance may
usethe capability or
offerit to one of its own targets. Likewise, when a capability is offered to a collection, any instance in the collection may
usethe capability or
expose: When a component
exposesa capability to its parent , the parent may
offerthe capability to one of its other children. A component may
exposeany capability that it provides, or that one of its children exposes.
When you use these keywords together, they express how a capability is routed from a component instance's outgoing directory to another component instance's namespace:
usedescribes the capabilities that populate a component instance's namespace.
offerdescribe how capabilities are passed between component instances. Aside from their directionality, there is another significant difference between
expose. A component may freely
usea capability that was
offeredto it, however, in order to prevent dependency cycles between parents and children there are restrictions on
usinga capability that is
exposedto a component by its child. If the parent offers no capabilities to the child which the parent itself provides, then it can
usefrom its child. If the parent does offer capabilities that it provides, then the
usefrom the child must be marked as
- Directory capabilities connect to directories provided by other components.
- Event capabilities receive lifecycle events about components at a certain scope.
- Protocol capabilities are service nodes that can be used to open a channel to a FIDL protocol.
- Resolver capabilities when registered in an environment, cause a component with a particular URL scheme to be resolved with that resolver.
- Runner capabilities determines which runner is responsible for instantiating the component and assisting with its lifecycle.
- Service capabilities connect to FIDL services (groups of protocols) provided by other components or the framework itself.
- Storage capabilities are special-cased directories with different semantics that are isolated to the components using them.
storage capabilities are routed to
runner capabilities are routed to
environments that include them.
For more information on what happens when connecting to a capability, see Life of a protocol open.