blob: ea4a21461dc7ab28199a2aaf7e5fcee600c31309 [file] [log] [blame]
// Copyright 2016 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.modular.internal;
using fuchsia.io;
using fuchsia.sys;
using fuchsia.ui.views;
/// The basemgr application (there is no `Basemgr` service) requests
/// an instance of this service in order to launch and display a `Sessionmgr`.
@discoverable // Created by sessionmgr application.
protocol Sessionmgr {
/// Launches a sessionmgr instance identified by a unique device-local
/// `session_id`. The uniqueness of `session_id` must be guaranteed by the
/// caller, because `sessionmgr` creates an Environment namespace with the
/// given `session_id`, and this will crash if we try to create an
/// environment with a pre-existing name, because the services sessionmgr
/// tries to access won't be available.
///
/// `additional_services_for_agents` is currently used by `basemgr` to
/// expose specified services from CFv2 components to `sessionmgr` so they
/// can be used by CFv1 components.
///
/// `services_from_sessionmgr` is a handle to a subdirectory
/// (`/svc_from_v1_sessionmgr`) in the caller's (basemgr's) outgoing
/// directory, which should be populated by sessionmgr with services from
/// CFv1 components (such as agent services and modular APIs like
/// PuppetMaster) so they can also be used by CFv2 components hosted by
/// basemgr.
Initialize(resource struct {
session_id string:MAX;
session_context client_end:SessionContext;
additional_services_for_agents fuchsia.sys.ServiceList;
services_from_sessionmgr server_end:fuchsia.io.Directory;
/// If unset, sessionmgr will run in "headless" mode, i.e. without
/// graphics, and will not request or present mod views.
view_params strict resource union {
/// A token for the Flatland view that is created by the session shell
/// launched by sessionmgr, and presented by basemgr as the root view.
1: view_creation_token fuchsia.ui.views.ViewCreationToken;
/// Used to create the Gfx session shell view, passed to the session
/// shell component launched by sessionmgr, and presented by basemgr
/// as the root view.
2: gfx_view_params resource struct {
view_token fuchsia.ui.views.ViewToken;
control_ref fuchsia.ui.views.ViewRefControl;
view_ref fuchsia.ui.views.ViewRef;
};
/// If true, sessionmgr will request Flatland views from mods,
/// or Gfx views otherwise.
3: use_flatland bool;
}:optional;
});
};
/// This interface is provided by basemgr to `Sessionmgr`.
protocol SessionContext {
/// Restarts the session.
Restart();
/// Restarts the session due to an unrecoverable error. This may reboot the
/// device.
RestartDueToCriticalFailure();
};