Skip to content

v2.5.0: API bridge, tool screens, Amazon + NixOS catalogue, custom installer - #39

Merged
GlobalTechInfo merged 15 commits into
mainfrom
feature/termux-api
Nov 16, 2026
Merged

GlobalTechInfo merged 15 commits into
mainfrom
feature/termux-api

Conversation

@GlobalTechInfo

Copy link
Copy Markdown
Owner

Summary

Promotes the accumulated feature/termux-api work to main: the in-app
Android API bridge (v2.4.0), the tool screens (v2.4.1), and the distro
catalogue with Amazon + NixOS and the file/URL/OCI installer (v2.5.0).
13 commits, app version 2.5.0 (code 9).

Changes

  • v2.4.0 — in-app Android API bridge: a redterm-api socket bridge
    (native per-ABI helper, bionic-linked) that exposes the session's file
    system to host-side tooling; the defensible permission profile; the
    user startup hook; zero-warning compile with withdrawn members reached
    by name.
  • v2.4.1 — tool screens: workspaces, startup hook, snippets, distro
    dashboard, multi port forwards, SSH tunnels, SFTP transfer queue,
    scheduled guest jobs, local port forward; recording GIF export and
    0.5x/1x/2x/4x playback speed; workspace pin and split-open.
  • v2.5.0 — catalogue and installer: Amazon (AL2027, dnf) and NixOS
    26.05 joined the built-in catalogue, each with its own icon; the NixOS
    image ships nix itself, so sessions install packages over the network
    through the registry commands (nix profile install, nix shell,
    nix run), its channel table points at the live nixpkgs-unstable
    alias, and the session environment names the CA bundle so standalone
    HTTPS verifies. Custom distro installer: from a tarball, a URL, or a
    Docker/OCI image (registry-v2 pull, layer order, compression read from
    magic bytes). Version 2.5.0 / code 9; Gradle 9.9.1.

How it was tested

  • Built and gated on the aarch64 build host: ./gradlew test
    704 tests / 0 failures; lint reports exactly the three allowed
    Aligned16KB warnings, 0 errors; assembleDebug clean
    (2.5.0 / code 9, ~34 MB).
  • The Amazon and NixOS images are published from the rootfs-images
    pipeline; the registry digests in DistroRegistry match the live
    release assets byte-for-byte (the publish step's index-stamping order
    was fixed and the published index verified against the assets).
  • NixOS session behaviour proven under proot on the host: nix run nixpkgs#hello, standalone curl over HTTPS, channel table present.
  • Not yet verified on a device — this PR is the decision point for that.

Checklist

  • Builds and passes ./gradlew assembleDebug lintDebug (gate on the build host)
  • CHANGELOG.md updated under ## [v2.5.0] — this PR is the v2.5.0 release, so the entry is under the release heading rather than Unreleased
  • No unrelated changes included

…ile, and the user startup hook

The Termux:API command surface runs entirely in-app: a per-ABI C helper
spoke the abstract-UDS wire protocol with a listener in the app process,
and the guest scripts reach Android features without a second SSH, camera or
SMS stack. The manifest is trimmed to a defensible core so the app stops
reading as a trojan profile to Play Protect, and the dispatch gate
distinguishes a missing grant from an undeclared permission so affected
commands answer honestly instead of dying in a pipe.

/root/.startup.local is the user-managed, once-per-interactive-session
startup hook (issue 32); it is in the shared tail of the generated startup
for all twenty distros, and redterm-startup-local prints a safe starter
body that is a no-op wherever run-parts or /etc/update-motd.d is absent.

versionCode 8 / versionName 2.4.0.
…erence

The gate is reading the w: lines of compileDebugKotlin, not the exit
code, and 13 compiler warnings had slipped through being reported as a
clean build. None is fixed by a suppression:

- The five unchecked as? List<T> casts on reflective results
  (CellInfoApi, NetworkApis, SsidApi) become a star-projection cast plus
  per-element concrete casts, which the compiler can check.
