Triage and fix of a DocumentsProvider in the Termux Android app

On Android, applications are restricted from interacting with other applications. Thus it can be difficult to share data between different apps.

While Android is running a (modified) linux kernel, not every device manufacturer used to include the fuse library for mounting storage devices. Newer versions include fuse, but do not grant normal user space apps access. Instead, Google introduced the Storage Access Framework or SAF for short. SAF is a set of APIs that extend the ContentProvider mechanism to provide or access data managed by other apps.

Termux is one such Android app. Termux emulates a terminal and various binaries, bringing the usual linux tools to mobile devices. To exchange files with other apps, a DocumentProvider can be set up. While working on a different app, I noticed that Termux did not properly implement this provider interface and forwarded this info to the project. However, as with most open-source projects, not much happened until I returned to fix the issue myself. While already working on the DocumentProvider, I also noticed that tree support was missing, and fixed that as well. All in all a successful debugging session.

Project link: https://github.com/termux/termux-app/

Nifty tech tag lists fromĀ Wouter Beeftink