Skip to content

Commit

Permalink
[ui] Consolidate scenic routes
Browse files Browse the repository at this point in the history
The goal of this change is to ensure we only need to add new routes
to/from scenic in one CML file.

Bug: 110658
Test: built each affected product

Change-Id: I93f6c00bff986d7f2ccfd3dcf0a2f4cb51aa904d
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/732362
Reviewed-by: Caroline Liu <[email protected]>
Commit-Queue: Alexander Brusher <[email protected]>
Reviewed-by: Sahil Madan <[email protected]>
  • Loading branch information
abrush21 authored and CQ Bot committed Sep 29, 2022
1 parent 4d4195e commit 700d933
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 202 deletions.
65 changes: 65 additions & 0 deletions src/ui/meta/scenic_base_routes.shard.cml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2022 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.

// This shard is shared across all production and test UI realms that
// contain scenic.
//
// It contains any capabilities that:
//
// (1) Scenic exposes from every production or test UI realm in which it's
// present.
// (2) Scenic always consumes from the same source in every production or
// test UI realm in which it's present.
//
// This shard should **NOT** include:
//
// (1) Routes that have different sources in different ui realms. For
// example, scenic consumes the metrics logger factory from "parent"
// in production ui realms, but "#mock_cobalt" in test ui realms.
// (2) Scenic's child definition, as we may use a differnt url for
// scenic in test vs. production ui realms.
// (3) Capabilities that other components consume from scenic. Those
// routes belong on those components' routing shards.
{
offer: [
{
protocol: [
"fuchsia.logger.LogSink",
"fuchsia.scheduler.ProfileProvider",
"fuchsia.stash.Store",
"fuchsia.sysmem.Allocator",
"fuchsia.tracing.provider.Registry",
"fuchsia.vulkan.loader.Loader",
],
from: "parent",
to: [ "#scenic" ],
},
],
expose: [
{
// Expose FlatlandDisplay to the V1 realm for the benefit of
// flatland_benchmark.
// TODO(fxbug.dev/104906): Remove this when no longer needed.
protocol: [ "fuchsia.ui.composition.FlatlandDisplay" ],
from: "#scenic",
},
{
protocol: [
"fuchsia.ui.composition.Allocator",
"fuchsia.ui.composition.Flatland",
"fuchsia.ui.composition.internal.ScreenCapture",
"fuchsia.ui.composition.ScreenCapture",
"fuchsia.ui.composition.Screenshot",
"fuchsia.ui.display.internal.DisplayPower",
"fuchsia.ui.display.singleton.Info",
"fuchsia.ui.focus.FocusChainListenerRegistry",
"fuchsia.ui.pointer.augment.GlobalMouse",
"fuchsia.ui.pointerinjector.Registry",
"fuchsia.ui.scenic.Scenic",
"fuchsia.ui.views.ViewRefInstalled",
],
from: "#scenic",
},
],
}
63 changes: 63 additions & 0 deletions src/ui/meta/scenic_routes.shard.cml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2022 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.

