Revert "[dart sdk] Remove LauncherProxy from StartupContext"
This reverts commit 533e4ef7de47c64aa890f4578df2117e570514de.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> [dart sdk] Remove LauncherProxy from StartupContext
>
> MS-2334 #comment
>
> Test:
> fx run-host-tests fuchsia_services_package_unittests
> fx run-test fuchsia_services_package_integration_tests
>
> Change-Id: Ia9778cc0506bc5541efba51a3d8bea8d6f75d794
TBR=chaselatta@google.com,nkorsote@google.com
Change-Id: I1b8326c325a408887819b31890d49dc0fd9692db
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
diff --git a/public/dart/fuchsia_services/lib/src/internal/_startup_context_impl.dart b/public/dart/fuchsia_services/lib/src/internal/_startup_context_impl.dart
index d6c272a..1d064d1 100644
--- a/public/dart/fuchsia_services/lib/src/internal/_startup_context_impl.dart
+++ b/public/dart/fuchsia_services/lib/src/internal/_startup_context_impl.dart
@@ -22,6 +22,13 @@
class StartupContextImpl implements StartupContext {
static const String _serviceRootPath = '/svc';
+ /// The connection to the [fidl_sys.Launcher] proxy.
+ ///
+ /// Deprecated! instead connect to [fidl_sys.Launcher] via [incoming]
+ // TODO(MS-2334): remove launcher from this class
+ @override
+ final fidl_sys.Launcher launcher;
+
/// The [fidl_sys.ServiceProvider] which can be used to connect to the
/// services exposed to the component on launch.
// TODO(MF-167): Remove from this class
@@ -49,6 +56,7 @@
StartupContextImpl(
{@required this.incoming,
@required this.outgoing,
+ this.launcher,
this.environmentServices})
: assert(incoming != null),
assert(outgoing != null);
@@ -77,6 +85,7 @@
incoming: incomingServices,
outgoing: _getOutgoingFromHandle(outgoingServicesHandle),
environmentServices: _getServiceProvider(incomingServices),
+ launcher: _getLauncher(incomingServices),
);
}
@@ -85,6 +94,7 @@
incoming: Incoming(directoryProxy),
outgoing: Outgoing(),
environmentServices: fidl_sys.ServiceProviderProxy(),
+ launcher: fidl_sys.LauncherProxy(),
);
}
@@ -120,6 +130,7 @@
incoming: incomingSvc,
outgoing: _getOutgoingFromChannel(dirRequestChannel),
environmentServices: _getServiceProvider(incomingSvc),
+ launcher: _getLauncher(incomingSvc),
);
}
@@ -151,6 +162,17 @@
return serviceProviderProxy;
}
+ static fidl_sys.Launcher _getLauncher(Incoming incomingServices) {
+ final launcherProxy = fidl_sys.LauncherProxy();
+
+ // TODO(MS-2334): Use launcher from incoming instead of env
+ // incomingServices.connectToService(
+ // launcherProxy.ctrl.$serviceName, launcherProxy.ctrl.request().passChannel());
+
+ _getEnvironment(incomingServices).getLauncher(launcherProxy.ctrl.request());
+ return launcherProxy;
+ }
+
static fidl_sys.EnvironmentProxy _getEnvironment(Incoming incomingServices) {
if (incomingServices == null) {
throw ArgumentError.notNull('incomingServices');
diff --git a/public/dart/fuchsia_services/lib/src/startup_context.dart b/public/dart/fuchsia_services/lib/src/startup_context.dart
index 8fd522e..af8a0d1 100644
--- a/public/dart/fuchsia_services/lib/src/startup_context.dart
+++ b/public/dart/fuchsia_services/lib/src/startup_context.dart
@@ -17,6 +17,12 @@
abstract class StartupContext {
static StartupContext _startupContext;
+ /// The connection to the [fidl_sys.Launcher] proxy.
+ ///
+ /// Deprecated! instead connect to [fidl_sys.Launcher] via [incoming]
+ // TODO(MS-2334): remove launcher from this class
+ final fidl_sys.Launcher launcher;
+
/// The [fidl_sys.ServiceProvider] which can be used to connect to the
/// services exposed to the component on launch.
// TODO(MF-167): Remove from this class