docs: public void release(AndroidDevice device, AndroidApp aut) {
      log.info("Releasing device " + device);
      if (devicesInUse.contains(device)) {
  
        if (aut != null) {
          // stop the app anyway - better in case people do use snapshots
          try {
            device.kill(aut);
          } catch (Exception e) {
            log.log(Level.WARNING, "Failed to kill android application when releasing device", e);
          }
  
          if (clearData) {
            try {
              device.clearUserData(aut);
            } catch (AndroidSdkException e) {
              log.log(Level.WARNING, "Failed to clear user data of application", e);
            }
          }
        }
  
        if (device instanceof AndroidEmulator && !(aut instanceof InstalledAndroidApp) && !keepEmulator) {
          AndroidEmulator emulator = (AndroidEmulator) device;
          try {
            emulator.stop();
          } catch (AndroidDeviceException e) {
            log.severe("Failed to stop emulator: " + e.getMessage());
          }
          androidEmulatorPortFinder.release(emulator.getPort());
        }
        devicesInUse.remove(device);
      }
    }