Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/android-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: android-check

# Test and build the Android client on pull requests, without signing or publishing.
#
# android-apk.yml is the release path: it signs with the production key and publishes
# to /android/, so it only ever runs for pushes to android-app. This workflow is the
# pre-merge check. It holds no secrets, uploads nothing to the site, and never signs
# with a release key (--debug uses upstream's debug key), so a branch can be verified
# here without its APK reaching anyone.

on:
pull_request:
branches: [android-app]
workflow_dispatch:

# A newer push to the same PR supersedes the run in progress.
concurrency:
group: android-check-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
check:
name: Unit tests and debug build
runs-on: ubuntu-latest
env:
ANDROID_HOME: /usr/local/lib/android/sdk
ANDROID_NDK_VERSION: "26.1.10909125"
steps:
# Full history, for the same reason android-apk.yml gives: the About
# screen reads the upstream commit from the subtree trailer.
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '21'

- uses: android-actions/setup-android@v4
with:
packages: platform-tools

- name: Restore the NDK
id: ndk-cache
uses: actions/cache/restore@v6
with:
path: ${{ env.ANDROID_HOME }}/ndk/${{ env.ANDROID_NDK_VERSION }}
key: android-ndk-${{ env.ANDROID_NDK_VERSION }}-${{ runner.os }}

- name: Install SDK platform and NDK
run: |
yes | sdkmanager --licenses > /dev/null 2>&1 || true
sdkmanager "platforms;android-37.0" "ndk;${ANDROID_NDK_VERSION}"

- name: Save the NDK
if: steps.ndk-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: ${{ env.ANDROID_HOME }}/ndk/${{ env.ANDROID_NDK_VERSION }}
key: android-ndk-${{ env.ANDROID_NDK_VERSION }}-${{ runner.os }}

- uses: gradle/actions/setup-gradle@v6

- name: Unit tests
run: |
cd connectbot
./gradlew --no-daemon :app:testOssDebugUnitTest

- name: Upload the test report
if: failure()
uses: actions/upload-artifact@v7
with:
name: unit-test-report
path: |
connectbot/app/build/reports/tests/
connectbot/app/build/test-results/

# The same debug build path build-apk.sh offers, so a change that breaks
# the APK's build fails here rather than on the release run.
- name: Build the debug APK
run: scripts/build-apk.sh --debug
3 changes: 2 additions & 1 deletion connectbot/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
android:memtagMode="${memtagMode}"
android:roundIcon="@mipmap/icon_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">

<activity
android:name=".ui.MainActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,14 @@ class TerminalBridge {
*/
fun switchTab(tabKey: String): Boolean {
val tabatelier = transport as? TabAtelier ?: return false
if (disconnected) {
// The session ended — the reconnect overlay is up — so there is no Relay to
// read a new socket and a switch would change the title over a frozen screen.
// Reconnecting builds a fresh transport, which opens the tab chosen here.
manager.chooseTabKey(host.id, tabKey)
manager.requestReconnect(this)
return true
}
return tabatelier.switchTab(tabKey)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ class TerminalManager :
*/
fun lastTabKey(hostId: Long): String? = tabKeys.resumeKey(hostId)

/** Makes [tabKey] the tab the next connection for [hostId] opens. */
fun chooseTabKey(hostId: Long, tabKey: String) = tabKeys.choose(hostId, tabKey)

/** Records the tab a live session has moved to, so a later reopen lands there. */
fun rememberTabKey(hostId: Long, tabKey: String) = tabKeys.remember(hostId, tabKey)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ data class TabAtelierAddresses(
* address this session was established on, and re-classifying it mid-session would
* move the session between networks for no reason the user asked for.
*/
val local: Set<String> = emptySet(),
val local: Set<String> = (listOfNotNull(primary) + fallbacks).filter { isLocalAddress(it) }.toSet(),
) {
/** Everything, in the order it should be tried with nothing known about the network. */
val all: List<String> get() = listOfNotNull(primary?.takeIf { it.isNotBlank() }) + fallbacks
Expand Down
Loading
Loading