Skip to content

Update SSHD Core to the latest version

This MR updates the SSHD Core used in the SFTP Plugin to the latest version.

The updated SSHD Core utilizes Java NIO2, which is only available on Android 8.0 and above. To ensure compatibility with lower Android versions, the following adjustments have been made:

  • Replaced the desugar library com.android.tools:desugar_jdk_libs with com.android.tools:desugar_jdk_libs_nio to provide NIO support.
  • Modified the bytecode in org.apache.sshd.common.subsystem.sftp.SftpHelper to bypass a type check that was broken by the desugar library.
  • Added org.kde.kdeconnect.Helpers.CollectionsBackport and replaced some java.util.Collections calls with this backport by modifying the bytecode, as certain methods are unavailable before Android 8.0.
  • Used Apache MINA as the IO Service for SSHD Core on Android versions prior to 8.0, and NIO2 for versions 8.0 and above, due to the desugar library's inability to patch some critical classes.
  • Wrapped java.nio.channels.FileChannel with the desugar library to fix compatibility issues on Android versions before 7.0.

The current implementation works well on multiple test devices and virtual machines, but still requires extensive validation.

This is a Google Summer of Code 2024 project: Update SSHD library in KDE Connect Android app.

Merge request reports

Loading