// This shard includes the portion of the scenic layer that is common
// across all production ui realms that include scenic, but differs from
// test ui realms.
//
// Production ui realms should include this shard directly.
//
// This shard should include:
//
// (1) Scenic's child declaration. Note that other shards assume the name
// "scenic".
// (2) Capability routes to scenic that are the same for all production ui
// realms in which scenic is present, but differ in test realms.
//
// This shard should **NOT** include:
//
// (1) Routes that are common to all production and test ui realms; these
// routes belong in scenic_base_routes.shard.cml.
// (2) Routes to scenic that differ among production ui realms.
// (3) Routes **FROM** scenic to other components in the ui realm; these
// routes belong in the target components' routing shards.
{
include: [ "//src/ui/meta/scenic_base_routes.shard.cml" ],
children: [
{
// DO NOT CHANGE THIS NAME -- OTHER SHARDS DEPEND ON IT.
name: "scenic",
url: "fuchsia-pkg://fuchsia.com/scenic#meta/scenic.cm",
},
],
offer: [
{
directory: "config-data",
from: "parent",
to: [ "#scenic" ],
subdir: "scenic",
},
{
directory: "dev-display-controller",
from: "parent",
to: "#scenic",
},
{
storage: "tmp",
from: "parent",
to: "#scenic",
},

// Additional services scenic uses, which are not defined in
// scenic_base_routes.shard.cml.
{
protocol: [
"fuchsia.media.ProfileProvider",
"fuchsia.metrics.MetricEventLoggerFactory",
],
from: "parent",
to: [ "#scenic" ],
},
],
}
64 changes: 5 additions & 59 deletions src/ui/meta/ui.cml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
{
include: [ "syslog/client.shard.cml" ],
include: [
// Defines a base set of services scenic uses and exposes.
"//src/ui/meta/scenic_routes.shard.cml",
"syslog/client.shard.cml",
],
children: [
{
// Centralized management of accessibility features.
Expand All @@ -14,11 +18,6 @@
name: "scene_manager",
url: "fuchsia-pkg://fuchsia.com/scene_manager#meta/scene_manager.cm",
},
{
// Display server.
name: "scenic",
url: "fuchsia-pkg://fuchsia.com/scenic#meta/scenic.cm",
},
{
// Centralized management of keyboard shortcuts.
// TODO(fxbug.dev/104239): Configure presence via build flag.
Expand All @@ -37,33 +36,17 @@
},
],
offer: [
{
directory: "config-data",
from: "parent",
to: [ "#scenic" ],
subdir: "scenic",
},
{
directory: "config-data",
from: "parent",
to: [ "#scene_manager" ],
subdir: "scene_manager",
},
{
directory: "dev-display-controller",
from: "parent",
to: "#scenic",
},
{
directory: "dev-input-report",
from: "parent",
to: [ "#scene_manager" ],
},
{
storage: "tmp",
from: "parent",
to: "#scenic",
},
{
protocol: [
"fuchsia.logger.LogSink",
Expand All @@ -73,7 +56,6 @@
to: [
"#a11y_manager",
"#scene_manager",
"#scenic",
"#shortcut_manager",
"#text_manager",
"#virtual_keyboard_manager",
Expand All @@ -98,18 +80,6 @@
from: "parent",
to: [ "#scene_manager" ],
},
{
protocol: [
"fuchsia.media.ProfileProvider",
"fuchsia.metrics.MetricEventLoggerFactory",
"fuchsia.scheduler.ProfileProvider",
"fuchsia.stash.Store",
"fuchsia.sysmem.Allocator",
"fuchsia.vulkan.loader.Loader",
],
from: "parent",
to: [ "#scenic" ],
},
{
protocol: [
"fuchsia.ui.input.ImeService",
Expand Down Expand Up @@ -205,30 +175,6 @@
},
],
expose: [
{
// Expose FlatlandDisplay to the V1 realm for the benefit of
// flatland_benchmark.
// TODO(fxbug.dev/104906): Remove this when no longer needed.
protocol: [ "fuchsia.ui.composition.FlatlandDisplay" ],
from: "#scenic",
},
{
protocol: [
"fuchsia.ui.composition.Allocator",
"fuchsia.ui.composition.Flatland",
"fuchsia.ui.composition.internal.ScreenCapture",
"fuchsia.ui.composition.ScreenCapture",
"fuchsia.ui.composition.Screenshot",
"fuchsia.ui.display.internal.DisplayPower",
"fuchsia.ui.display.singleton.Info",
"fuchsia.ui.focus.FocusChainListenerRegistry",
"fuchsia.ui.pointer.augment.GlobalMouse",
"fuchsia.ui.pointerinjector.Registry",
"fuchsia.ui.scenic.Scenic",
"fuchsia.ui.views.ViewRefInstalled",
],
from: "#scenic",
},
{
protocol: [
"fuchsia.accessibility.gesture.ListenerRegistry",
Expand Down
64 changes: 5 additions & 59 deletions src/ui/meta/ui_minimal.cml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
{
include: [ "syslog/client.shard.cml" ],
include: [
// Defines a base set of services scenic uses and exposes.
"//src/ui/meta/scenic_routes.shard.cml",
"syslog/client.shard.cml",
],
children: [
{
// Centralized management of accessibility features.
Expand All @@ -14,11 +18,6 @@
name: "scene_manager",
url: "fuchsia-pkg://fuchsia.com/scene_manager#meta/scene_manager.cm",
},
{
// Display server.
name: "scenic",
url: "fuchsia-pkg://fuchsia.com/scenic#meta/scenic.cm",
},
{
// Centralized management of text entry.
name: "text_manager",
Expand All @@ -31,33 +30,17 @@
},
],
offer: [
{
directory: "config-data",
from: "parent",
to: [ "#scenic" ],
subdir: "scenic",
},
{
directory: "config-data",
from: "parent",
to: [ "#scene_manager" ],
subdir: "scene_manager",
},
{
directory: "dev-display-controller",
from: "parent",
to: "#scenic",
},
{
directory: "dev-input-report",
from: "parent",
to: [ "#scene_manager" ],
},
{
storage: "tmp",
from: "parent",
to: "#scenic",
},
{
protocol: [
"fuchsia.logger.LogSink",
Expand All @@ -67,7 +50,6 @@
to: [
"#a11y_manager",
"#scene_manager",
"#scenic",
"#text_manager",
"#virtual_keyboard_manager",
],
Expand All @@ -92,18 +74,6 @@
from: "parent",
to: [ "#scene_manager" ],
},
{
protocol: [
"fuchsia.media.ProfileProvider",
"fuchsia.metrics.MetricEventLoggerFactory",
"fuchsia.scheduler.ProfileProvider",
"fuchsia.stash.Store",
"fuchsia.sysmem.Allocator",
"fuchsia.vulkan.loader.Loader",
],
from: "parent",
to: [ "#scenic" ],
},
{
protocol: [
"fuchsia.ui.input.ImeService",
Expand Down Expand Up @@ -182,30 +152,6 @@
},
],
expose: [
{
// Expose FlatlandDisplay to the V1 realm for the benefit of
// flatland_benchmark.
// TODO(fxbug.dev/104906): Remove this when no longer needed.
protocol: [ "fuchsia.ui.composition.FlatlandDisplay" ],
from: "#scenic",
},
{
protocol: [
"fuchsia.ui.composition.Allocator",
"fuchsia.ui.composition.Flatland",
"fuchsia.ui.composition.internal.ScreenCapture",
"fuchsia.ui.composition.ScreenCapture",
"fuchsia.ui.composition.Screenshot",
"fuchsia.ui.display.internal.DisplayPower",
"fuchsia.ui.display.singleton.Info",
"fuchsia.ui.focus.FocusChainListenerRegistry",
"fuchsia.ui.pointer.augment.GlobalMouse",
"fuchsia.ui.pointerinjector.Registry",
"fuchsia.ui.scenic.Scenic",
"fuchsia.ui.views.ViewRefInstalled",
],
from: "#scenic",
},
{
protocol: [
"fuchsia.accessibility.gesture.ListenerRegistry",
Expand Down
Loading

0 comments on commit 700d933

Please sign in to comment.