fuchsia.ui.app

Added: 7

PROTOCOLS

View

Defined in fuchsia.ui.app/view.fidl

A View is an interface that a component implements to offer a Scenic view to its clients. A Scenic view is container of Scenic graph nodes, which, when rendered, might display a graphical user interface, such as a module, shell, or on-screen keyboard.

A client of the View interface will:

  1. Launch (or bind to) the component that provides the interface.
  2. Connect to the component's View interface.
  3. Call SetConfig() at least once to configure the view's presentation parameters.
  4. Call AttachView() to ask the View to attach its graphical content to the Scenic scene graph using the provided view_token.
  5. Optionally, while the View is attached, call SetConfig() again to modify any presentation parameters as needed.

When the client no longer needs the View, it should disconnect from the interface and terminate (or unbind) from the component.

NOTE: Unlike with ViewProvider, the client owns the View instance and must retain it for the lifetime of the UI that it displays. If the View instance is destroyed, the connection will be dropped.

On the implementation side, a component that exposes the View interface has the following responsibilities:

  • Initialize and attach the View's content to the Scenic scene graph using the fuchsia.ui.view.CreateViewCmd and passing the provided view_token.
  • Adjust the appearance and/or contents of the view's content whenever its ViewConfig changes.
  • Provide graphical content for the view and handle user interface events such as touches, key presses, and fuchsia.ui.view.ViewProperty changes using other Scenic interfaces such as fuchsia.ui.Scenic and fuchsia.ui.SessionListener.

TODO(https://fxbug.dev/42098595): Migrate all implementations of ViewProvider to use View.

Removed: 14 Deprecated: 13

Attach

Attaches the View to Scenic's scene graph. Must only be called once per View lifetime.

The View's implementation should pass the view_token to Scenic using a fuchsia.ui.view.CreateViewCmd.

Request

NameType
view_token handle<eventpair>

SetConfig

Updates the View's configuration.

To prevent triggering UI changes shortly after a client starts up, the View's client should set the configuration prior to calling AttachView() unless the default is adequate.

May be called again at any time to modify the view's configuration.

Request

NameType
config ViewConfig

ViewProvider

Defined in fuchsia.ui.app/view_provider.fidl

ViewProvider is the standard mechanism for two modules to each obtain half of a shared eventpair token. The shared token is a capability allowing the modules to ask Scenic to create a ViewHolder/View pair. The resulting View and ViewHolder are linked together until either one is destroyed.

Modules are free to use any other mechanism to agree upon the shared eventpair token, and use this to create the linked ViewHolder/View. ViewProvider is given for the convenience of clients that don't require a more complex implementation.

CreateView2

Creates a new View under the control of the ViewProvider.

The args are provided as a table, for forward compatibility. See documentation on the individual table fields.

Request

NameType
args CreateView2Args

CreateViewWithViewRef

Creates a new View under the control of the ViewProvider.

token is one half of the shared eventpair which will bind the new View to its associated ViewHolder. The ViewProvider will use token to create its internal View representation. The caller is expected to use its half to create corresponding ViewHolder object.

view_ref_control and view_ref are two typed handles to each half of the same event pair. The view_ref can be cloned before passing it to this method, which will allow clients to track the view (e.g., in a focus chain update).

view_ref_control must not have the ZX_RIGHT_DUPLICATE set, or view creation will fail.

Deprecated: 13

Request

NameType
token handle<eventpair>
view_ref_control fuchsia.ui.views/ViewRefControl
view_ref fuchsia.ui.views/ViewRef

STRUCTS

ViewConfig

Defined in fuchsia.ui.app/view_config.fidl

Collection of properties that provide affect the rendering of a view's contents. This might include internationalization settings, font scaling, night mode, high contrast mode, etc.

Removed: 14 Deprecated: 13

FieldTypeDescriptionDefault
intl_profile fuchsia.intl/Profile No default

TABLES

CreateView2Args resource

Defined in fuchsia.ui.app/view_provider.fidl

OrdinalFieldTypeDescription
view_creation_token fuchsia.ui.views/ViewCreationToken

Non-optional. This token can be provided to Flatland to attach the client's child view to the parent's viewport.