/** Shutdown the {@link ControlPanelService} */
  public void shutdown() {
    Log.d(TAG, "Shutdown ControlPanelService");

    if (announcementReceiver != null) {

      AboutService aboutService = AboutServiceImpl.getInstance();
      for (String iface : ANNOUNCEMENT_IFACES) {
        aboutService.removeAnnouncementHandler(announcementReceiver, new String[] {iface});
      }
    }

    if (deviceRegistry != null) {
      Log.d(TAG, "Clear devices registry");
      for (ControllableDevice device : deviceRegistry.getDevices().values()) {
        stopControllableDevice(device);
      }
      deviceRegistry = null;
    }

    TaskManager taskManager = TaskManager.getInstance();
    if (taskManager.isRunning()) {
      taskManager.shutdown();
    }

    connMgr.shutdown();
  } // shutdown
  /**
   * Signal handler
   *
   * @see org.alljoyn.ioe.controlpanelservice.communication.interfaces.Container#MetadataChanged()
   */
  @Override
  public void MetadataChanged() throws BusException {

    String msg =
        "Device: '"
            + containerWidget.device.getDeviceId()
            + "', ContainerWidget: '"
            + containerWidget.objectPath
            + "', received METADATA_CHANGED signal";

    Log.d(TAG, msg);

    final ControlPanelEventsListener eventsListener =
        containerWidget.controlPanel.getEventsListener();
    try {
      containerWidget.refreshProperties();
    } catch (ControlPanelException cpe) {
      msg += ", but failed to refresh the Container properties";
      Log.e(TAG, msg);
      eventsListener.errorOccurred(containerWidget.controlPanel, msg);
      return;
    }

    // Delegate to the listener on a separate thread
    TaskManager.getInstance()
        .execute(
            new Runnable() {
              @Override
              public void run() {
                eventsListener.metadataChanged(containerWidget.controlPanel, containerWidget);
              }
            });
  } // MetadataChanged
 /**
  * Starts {@link ControlPanelService} without discovering new devices in proximity
  *
  * @param bus
  */
 public void init(BusAttachment bus) throws ControlPanelException {
   connMgr.setBusAttachment(bus);
   TaskManager.getInstance().initPool();
 } // init