- The eight deprecated references stop being references:
  ScanResult.SSID is read by name (withdrawn on 33); setVisibleInDownloadsUi
  is invoked reflectively on the levels where it still has effect (<29, a
  documented no-op since); the no-arg MediaRecorder is reached by name with
  the Context constructor on 34+; the withdrawn CDMA/EHRPD/1xRTT constants
  stand as their stable documented values; the three-argument Locale
  constructor becomes Locale.forLanguageTag (non-deprecated on every level
  the app runs); and setWifiEnabled is reached by name on the declared
  type.
…unded reads, and close the review's gaps

Guest paths are named on the distro side, but the bridge opens them in the
app process. The launcher now exports REDTERM_ROOTFS_HOST, the guest helper
attaches it to every request, and ApiPaths is the one place that projects a
guest path to the host path it actually lives at (or refuses it). Share,
storage-get, media-play and media-scan all go through it.

Also, per the review:
- ApiSocket reads run on a bounded pool with a deadline; LocalSocket has no
  read-timeout API, so a stuck peer is bounded by the pool cap and closed,
  not pinned. Response bodies over the uint16 field are refused, not sent.
- A read/write size cap on saf readDocument; a counter-range guard; a
  bounded callback read; a non-cyclic media scan; a bound on concurrent
  requests.
- A single JSON string encoder (ApiJson) so an SSID with control bytes is
  valid JSON; TtsApi keeps the exact language/region/variant; the wifi
  toggle checks its grant and a present boolean flag; NFC rejects a disabled
  radio, re-enables reader mode on resume, and posts a cancel on destroy.
- installOne only replaces scripts it owns (the marker); ensureInstalled
  clears just the binary and stamp, keeping feature output.
- the startup-hook sourcing test now runs the block the generator emits,
  not a hand copy.

Helper binaries rebuilt for all four ABIs; GUEST_SCRIPT_VERSION is 7.
…host wire line

con.peerCredentials can throw IOException; unguarded it skipped every
writeResponse and the guest saw 'no response from the app'. The uid
guard now catches the read and says which way it closed, instead of
vanishing.

Also pin the parser against the exact rootfs-host line the rebuilt
helper puts on the wire, and finish the F-Droid metadata for v2.4.0.
A 'no response from the app' from the guest means the connection was
accepted and then closed without an answer. Several paths did that
silently: the uid guard (peerCredentials can throw), a peer that
closed before sending, and nothing marked the listener coming up.
Every outcome now logs, so the next on-device run says exactly which
branch closed the connection instead of vanishing.

Also pin the parser against the battery-status wire line with the
rootfs-host extra the rebuilt helper emits.
… pool

On device the pooled read stopped after 'connection accepted; reading
request' and never reached any outcome, so the guest saw 'no response
from the app'. The last release read inline on the request thread and
worked. Revert that one change: a stuck peer blocks only its own
request thread (capped by the semaphore), which LocalSocket cannot
bound any other way, and is the approach that is proven on device.
The safe uid guard and the per-outcome logging are kept.
…r-request log

- stop no longer closes the listener: it was the guest's only channel to
  the app, so a stopped bridge could never be started again from the
  guest (redterm-api-start answered 'Connection refused'). The listener
  now stays up; stop flips an enabled flag, and the stopped bridge
  answers every feature request with a readable refusal while the
  lifecycle action still gets through to re-enable it.
- The SAF tree intent dropped CATEGORY_OPENABLE: the document UI's tree
  filter declares the default category, so the extra category made the
  picker unresolvable ('No Activity found to handle OPEN_DOCUMENT_TREE').
- Per-request debug lines sit behind a VERBOSE=false const, so the
  compiler drops them from the build; the critical state and error
  lines are kept.
…ard, multi port forwards, ssh tunnels, sftp queue, scheduled jobs
- Custom installer (file/URL/registry) reachable from the Welcome screen,
  the Distro dashboard, and More tools. Registry images go through the
  registry-v2 flow (anonymous token, per-arch manifest); file/URL
  compression is read from magic bytes, not the extension.
- Fixes to that path: the install button re-enables on input and after a
  failure; the token request honours the registry 401 challenge's
  service/scope; extraction no longer strips a leading bin/ off standard
  rootfs archives (catalogue path unchanged).
