private SemanticsServer.Proxy createSemanticsServer() {
   Core core = CoreImpl.getInstance();
   Pair<SemanticsServer.Proxy, InterfaceRequest<SemanticsServer>> server =
       SemanticsServer.MANAGER.getInterfaceRequest(core);
   mDartServiceProvider.connectToService(
       SemanticsServer.MANAGER.getName(), server.second.passHandle());
   return server.first;
 }
 private void postRun() {
   Core core = CoreImpl.getInstance();
   // Connect to the ApplicationMessages service exported by the Flutter framework
   Pair<ApplicationMessages.Proxy, InterfaceRequest<ApplicationMessages>> appMessages =
       ApplicationMessages.MANAGER.getInterfaceRequest(core);
   mDartServiceProvider.connectToService(
       ApplicationMessages.MANAGER.getName(), appMessages.second.passHandle());
   mFlutterAppMessages = appMessages.first;
 }
Example #3
0
 /** @see Shell#connectToApplication(String, InterfaceRequest, ServiceProvider) */
 @Override
 public void connectToApplication(
     String applicationUrl,
     InterfaceRequest<ServiceProvider> services,
     ServiceProvider exposedServices) {
   int exposedServicesHandle = CoreImpl.INVALID_HANDLE;
   if (exposedServices != null) {
     if (exposedServices instanceof ServiceProvider.Proxy) {
       ServiceProvider.Proxy proxy = (ServiceProvider.Proxy) exposedServices;
       exposedServicesHandle = proxy.getProxyHandler().passHandle().releaseNativeHandle();
     } else {
       Pair<MessagePipeHandle, MessagePipeHandle> pipes =
           CoreImpl.getInstance().createMessagePipe(null);
       ServiceProvider.MANAGER.bind(exposedServices, pipes.first);
       exposedServicesHandle = pipes.second.releaseNativeHandle();
     }
   }
   nativeConnectToApplication(
       applicationUrl,
       services == null ? CoreImpl.INVALID_HANDLE : services.passHandle().releaseNativeHandle(),
       exposedServicesHandle);
 }
  public void destroy() {
    if (discoveryReceiver != null) {
      getContext().unregisterReceiver(discoveryReceiver);
    }

    if (mPlatformServiceProviderBinding != null) {
      mPlatformServiceProviderBinding.unbind().close();
      mPlatformServiceProvider.unbindServices();
    }

    if (mViewServiceProviderBinding != null) {
      mViewServiceProviderBinding.unbind().close();
      mViewServiceProvider.unbindServices();
    }

    getHolder().removeCallback(mSurfaceCallback);
    nativeDetach(mNativePlatformView);
    mNativePlatformView = 0;

    mSkyEngine.close();
    mDartServiceProvider.close();
    mFlutterAppMessages.close();
  }
  private void preRun() {
    if (mPlatformServiceProviderBinding != null) {
      mPlatformServiceProviderBinding.unbind().close();
      mPlatformServiceProvider.unbindServices();
    }
    if (mViewServiceProviderBinding != null) {
      mViewServiceProviderBinding.unbind().close();
      mViewServiceProvider.unbindServices();
    }
    if (mDartServiceProvider != null) {
      mDartServiceProvider.close();
    }

    Core core = CoreImpl.getInstance();

    Pair<ServiceProvider.Proxy, InterfaceRequest<ServiceProvider>> dartServiceProvider =
        ServiceProvider.MANAGER.getInterfaceRequest(core);
    mDartServiceProvider = dartServiceProvider.first;

    Pair<ServiceProvider.Proxy, InterfaceRequest<ServiceProvider>> platformServiceProvider =
        ServiceProvider.MANAGER.getInterfaceRequest(core);
    mPlatformServiceProviderBinding =
        ServiceProvider.MANAGER.bind(mPlatformServiceProvider, platformServiceProvider.second);

    Pair<ServiceProvider.Proxy, InterfaceRequest<ServiceProvider>> viewServiceProvider =
        ServiceProvider.MANAGER.getInterfaceRequest(core);
    mViewServiceProviderBinding =
        ServiceProvider.MANAGER.bind(mViewServiceProvider, viewServiceProvider.second);

    ServicesData services = new ServicesData();
    services.incomingServices = platformServiceProvider.first;
    services.outgoingServices = dartServiceProvider.second;
    services.viewServices = viewServiceProvider.first;
    mSkyEngine.setServices(services);

    resetAccessibilityTree();
  }