示例#1
0
  synchronized void destroy() {
    IDroneApi droneApi = droneApiRef.get();

    removeAttributesObserver(droneApi, this.droneObserver);

    try {
      if (isStarted(droneApi)) {
        droneApi.asBinder().unlinkToDeath(binderDeathRecipient, 0);
        serviceMgr.get3drServices().releaseDroneApi(droneApi);
      }
    } catch (RemoteException | NoSuchElementException e) {
      Log.e(TAG, e.getMessage(), e);
    }

    if (asyncScheduler != null) {
      asyncScheduler.shutdownNow();
      asyncScheduler = null;
    }

    droneApiRef.set(null);
  }