- Amazon Linux (amzn/amzn2/amzn2023) is its own key so its own amzn2-*
  repos are kept instead of being overwritten by a mis-detected fedora plan.
- Mosh reachability probe + tunnel suggestion for silent mosh sessions.
- Recording GIF export and 0.5x-4x playback speed.
- Workspace pin to home and open-into-split-pane.
- Scheduled job history, notification output tail, and failure backoff.
- build-openssh.sh: --prefix=/usr --sysconfdir=/etc/ssh so rebuilt ssh
  binaries stop carrying the build host's paths.

Bump to 2.5.0 (versionCode 9); CHANGELOG updated.
- amazonlinux and nixos join the built-in catalogue: Amazon Linux is
  the 2027 generation from Amazon's public ECR (AL2 ended support,
  the 2023 line is the one 2027 replaces), NixOS is the 26.05
  channel ISO unpacked to its store. Both are built and published
  by the rootfs-images pipeline; the records carry the v1.0.0
  release URLs, sha256s and measured install sizes.
- Amazon Linux resolves to dnf, the manager its image carries, and
  the first-start rescue line is corrected: dnf has no -q, and the
  quiet slot now carries nothing instead of a flag it would reject.
- NixOS reports as the named nix manager with its own
  package-updates explanation: the store ships the tools and carries
  no channel closure, so a newer image is the update path. Its
  first-start plan is an explicit no-op, not the unrecognised-ID
  fallback.
- Tests: the nixos key and its no-op plan, the amazonlinux/nix
  manager mapping, plus the registry invariants the two records
  must satisfy. 703 tests, 0 failures; lint 0 errors.
- The amazonlinux and nixos records carried the shas of tarballs built
  on this host; the pipeline's chroot leaves a different rpm database
  state, so the published assets are not byte-identical and the app's
  download verification would have refused them. The records now carry
  the digests the v1.0.0 release actually serves.
- The nixos record also drops to the pruned size: the image store is
  trimmed to the session's dynamic closure, 5.2 GB down to ~560 MB.
- The sudo shim now writes into every writable bin directory that
  exists rather than a hardcoded /usr/bin: NixOS has no /usr, its /bin
  and /sbin are farm links into the store, and its PATH orders /sbin
  before /bin, so a shim in one still lost to the real PAM sudo in the
  other. A store-carried sudo is read-only, so the old one is unlinked
  first.
The NixOS registry entry now points at the published image that ships
the nix tool family: registry-based installs (nix profile install,
nix shell, nix run) work in a session, the nixpkgs channel is
registered on the live nixpkgs-unstable alias, and the session's
environment names the CA bundle so standalone HTTPS verifies.
installSizeMb matches the pruned image. The card text says which
install path is supported and that the classic channel update is not
it. Amazon shows as 'Amazon'; both distros carry their icons.

The changelog's v2.5.0 section records the nix items (the premature
v2.6.0 section is gone), the version is 9/2.5.0 as released, and the
Gradle wrapper moves to 9.9.1 so the plugin-version notice stops
showing in builds.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 104 files, which is 4 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 267c0d58-2cf0-456c-9ccf-2434fe57456e
Commits

Reviewing files that changed from the base of the PR and between e1d26ed and b703526.

Files ignored due to path filters: 2

  • app/src/main/assets/distro-icons/amazonlinux.png is excluded by !**/*.png
  • app/src/main/assets/distro-icons/nixos.png is excluded by !**/*.png
