/** 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