Files selected for processing: 104

  • .fdroid/com.redtermapp.yml
  • CHANGELOG.md
  • app/build.gradle.kts
  • app/src/main/AndroidManifest.xml
  • app/src/main/java/com/redtermapp/RedTermApp.kt
  • app/src/main/java/com/redtermapp/distro/DistroInstaller.kt
  • app/src/main/java/com/redtermapp/distro/DistroOsRelease.kt
  • app/src/main/java/com/redtermapp/distro/DistroRegistry.kt
  • app/src/main/java/com/redtermapp/distro/DistroSetup.kt
  • app/src/main/java/com/redtermapp/distro/PackageUpdater.kt
  • app/src/main/java/com/redtermapp/distro/RegistryPuller.kt
  • app/src/main/java/com/redtermapp/distro/RegistryRef.kt
  • app/src/main/java/com/redtermapp/distro/RootfsInstallExtractor.kt
  • app/src/main/java/com/redtermapp/distro/TarballFormat.kt
  • app/src/main/java/com/redtermapp/ui/DistroDashboardActivity.kt
  • app/src/main/java/com/redtermapp/ui/ForwardManager.kt
  • app/src/main/java/com/redtermapp/ui/ForwardPersistence.kt
  • app/src/main/java/com/redtermapp/ui/ForwardPresetStore.kt
  • app/src/main/java/com/redtermapp/ui/JobHistoryStore.kt
  • app/src/main/java/com/redtermapp/ui/LocalDistroInstallActivity.kt
  • app/src/main/java/com/redtermapp/ui/LocalPortForward.kt
  • app/src/main/java/com/redtermapp/ui/LocalPortForwardActivity.kt
  • app/src/main/java/com/redtermapp/ui/MainActivity.kt
  • app/src/main/java/com/redtermapp/ui/MoreToolsActivity.kt
  • app/src/main/java/com/redtermapp/ui/OrphanSweeper.kt
  • app/src/main/java/com/redtermapp/ui/PackageUpdateActivity.kt
  • app/src/main/java/com/redtermapp/ui/PlaybackPacing.kt
  • app/src/main/java/com/redtermapp/ui/RecordingActivity.kt
  • app/src/main/java/com/redtermapp/ui/RecordingIndex.kt
  • app/src/main/java/com/redtermapp/ui/RecordingPlayerActivity.kt
  • app/src/main/java/com/redtermapp/ui/ScheduledJobStore.kt
  • app/src/main/java/com/redtermapp/ui/ScheduledJobWorker.kt
  • app/src/main/java/com/redtermapp/ui/ScheduledJobsActivity.kt
  • app/src/main/java/com/redtermapp/ui/ScreenWidgets.kt
  • app/src/main/java/com/redtermapp/ui/SettingsActivity.kt
  • app/src/main/java/com/redtermapp/ui/SnippetLibraryActivity.kt
  • app/src/main/java/com/redtermapp/ui/SnippetStore.kt
  • app/src/main/java/com/redtermapp/ui/SshManagerActivity.kt
  • app/src/main/java/com/redtermapp/ui/StartupHookActivity.kt
  • app/src/main/java/com/redtermapp/ui/TerminalActivity.kt
  • app/src/main/java/com/redtermapp/ui/TerminalGif.kt
  • app/src/main/java/com/redtermapp/ui/TerminalTheming.kt
  • app/src/main/java/com/redtermapp/ui/TransferPlan.kt
  • app/src/main/java/com/redtermapp/ui/TransferQueue.kt
  • app/src/main/java/com/redtermapp/ui/TransferQueueActivity.kt
  • app/src/main/java/com/redtermapp/ui/TunnelManager.kt
  • app/src/main/java/com/redtermapp/ui/TunnelManagerActivity.kt
  • app/src/main/java/com/redtermapp/ui/TunnelPlan.kt
  • app/src/main/java/com/redtermapp/ui/WelcomeActivity.kt
  • app/src/main/java/com/redtermapp/ui/WorkspaceActivity.kt
  • app/src/main/java/com/redtermapp/ui/WorkspaceStore.kt
  • app/src/main/java/com/redtermapp/ui/filelist/BaseFileBrowserActivity.kt
  • app/src/main/java/com/redtermapp/ui/filelist/FileSource.kt
  • app/src/main/java/com/redtermapp/ui/filelist/LocalDistroSource.kt
  • app/src/main/java/com/redtermapp/ui/filelist/SftpBrowserActivity.kt
  • app/src/main/java/com/redtermapp/ui/filelist/SftpSource.kt
  • app/src/main/java/com/redtermapp/util/DeviceResources.kt
  • app/src/main/java/com/redtermapp/util/GifFramePlan.kt
  • app/src/main/java/com/redtermapp/util/GifWriter.kt
  • app/src/main/java/com/redtermapp/util/MoshUdpProbe.kt
  • app/src/main/java/com/redtermapp/util/SshClient.kt
  • app/src/main/java/com/redtermapp/util/UdpHoleProbe.kt
  • app/src/main/java/com/redtermapp/util/api/ApiHelper.kt
  • app/src/main/java/com/redtermapp/util/api/ApiLifecycleApi.kt
  • app/src/main/java/com/redtermapp/util/api/ApiSocket.kt
  • app/src/main/java/com/redtermapp/util/api/ui/ApiSafGrantActivity.kt
  • app/src/main/java/com/redtermapp/util/sftp/DirSearch.kt
  • app/src/main/java/com/redtermapp/util/sftp/DirWalk.kt
  • app/src/main/java/com/redtermapp/util/sftp/SftpClient.kt
  • app/src/main/res/layout/activity_settings.xml
  • app/src/main/res/menu/file_browser_menu.xml
  • app/src/main/res/values/strings.xml
  • app/src/main/res/values/themes.xml
  • app/src/test/java/com/redtermapp/distro/DistroOsReleaseTest.kt
  • app/src/test/java/com/redtermapp/distro/DistroSetupTest.kt
  • app/src/test/java/com/redtermapp/distro/DockerLayerExtractTest.kt
  • app/src/test/java/com/redtermapp/distro/PackageUpdaterTest.kt
  • app/src/test/java/com/redtermapp/distro/RegistryPullerTest.kt
  • app/src/test/java/com/redtermapp/distro/RegistryRefTest.kt
  • app/src/test/java/com/redtermapp/distro/TarballFormatTest.kt
  • app/src/test/java/com/redtermapp/ui/ForwardManagerTest.kt
  • app/src/test/java/com/redtermapp/ui/ForwardPersistenceTest.kt
  • app/src/test/java/com/redtermapp/ui/ForwardPresetStoreTest.kt
  • app/src/test/java/com/redtermapp/ui/JobHistoryStoreTest.kt
  • app/src/test/java/com/redtermapp/ui/LocalPortForwardTest.kt
  • app/src/test/java/com/redtermapp/ui/OrphanSweeperTest.kt
  • app/src/test/java/com/redtermapp/ui/PlaybackPacingTest.kt
  • app/src/test/java/com/redtermapp/ui/RecordingIndexTest.kt
  • app/src/test/java/com/redtermapp/ui/ScheduledJobTest.kt
  • app/src/test/java/com/redtermapp/ui/SnippetStoreTest.kt
  • app/src/test/java/com/redtermapp/ui/ToolScreenRootTest.kt
  • app/src/test/java/com/redtermapp/ui/TransferQueueTest.kt
  • app/src/test/java/com/redtermapp/ui/TunnelPersistenceTest.kt
  • app/src/test/java/com/redtermapp/ui/TunnelPlanTest.kt
  • app/src/test/java/com/redtermapp/ui/WorkspaceStoreTest.kt
  • app/src/test/java/com/redtermapp/util/DeviceResourcesTest.kt
  • app/src/test/java/com/redtermapp/util/GifFramePlanTest.kt
  • app/src/test/java/com/redtermapp/util/GifWriterTest.kt
  • app/src/test/java/com/redtermapp/util/MoshUdpProbeTest.kt
  • app/src/test/java/com/redtermapp/util/api/ApiHelperStarterTest.kt
  • app/src/test/java/com/redtermapp/util/sftp/DirSearchTest.kt
  • app/src/test/java/com/redtermapp/util/sftp/DirWalkTest.kt
  • gradle/wrapper/gradle-wrapper.properties
  • native/build-openssh.sh

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@GlobalTechInfo
GlobalTechInfo merged commit 8254fd1 into main Nov 16, 2026
2 checks passed
@GlobalTechInfo
GlobalTechInfo deleted the feature/termux-api branch November 16, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant