diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f4d9cdf..363da6c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -32,7 +32,7 @@ body: attributes: label: AirBridge version description: Shown in the app's top bar, the macOS menu, About AirBridge, or `airbridge --version`. - placeholder: "2.5.1" + placeholder: "2.5.3" validations: required: true - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/device_report.yml b/.github/ISSUE_TEMPLATE/device_report.yml index 200a01d..2d92424 100644 --- a/.github/ISSUE_TEMPLATE/device_report.yml +++ b/.github/ISSUE_TEMPLATE/device_report.yml @@ -26,7 +26,7 @@ body: id: desktop attributes: label: Desktop OS and AirBridge version - placeholder: "macOS 15.2, AirBridge 2.5.1" + placeholder: "macOS 15.2, AirBridge 2.5.3" validations: required: true - type: textarea diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 236b57c..7ed76c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,8 @@ name: CI +permissions: + contents: read + on: push: branches: [main] @@ -10,8 +13,8 @@ jobs: name: Desktop (typecheck, tests, build) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-node@v5 with: node-version: 22 cache: npm @@ -33,8 +36,8 @@ jobs: # the real Swift shell and an executable darwin-x64 service. runs-on: macos-15-intel steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-node@v5 with: node-version: 22 cache: npm @@ -52,15 +55,15 @@ jobs: name: Android (engine vectors + app APK) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 with: node-version: 22 cache: npm - run: npm ci - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: distribution: temurin java-version: 17 @@ -82,8 +85,8 @@ jobs: exit 1 fi yes | "$SDKMGR" --licenses >/dev/null 2>&1 || true - "$SDKMGR" --install "platforms;android-35" "build-tools;35.0.0" 2>&1 | tail -5 - - uses: gradle/actions/setup-gradle@v4 + "$SDKMGR" --install "platforms;android-36" "build-tools;36.0.0" "build-tools;35.0.0" 2>&1 | tail -5 + - uses: gradle/actions/setup-gradle@v5 with: gradle-version: 8.14.3 # Engine vectors + app unit regressions + debug APK — root `check` would @@ -95,14 +98,14 @@ jobs: gradle -p android :engine:check :app:testDebugUnitTest :app:assembleDebug --no-daemon 2>&1 | tee gradle-build.log || { # GitHub caps each annotation's message. Extract compiler/root-cause # lines first so diagnostics survive instead of truncating at the task summary. - diagnostics="$(grep -E '(^e: |error:|What went wrong|Execution failed|Caused by:|Compilation error| FAILED)' gradle-build.log | tail -n 40)" + diagnostics="$(grep -B 2 -A 25 -E '(^e: |errors?:|What went wrong|Execution failed|Caused by:|Compilation error|Script compilation| FAILED)' gradle-build.log | tail -n 60)" if [ -z "$diagnostics" ]; then diagnostics="$(tail -c 3500 gradle-build.log)"; fi echo "::error title=Android Gradle build failed::$(printf '%s\n' "$diagnostics" | tr '\n' '|' | cut -c1-3800)" exit 1 } - name: Native headless interop (HTTP + TLS + QR hotspot pairing + SPAKE2 join + relay, 128 MiB heap) run: npx tsx scripts/test-native-interop.ts - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: airbridge-debug-apk path: android/app/build/outputs/apk/debug/*.apk diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 93f6ffc..d1475b0 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,8 +30,8 @@ jobs: name: Build site artifact runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/configure-pages@v5 + - uses: actions/checkout@v5 + - uses: actions/configure-pages@v6 - name: Sanity-check the published site run: | set -euo pipefail @@ -74,7 +74,7 @@ jobs: echo "::error title=stale generated pages::website/ is out of date — run 'npm run website:pages' and commit the result" exit 1 fi - - uses: actions/upload-pages-artifact@v3 + - uses: actions/upload-pages-artifact@v5 with: path: website @@ -87,4 +87,4 @@ jobs: runs-on: ubuntu-latest steps: - id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c01dab..db05eeb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,8 +25,8 @@ jobs: name: Linux + Windows binaries (bun cross-compile) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-node@v5 with: node-version: 22 cache: npm @@ -44,7 +44,7 @@ jobs: AirBridge-windows-x64.exe AirBridge-windows-arm64.exe; do test -f "dist-bin/$want" || { echo "::error title=missing artifact::$want was not built"; exit 1; } done - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: desktop-linux-windows path: | @@ -58,8 +58,8 @@ jobs: # image can build and sign both distributable Mach-O architectures. runs-on: macos-15-intel steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v5 + - uses: actions/setup-node@v5 with: node-version: 22 cache: npm @@ -86,7 +86,7 @@ jobs: bash scripts/package-mac-app.sh x64 dist-bin/AirBridge-darwin-x64 dist-mac cp dist-mac/AirBridge-macOS-*.zip dist-bin/ ls -l dist-bin - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: desktop-darwin path: | @@ -98,18 +98,18 @@ jobs: name: Android APK (installable testing/sideload build) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: # Full history: the Android version code is derived from the commit # count (see android/app/build.gradle.kts), and a shallow checkout # would undercount it. fetch-depth: 0 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 with: node-version: 22 cache: npm - run: npm ci - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: distribution: temurin java-version: 17 @@ -131,8 +131,8 @@ jobs: exit 1 fi yes | "$SDKMGR" --licenses >/dev/null 2>&1 || true - "$SDKMGR" --install "platforms;android-35" "build-tools;35.0.0" 2>&1 | tail -5 - - uses: gradle/actions/setup-gradle@v4 + "$SDKMGR" --install "platforms;android-36" "build-tools;36.0.0" "build-tools;35.0.0" 2>&1 | tail -5 + - uses: gradle/actions/setup-gradle@v5 with: gradle-version: 8.14.3 - name: Engine checks + unit tests + debug APK @@ -144,7 +144,7 @@ jobs: export AIRBRIDGE_VERSION_CODE=$((2300000 + $(git rev-list --count HEAD))) echo "AIRBRIDGE_VERSION_CODE=$AIRBRIDGE_VERSION_CODE" gradle -p android :engine:check :app:testDebugUnitTest :app:assembleDebug --no-daemon 2>&1 | tee gradle-build.log || { - diagnostics="$(grep -E '(^e: |error:|What went wrong|Execution failed|Caused by:|Compilation error| FAILED)' gradle-build.log | tail -n 40)" + diagnostics="$(grep -B 2 -A 25 -E '(^e: |errors?:|What went wrong|Execution failed|Caused by:|Compilation error|Script compilation| FAILED)' gradle-build.log | tail -n 60)" if [ -z "$diagnostics" ]; then diagnostics="$(tail -c 3500 gradle-build.log)"; fi echo "::error title=Android APK build failed::$(printf '%s\n' "$diagnostics" | tr '\n' '|' | cut -c1-3800)" exit 1 @@ -155,7 +155,7 @@ jobs: mkdir -p dist-bin cp android/app/build/outputs/apk/debug/app-debug.apk dist-bin/AirBridge-android-debug.apk test -s dist-bin/AirBridge-android-debug.apk - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 with: name: android-apk path: dist-bin/AirBridge-android-debug.apk @@ -194,19 +194,19 @@ jobs: test -s "$key_path" echo "AIRBRIDGE_KEYSTORE_FILE=$key_path" >> "$GITHUB_ENV" echo "configured=true" >> "$GITHUB_OUTPUT" - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 if: ${{ steps.signing.outputs.configured == 'true' }} with: # Full history: the version code is derived from the commit count. fetch-depth: 0 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 if: ${{ steps.signing.outputs.configured == 'true' }} with: node-version: 22 cache: npm - run: npm ci if: ${{ steps.signing.outputs.configured == 'true' }} - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 if: ${{ steps.signing.outputs.configured == 'true' }} with: distribution: temurin @@ -230,8 +230,8 @@ jobs: exit 1 fi yes | "$SDKMGR" --licenses >/dev/null 2>&1 || true - "$SDKMGR" --install "platforms;android-35" "build-tools;35.0.0" 2>&1 | tail -5 - - uses: gradle/actions/setup-gradle@v4 + "$SDKMGR" --install "platforms;android-36" "build-tools;36.0.0" "build-tools;35.0.0" 2>&1 | tail -5 + - uses: gradle/actions/setup-gradle@v5 if: ${{ steps.signing.outputs.configured == 'true' }} with: gradle-version: 8.14.3 @@ -247,6 +247,10 @@ jobs: # Same formula as a local build (2_300_000 + git commit count). export AIRBRIDGE_VERSION_CODE=$((2300000 + $(git rev-list --count HEAD))) echo "AIRBRIDGE_VERSION_CODE=$AIRBRIDGE_VERSION_CODE" + if [ "$AIRBRIDGE_VERSION_CODE" -le 2300179 ]; then + echo "::error title=Non-monotonic Play versionCode::AIRBRIDGE_VERSION_CODE ($AIRBRIDGE_VERSION_CODE) must exceed previously uploaded 2300179" + exit 1 + fi gradle -p android :engine:check --no-daemon 2>&1 | tee gradle-build.log && \ gradle -p android :app:bundleRelease :app:assembleRelease --no-daemon 2>&1 | tee -a gradle-build.log || { echo "::error title=Android App Bundle build failed::$(tail -n 40 gradle-build.log | tr '\n' '|' | cut -c1-3000)" @@ -262,14 +266,14 @@ jobs: # This is a Play Console upload package, not a direct-download asset. # Keep it short-lived and inside Actions; publishing it on a GitHub Release # invites users to download an AAB their device cannot install. - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 if: ${{ steps.signing.outputs.configured == 'true' }} with: name: android-aab-play-upload path: dist-bin/AirBridge.aab retention-days: 7 if-no-files-found: error - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v6 if: ${{ steps.signing.outputs.configured == 'true' }} with: name: android-release-apk @@ -288,23 +292,23 @@ jobs: id-token: write attestations: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 # rollout.mjs (below) runs on a pinned Node, not whatever the image ships. - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 with: node-version: 22 # Keep the Play AAB in the private, short-lived Actions artifact above. # GitHub Releases publish validated desktop installers plus direct-install APKs. - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v7 with: pattern: desktop-* path: dist-bin merge-multiple: true - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v7 with: name: android-apk path: dist-bin - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v7 if: ${{ needs.android-aab.outputs.signed_aab_built == 'true' }} with: name: android-release-apk @@ -360,7 +364,7 @@ jobs: AIRBRIDGE_ROLLOUT_STAGES: ${{ vars.AIRBRIDGE_ROLLOUT_STAGES }} run: node scripts/rollout.mjs init "$TAG" --out dist-bin/rollout.json - name: Attest build provenance (Sigstore) - uses: actions/attest-build-provenance@v2 + uses: actions/attest-build-provenance@v3 with: subject-path: | dist-bin/AirBridge-* diff --git a/.gitignore b/.gitignore index 3429ced..c95eb88 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,8 @@ android/app/build/ android/engine/build/ build/verify/ -# Play upload signing material is local only. +# Play upload signing material and machine-local Android SDK paths are local only. +android/local.properties android/keystore.properties android/*.jks android/*.keystore diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfac448..36c97a3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,7 +34,7 @@ Requirements: | npm | bundled with Node | `npm ci` | | JDK | 17 | Android builds | | Gradle | 8.14.3 (or `./android/gradlew`) | Android builds | -| Android SDK | Platform 35, Build-Tools 35.0.0 | Android builds | +| Android SDK | Platform 36, Build-Tools 36.0.0 | Android builds | ```bash git clone https://github.com/DigantaDey/AirBridge.git diff --git a/README.md b/README.md index 1730a68..d80d0e5 100644 --- a/README.md +++ b/README.md @@ -322,7 +322,7 @@ npm run build # Regenerate the static guide pages in website/ after editing scripts/site-pages/ npm run website:pages -# Android: needs JDK 17, Gradle 8.14.3 and Android SDK 35 (Node deps above). +# Android: needs JDK 17, Gradle 8.14.3 and Android SDK 36 (Node deps above). # The Play AAB additionally needs a private upload key — see docs/PLAY_STORE_RELEASE.md. gradle -p android :engine:check :app:assembleDebug gradle -p android :app:bundleRelease # signed AAB; fails closed without upload-key config diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index edaf3e6..80d6a78 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -24,15 +24,16 @@ val releaseStorePassword = signingValue("AIRBRIDGE_KEYSTORE_PASSWORD") val releaseKeyAlias = signingValue("AIRBRIDGE_KEYSTORE_ALIAS") val releaseKeyPassword = signingValue("AIRBRIDGE_KEYSTORE_KEY_PASSWORD") val hasReleaseSigning = listOf(releaseKeystore, releaseStorePassword, releaseKeyAlias, releaseKeyPassword).all { !it.isNullOrBlank() } +var resolvedVersionCode = 0 android { namespace = "com.airbridge.app" - compileSdk = 35 + compileSdk = 36 defaultConfig { applicationId = "com.airbridge.app" minSdk = 26 - targetSdk = 35 + targetSdk = 36 val configuredVersionCode = System.getenv("AIRBRIDGE_VERSION_CODE")?.toIntOrNull() val gitCommitCount = runCatching { @@ -63,7 +64,8 @@ android { // A stable production floor prevents a local Play bundle from going // backwards from the old CI-generated sideload version codes. versionCode = configuredVersionCode ?: 2_300_000 + gitCommitCount - versionName = "2.5.2" + resolvedVersionCode = versionCode ?: 0 + versionName = "2.5.3" } signingConfigs { @@ -104,16 +106,17 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - kotlin { - compilerOptions { - jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) - } - } sourceSets["main"].kotlin.srcDir("src/main/kotlin") } -// Make an accidental unsigned/public-key Play artifact impossible. Debug and -// engine checks remain runnable without any release secret. +kotlin { + compilerOptions { + jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) + } +} + +// Make an accidental unsigned/public-key or non-monotonic Play artifact impossible. +// Debug and engine checks remain runnable without any release secret. tasks.configureEach { val releasePackagingTask = name.startsWith("assembleRelease") || name.startsWith("bundleRelease") if (releasePackagingTask) { @@ -123,6 +126,9 @@ tasks.configureEach { "android/keystore.properties.example, or set the four AIRBRIDGE_KEYSTORE_* variables. " + "Never use android/ci.keystore for a Play upload." } + check(resolvedVersionCode > 2_300_179) { + "Release versionCode ($resolvedVersionCode) must exceed the previously uploaded Google Play bundle (2300179)." + } } } } diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 475b034..5929ea1 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -1,3 +1,8 @@ # AirBridge uses no reflection-based serializers. Android component classes are # retained from the manifest by the Android Gradle Plugin. Keep this file small # and explicit: new reflective code must add the narrowest possible keep rule. + +# Prevent R8 from completely inlining androidx.activity.EdgeToEdge so Google Play +# Console's static DEX check recognizes MainActivity's enableEdgeToEdge() setup. +-keep class androidx.activity.EdgeToEdge { *; } + diff --git a/android/app/src/main/kotlin/com/airbridge/app/AndroidDiagnostics.kt b/android/app/src/main/kotlin/com/airbridge/app/AndroidDiagnostics.kt index a62aef1..25ba009 100644 --- a/android/app/src/main/kotlin/com/airbridge/app/AndroidDiagnostics.kt +++ b/android/app/src/main/kotlin/com/airbridge/app/AndroidDiagnostics.kt @@ -385,7 +385,7 @@ object AndroidDiagnostics { engineSnapshotOverride: EngineDiagnosticsSnapshot? = null, noBackupDirOverride: File? = null, ): JsonValue.Obj { - val sdkInt = runCatching { Build.VERSION.SDK_INT }.getOrDefault(35) + val sdkInt = runCatching { Build.VERSION.SDK_INT }.getOrDefault(36) val host = ConnectionService.currentHost() val engineSnap = engineSnapshotOverride ?: host?.diagnosticsSnapshot() val prefs = context?.let { runCatching { Prefs(it) }.getOrNull() } diff --git a/android/app/src/main/kotlin/com/airbridge/app/Discovery.kt b/android/app/src/main/kotlin/com/airbridge/app/Discovery.kt index 836ce55..f0851b8 100644 --- a/android/app/src/main/kotlin/com/airbridge/app/Discovery.kt +++ b/android/app/src/main/kotlin/com/airbridge/app/Discovery.kt @@ -202,8 +202,12 @@ class ServerDiscovery( mainHandler.removeCallbacks(timeoutRunnable) if (resolveTimeoutRunnable === timeoutRunnable) resolveTimeoutRunnable = null activeCancelResolution = null - @Suppress("DEPRECATION") - val host = info.host + val host = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + DiscoveryUrlFormatter.pickBestAddress(info.hostAddresses) + } else { + @Suppress("DEPRECATION") + info.host + } val url = host?.let { DiscoveryUrlFormatter.formatWsUrl(it, info.port) } if (url != null) { onFound(url, info.serviceName) diff --git a/android/app/src/main/kotlin/com/airbridge/app/PhoneContinuity.kt b/android/app/src/main/kotlin/com/airbridge/app/PhoneContinuity.kt index 8cf56eb..1c16ec9 100644 --- a/android/app/src/main/kotlin/com/airbridge/app/PhoneContinuity.kt +++ b/android/app/src/main/kotlin/com/airbridge/app/PhoneContinuity.kt @@ -1,5 +1,3 @@ -@file:Suppress("DEPRECATION") // PhoneStateListener / TelecomManager call control: see CallMonitor. - package com.airbridge.app import android.Manifest @@ -22,6 +20,7 @@ import android.os.Looper import android.provider.ContactsContract import android.telecom.TelecomManager import android.telephony.PhoneStateListener +import android.telephony.TelephonyCallback import android.telephony.TelephonyManager import android.util.Log import com.airbridge.engine.AirCrypto @@ -193,7 +192,7 @@ class CallMonitor( // initial ring event, state transitions, or remote answer/hangup on a lookup. private val identityWorker = Executors.newSingleThreadExecutor { r -> Thread(r, "airbridge-caller-lookup").apply { isDaemon = true } } private val lock = Any() - private var listener: PhoneStateListener? = null + private var callStateRegistration: Any? = null private var lastState = TelephonyManager.CALL_STATE_IDLE private var current: CallInfo? = null private var pendingDial: Pair? = null @@ -202,21 +201,41 @@ class CallMonitor( fun currentCall(): CallInfo? = synchronized(lock) { current } fun start() = main.post { - if (listener != null || telephony == null) return@post - val l = object : PhoneStateListener() { - override fun onCallStateChanged(state: Int, phoneNumber: String?) { - worker.execute { handle(state, phoneNumber) } + if (callStateRegistration != null || telephony == null) return@post + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + runCatching { + Api31CallState.register(telephony, worker) { state -> handle(state, null) } + } + .onSuccess { callStateRegistration = it } + .onFailure { Log.w(TAG, "Call state unavailable: ${it.message}") } + } else { + @Suppress("DEPRECATION") + val l = object : PhoneStateListener() { + @Suppress("DEPRECATION") + override fun onCallStateChanged(state: Int, phoneNumber: String?) { + worker.execute { handle(state, phoneNumber) } + } } + @Suppress("DEPRECATION") + runCatching { telephony.listen(l, PhoneStateListener.LISTEN_CALL_STATE) } + .onSuccess { callStateRegistration = l } + .onFailure { Log.w(TAG, "Call state unavailable: ${it.message}") } } - runCatching { telephony.listen(l, PhoneStateListener.LISTEN_CALL_STATE) } - .onSuccess { listener = l } - .onFailure { Log.w(TAG, "Call state unavailable: ${it.message}") } } fun stop() = main.post { - val l = listener ?: return@post - runCatching { telephony?.listen(l, PhoneStateListener.LISTEN_NONE) } - listener = null + val reg = callStateRegistration ?: return@post + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + runCatching { telephony?.let { Api31CallState.unregister(it, reg) } } + } else { + @Suppress("DEPRECATION") + runCatching { + if (reg is PhoneStateListener) { + telephony?.listen(reg, PhoneStateListener.LISTEN_NONE) + } + } + } + callStateRegistration = null worker.execute { val ended = synchronized(lock) { lastState = TelephonyManager.CALL_STATE_IDLE @@ -312,6 +331,8 @@ class CallMonitor( if (cur == null || cur.callId != command.callId || cur.state != "ringing") { return CallCommandResult(false, "That call is no longer ringing.") } + // Android offers no non-InCallService replacement for companion call answer/hangup. + @Suppress("DEPRECATION") tm.acceptRingingCall() CallCommandResult(true, callId = cur.callId) } @@ -323,7 +344,9 @@ class CallMonitor( if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { return CallCommandResult(false, "Ending calls from the computer needs Android 9 or later. Use the phone.") } - if (tm.endCall()) CallCommandResult(true, callId = target.callId) + @Suppress("DEPRECATION") + val ended = tm.endCall() + if (ended) CallCommandResult(true, callId = target.callId) else CallCommandResult(false, "The phone did not end the call.") } "dial" -> { @@ -348,6 +371,29 @@ class CallMonitor( } } + @android.annotation.TargetApi(Build.VERSION_CODES.S) + private object Api31CallState { + fun register( + telephony: TelephonyManager, + executor: java.util.concurrent.Executor, + onState: (Int) -> Unit, + ): TelephonyCallback { + val callback = object : TelephonyCallback(), TelephonyCallback.CallStateListener { + override fun onCallStateChanged(state: Int) { + onState(state) + } + } + telephony.registerTelephonyCallback(executor, callback) + return callback + } + + fun unregister(telephony: TelephonyManager, callback: Any) { + if (callback is TelephonyCallback) { + telephony.unregisterTelephonyCallback(callback) + } + } + } + private companion object { const val TAG = "AirBridgeCalls" } diff --git a/android/app/src/main/kotlin/com/airbridge/app/QrScannerView.kt b/android/app/src/main/kotlin/com/airbridge/app/QrScannerView.kt index 92c23fd..53a0d0e 100644 --- a/android/app/src/main/kotlin/com/airbridge/app/QrScannerView.kt +++ b/android/app/src/main/kotlin/com/airbridge/app/QrScannerView.kt @@ -14,8 +14,11 @@ import android.hardware.camera2.CameraCharacteristics import android.hardware.camera2.CameraDevice import android.hardware.camera2.CameraManager import android.hardware.camera2.CaptureRequest +import android.hardware.camera2.params.OutputConfiguration +import android.hardware.camera2.params.SessionConfiguration import android.media.Image import android.media.ImageReader +import android.os.Build import android.os.Handler import android.os.HandlerThread import android.os.Looper @@ -39,6 +42,7 @@ import com.google.zxing.NotFoundException import com.google.zxing.PlanarYUVLuminanceSource import com.google.zxing.common.HybridBinarizer import java.nio.ByteBuffer +import java.util.concurrent.Executor import java.util.concurrent.atomic.AtomicBoolean import kotlin.math.abs import kotlin.math.min @@ -427,9 +431,17 @@ class QrScannerView(context: Context) : FrameLayout(context) { } private fun displayRotationDegrees(): Int { - @Suppress("DEPRECATION") - val rotation = (context.getSystemService(Context.WINDOW_SERVICE) as WindowManager) - .defaultDisplay.rotation + val currentDisplay = this.display + ?: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + runCatching { context.display }.getOrNull() + } else { + null + } + val rotation = currentDisplay?.rotation ?: run { + @Suppress("DEPRECATION") + (context.getSystemService(Context.WINDOW_SERVICE) as WindowManager) + .defaultDisplay.rotation + } return when (rotation) { Surface.ROTATION_0 -> 0 Surface.ROTATION_90 -> 90 @@ -468,8 +480,7 @@ class QrScannerView(context: Context) : FrameLayout(context) { } catch (_: Exception) { } val request = builder - @Suppress("DEPRECATION") - device.createCaptureSession(targets, object : CameraCaptureSession.StateCallback() { + val stateCallback = object : CameraCaptureSession.StateCallback() { override fun onConfigured(configured: CameraCaptureSession) { session = configured try { @@ -482,7 +493,22 @@ class QrScannerView(context: Context) : FrameLayout(context) { override fun onConfigureFailed(failed: CameraCaptureSession) { Log.w(TAG, "capture session configuration failed") } - }, handler) + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + val outputs = targets.map { OutputConfiguration(it) } + val executor = Executor { runnable -> handler.post(runnable) } + device.createCaptureSession( + SessionConfiguration( + SessionConfiguration.SESSION_REGULAR, + outputs, + executor, + stateCallback, + ), + ) + } else { + @Suppress("DEPRECATION") + device.createCaptureSession(targets, stateCallback, handler) + } } catch (e: Exception) { Log.w(TAG, "createCaptureSession failed: ${e.message}") } diff --git a/android/app/src/main/kotlin/com/airbridge/app/ScreenShareService.kt b/android/app/src/main/kotlin/com/airbridge/app/ScreenShareService.kt index b251b21..579f9d9 100644 --- a/android/app/src/main/kotlin/com/airbridge/app/ScreenShareService.kt +++ b/android/app/src/main/kotlin/com/airbridge/app/ScreenShareService.kt @@ -620,6 +620,16 @@ class ScreenShareService : Service() { stopSelf() } + override fun onTimeout(startId: Int) { + AndroidDiagnostics.recordEvent("screenShare", "Foreground service timeout (startId=$startId)", "WARN") + finish("Screen sharing stopped by Android system timeout") + } + + override fun onTimeout(startId: Int, fgsType: Int) { + AndroidDiagnostics.recordEvent("screenShare", "Foreground service timeout (startId=$startId, fgsType=$fgsType)", "WARN") + finish("Screen sharing stopped by Android system timeout") + } + override fun onDestroy() { if (!stopping) finish("Sharing stopped on the phone") super.onDestroy() diff --git a/android/build.gradle.kts b/android/build.gradle.kts index cfec60d..f84fcf3 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("com.android.application") version "8.7.3" apply false + id("com.android.application") version "8.13.2" apply false id("org.jetbrains.kotlin.android") version "2.0.21" apply false id("org.jetbrains.kotlin.jvm") version "2.0.21" apply false id("org.jetbrains.kotlin.plugin.compose") version "2.0.21" apply false diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index eb84db6..fec70bd 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip networkTimeout=10000 retries=0 retryBackOffMs=500 diff --git a/android/local.properties b/android/local.properties deleted file mode 100644 index c50bff9..0000000 --- a/android/local.properties +++ /dev/null @@ -1 +0,0 @@ -sdk.dir=/Users/digantadey/Library/Android/sdk diff --git a/bin/airbridge.mjs b/bin/airbridge.mjs index 1b4081f..4808b9e 100755 --- a/bin/airbridge.mjs +++ b/bin/airbridge.mjs @@ -27,6 +27,7 @@ function printHelp() { --tls-key PEM private key for --tls-cert --tls-dir Where the generated local CA lives (default: ~/.airbridge/tls) + -v, --version Print version and exit -h, --help Show this help message Examples: @@ -72,6 +73,11 @@ async function main() { printHelp(); process.exit(0); } + if (args.includes('-v') || args.includes('--version') || args[0] === 'version') { + const pkgJson = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf8')); + console.log(`airbridge ${pkgJson.version || 'dev'}`); + process.exit(0); + } let port = process.env.PORT ? validatePort(process.env.PORT, 'PORT') : 3000; let downloadDir = path.join(os.homedir(), 'Downloads', 'AirBridge'); diff --git a/docs/ANDROID_VALIDATION.md b/docs/ANDROID_VALIDATION.md index b885cb0..ba76827 100644 --- a/docs/ANDROID_VALIDATION.md +++ b/docs/ANDROID_VALIDATION.md @@ -1,6 +1,6 @@ # Android validation and remaining device checks -## Architecture being validated (2.5.2) +## Architecture being validated (2.5.3) `ConnectionService` owns a single `NativeEngineHost` / Kotlin `AirBridgeEngine`. The native Jetpack Compose UI attaches a state subscriber; suspending, destroying @@ -35,7 +35,7 @@ npm audit --audit-level=moderate npm run build node scripts/build-desktop.mjs --only linux-x64 -# JDK 17 + Gradle 8.14.3 + Android SDK 35 / build-tools 35.0.0 +# JDK 17 + Gradle 8.14.3 + Android SDK 36 / build-tools 36.0.0 gradle -p android :engine:check :app:assembleDebug npx tsx scripts/test-native-interop.ts ``` diff --git a/docs/DISTRIBUTION.md b/docs/DISTRIBUTION.md index 097dd0c..ad2f4dc 100644 --- a/docs/DISTRIBUTION.md +++ b/docs/DISTRIBUTION.md @@ -182,10 +182,8 @@ gradle -p android :engine:check :app:bundleRelease # signed Play AAB (private u ``` -Android builds require JDK 17, Gradle 8.14.3, platform SDK 35, build-tools -35.0.0 and the npm dependencies. Generated Vite assets live under -`android/app/build/generated/clientAssets/ui` and are not committed. A missing -bundle fails visibly instead of silently loading old desktop JavaScript. +Android builds require JDK 17, Gradle 8.14.3, platform SDK 36, build-tools +36.0.0 and the npm dependencies (for `scripts/test-native-interop.ts`). For Android OS restrictions, Downloads behavior and device-only checks, see [Android validation](ANDROID_VALIDATION.md) and the README's background section. diff --git a/docs/PLAY_STORE_RELEASE.md b/docs/PLAY_STORE_RELEASE.md index 91e978f..2eb2f11 100644 --- a/docs/PLAY_STORE_RELEASE.md +++ b/docs/PLAY_STORE_RELEASE.md @@ -1,6 +1,6 @@ # Google Play release gate -This is the release checklist for the **Android App Bundle (AAB)**. It is written for the Play-safe AirBridge 2.5.2 product, not the former sideload workflow. +This is the release checklist for the **Android App Bundle (AAB)**. It is written for the Play-safe AirBridge 2.5.3 product, not the former sideload workflow. > This checklist reduces review risk; it cannot guarantee approval. Policies and Play Console questions change, so validate every declaration against the current Console before submitting. @@ -52,7 +52,7 @@ Do **not** reuse a debug key or the retired CI key. If an older sideload APK was 4. Run **Build → Generate Signed Bundle / APK → Android App Bundle**, or the Gradle task `:app:bundleRelease`. 5. Upload `android/app/build/outputs/bundle/release/app-release.aab` to Play Console's **Internal testing** track first. -The build enables R8 and resource shrinking. A release task stops with a clear error if signing is absent. Debug builds remain available for local development and are never release-signed. +The build targets Android 16 (`compileSdk = 36`, `targetSdk = 36`, `minSdk = 26`), enables R8 and resource shrinking, and enforces `versionCode > 2300179` (`2_300_000 + git rev-list --count HEAD`, strictly above the initial API-35 upload `2300179`). A release task stops with a clear error if signing is absent or if the version code is not strictly higher than `2300179`. Debug builds remain available for local development and are never release-signed. ## 3. Play Console declarations that require manual work diff --git a/docs/RELEASE_2.5.3.md b/docs/RELEASE_2.5.3.md new file mode 100644 index 0000000..13574b7 --- /dev/null +++ b/docs/RELEASE_2.5.3.md @@ -0,0 +1,20 @@ +# AirBridge 2.5.3 + +## Android 16 (API 36) & platform modernization + +- Updated the Android app to compile against and target **Android 16 (API 36)** on Android Gradle Plugin `8.13.2` and Gradle `8.14.3`, while keeping `minSdk = 26` (Android 8.0+) compatibility. +- Added `Service.onTimeout` foreground-service lifecycle handlers in `ScreenShareService` so OS-enforced media-projection timeouts stop active screen capture cleanly. +- Replaced deprecated Android SDK 28–34 platform APIs across LAN discovery (`NsdServiceInfo.hostAddresses`), call-state continuity (`TelephonyCallback.CallStateListener` on Android 12+), and QR camera preview (`SessionConfiguration` / `OutputConfiguration` and `Context.display`), preserving fallbacks for Android 8–11. +- Added fail-closed monotonic Play `versionCode` checks (`> 2300179`) to `:app:assembleRelease`, `:app:bundleRelease`, and the release workflow. + +## Desktop daemon, CLI & CI fixes + +- Fixed a Node/Undici `WebSocket.CONNECTING` reconnect race in `WarpClient` and `BackgroundClipboardPeer` where a pair-code update arriving mid-handshake could leave the background clipboard peer stuck in `connecting` state. +- Added `-v`, `--version`, and `version` support to the `airbridge` npm CLI entrypoint to match standalone desktop binaries. +- Upgraded GitHub Actions workflows (`ci.yml`, `release.yml`, `pages.yml`) to Node-24-compatible action majors with least-privilege `contents: read` permissions on CI. + +## Installation notes + +macOS builds are ad-hoc signed, not notarised. Windows executables are unsigned. Verify downloads using `SHA256SUMS.txt` and GitHub Sigstore attestations. No third-party security audit is claimed. + +A signed Play App Bundle is built only when private signing credentials are configured. See [the Play release checklist](https://github.com/DigantaDey/AirBridge/blob/v2.5.3/docs/PLAY_STORE_RELEASE.md). diff --git a/package-lock.json b/package-lock.json index f4bdded..06ff040 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "airbridge-drop", - "version": "2.5.2", + "version": "2.5.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "airbridge-drop", - "version": "2.5.2", + "version": "2.5.3", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@noble/curves": "^2.4.0", diff --git a/package.json b/package.json index ef1592f..93419d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "airbridge-drop", - "version": "2.5.2", + "version": "2.5.3", "description": "AirBridge — Fast, E2EE, open-source AirDrop & Universal Clipboard alternative for Android and MacBook.", "type": "module", "license": "SEE LICENSE IN LICENSE", diff --git a/scripts/site-pages/download.mjs b/scripts/site-pages/download.mjs index db9d6e3..e63cfad 100644 --- a/scripts/site-pages/download.mjs +++ b/scripts/site-pages/download.mjs @@ -162,7 +162,7 @@ gh attestation verify AirBridge-linux-x64 -R DigantaDey/AirBridge html: `
  • Android 8.0 (API 26) or newer for the phone app, whether you sideload the APK or install a future Play copy.
  • macOS with Apple silicon or Intel, Windows x64 or ARM64, or Linux x64/arm64 on glibc or musl. Prebuilt binaries need no Node.js.
  • -
  • Building from source needs Node.js 20+, npm and Git; Android builds need JDK 17, Gradle and Android SDK 35.
  • +
  • Building from source needs Node.js 20+, npm and Git; Android builds need JDK 17, Gradle and Android SDK 36.
  • Network: phone and computer on the same Wi-Fi (or the phone’s hotspot). The service listens on port 3000 by default — set PORT to change it, and allow the app through the Windows firewall for private networks.
`, }, diff --git a/src/client/engine/warpClient.ts b/src/client/engine/warpClient.ts index 57078d9..0fa382f 100644 --- a/src/client/engine/warpClient.ts +++ b/src/client/engine/warpClient.ts @@ -3404,11 +3404,24 @@ export class WarpClient { } private reconnectNow(): void { - if (this.reconnectTimer) clearTimeout(this.reconnectTimer); + if (this.destroyed || !this.myDevice) return; + if (this.reconnectTimer) { + clearTimeout(this.reconnectTimer); + this.reconnectTimer = null; + } const ws = this.ws; - if (ws && ws.readyState !== WebSocket.CLOSED) { + if (ws && ws.readyState === WebSocket.OPEN) { try { ws.close(4000, 'pairing code changed'); } catch { /* ignore */ } } else { + // Closing a CONNECTING WebSocket in Node/Undici transitions to CLOSING + // without ever firing `onclose`; detach it and open a fresh socket now. + if (ws) { + this.ws = null; + ws.onopen = () => { try { ws.close(); } catch { /* ignore */ } }; + ws.onmessage = null; + ws.onclose = null; + try { ws.close(); } catch { /* ignore */ } + } this.connectWebSocket(); } } diff --git a/src/server/backgroundClipboard.ts b/src/server/backgroundClipboard.ts index 8f428bf..b7a7ae5 100644 --- a/src/server/backgroundClipboard.ts +++ b/src/server/backgroundClipboard.ts @@ -239,7 +239,13 @@ export class BackgroundClipboardPeer { const clean = normalizePairCode(raw); if (!isValidPairCode(clean)) return; this.storage.setItem(`${STORAGE_PREFIX}:pairCode`, clean); - this.client?.joinPairCode(clean); + if (this.client) { + const snap = this.client.getSnapshot(); + if (snap.pairCode === clean && !snap.connectionError && snap.connectionState !== 'disconnected') { + return; + } + this.client.joinPairCode(clean); + } } stop(): void { diff --git a/tests/about-and-release-metadata.test.ts b/tests/about-and-release-metadata.test.ts index e39bbcf..21d3b10 100644 --- a/tests/about-and-release-metadata.test.ts +++ b/tests/about-and-release-metadata.test.ts @@ -4,7 +4,7 @@ import { describe, expect, it } from "vitest"; import { buildLinuxLauncherEntry } from "../src/server/desktopLauncher.js"; describe("Version Consistency & Updated About AirBridge Across All Platforms", () => { - it("aligns version 2.5.2 across package manifests, Android Gradle, website, and docs", () => { + it("aligns version 2.5.3 across package manifests, Android Gradle, website, and docs", () => { const pkg = JSON.parse(fs.readFileSync("package.json", "utf8")) as { version: string }; const lock = JSON.parse(fs.readFileSync("package-lock.json", "utf8")) as { version: string; @@ -15,14 +15,14 @@ describe("Version Consistency & Updated About AirBridge Across All Platforms", ( const androidDoc = fs.readFileSync("docs/ANDROID_VALIDATION.md", "utf8"); const playDoc = fs.readFileSync("docs/PLAY_STORE_RELEASE.md", "utf8"); - expect(pkg.version).toBe("2.5.2"); - expect(lock.version).toBe("2.5.2"); - expect(lock.packages[""]?.version).toBe("2.5.2"); - expect(appGradle).toContain('versionName = "2.5.2"'); - expect(websiteIndex).toContain('"softwareVersion":"2.5.2"'); - expect(websiteIndex).toContain("v2.5.2"); - expect(androidDoc).toContain("(2.5.2)"); - expect(playDoc).toContain("AirBridge 2.5.2"); + expect(pkg.version).toBe("2.5.3"); + expect(lock.version).toBe("2.5.3"); + expect(lock.packages[""]?.version).toBe("2.5.3"); + expect(appGradle).toContain('versionName = "2.5.3"'); + expect(websiteIndex).toContain('"softwareVersion":"2.5.3"'); + expect(websiteIndex).toContain("v2.5.3"); + expect(androidDoc).toContain("(2.5.3)"); + expect(playDoc).toContain("AirBridge 2.5.3"); }); it("includes updated About AirBridge details in the Web UI, macOS app, Android Compose Settings, and Linux launcher", () => { @@ -59,9 +59,9 @@ describe("Version Consistency & Updated About AirBridge Across All Platforms", ( const desktopEntry = buildLinuxLauncherEntry({ executable: "/usr/local/bin/airbridge", - version: "2.5.2", + version: "2.5.3", }); - expect(desktopEntry).toContain("Comment=AirBridge 2.5.2"); + expect(desktopEntry).toContain("Comment=AirBridge 2.5.3"); expect(desktopEntry).toContain("Diganta Dey"); expect(desktopEntry).toContain("H.264 screen sharing"); }); diff --git a/tests/background-clipboard-e2e.test.ts b/tests/background-clipboard-e2e.test.ts index 54fbf0f..16c78bb 100644 --- a/tests/background-clipboard-e2e.test.ts +++ b/tests/background-clipboard-e2e.test.ts @@ -281,4 +281,34 @@ describe('background clipboard without open browser UIs', () => { } }, 15_000); + it('does not wedge in connecting state when setPairCode races with initial WebSocket handshake', async () => { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'airbridge-pair-race-')); + const stateFile = path.join(dir, 'peer.json'); + const provider: HostClipboardProvider = { isSupported: () => true, readText: async () => '', writeText: async () => true }; + const server = await createAirBridgeServer({ + port: 0, + host: '127.0.0.1', + mode: 'test', + https: false, + enableMdns: false, + hostClipboard: provider, + backgroundClipboard: true, + backgroundClipboardStoragePath: stateFile, + receivedFolderSettingsPath: null, + }); + try { + const bgClient = (server.backgroundClipboard as unknown as { client: WarpClient }).client; + // Fire pair-code updates immediately while BackgroundClipboardPeer.start() + // is still awaiting WebCrypto or opening its loopback WebSocket. + server.backgroundClipboard!.setPairCode('DEF456'); + await wait(1); + server.backgroundClipboard!.setPairCode('GHJ789'); + await waitFor(() => bgClient.getSnapshot().connectionState, (state) => state === 'connected'); + expect(bgClient.getSnapshot().pairCode).toBe('GHJ789'); + } finally { + await server.close(); + fs.rmSync(dir, { recursive: true, force: true }); + } + }, 15_000); + }); diff --git a/tests/e2e/harness/harness.test.ts b/tests/e2e/harness/harness.test.ts index f47d950..a5ca11a 100644 --- a/tests/e2e/harness/harness.test.ts +++ b/tests/e2e/harness/harness.test.ts @@ -257,7 +257,7 @@ describe('AirBridge E2E Harness Self-Verification', () => { // Verify build.gradle.kts signing configs const gradle = await readAppBuildGradle(); - expect(gradle.compileSdk).toBe(35); + expect(gradle.compileSdk).toBe(36); expect(gradle.minSdk).toBe(26); expect(isV1SigningEnabled(gradle, 'release')).toBe(true); expect(isV2SigningEnabled(gradle, 'release')).toBe(true); diff --git a/tests/e2e/tier1-feature-coverage/f18_version_code_packaging.test.ts b/tests/e2e/tier1-feature-coverage/f18_version_code_packaging.test.ts index e1dd959..71bee9f 100644 --- a/tests/e2e/tier1-feature-coverage/f18_version_code_packaging.test.ts +++ b/tests/e2e/tier1-feature-coverage/f18_version_code_packaging.test.ts @@ -7,17 +7,18 @@ import { } from '../harness/index.js'; describe('F18: Monotonic VersionCode & Android Package Consistency', () => { - it('targets API 35 with compileSdk 35 and minSdk 26 in android/app/build.gradle.kts', async () => { + it('targets API 36 with compileSdk 36 and minSdk 26 in android/app/build.gradle.kts', async () => { const gradle = await readAppBuildGradle(); - expect(gradle.compileSdk).toBe(35); + expect(gradle.compileSdk).toBe(36); expect(gradle.minSdk).toBe(26); - expect(gradle.targetSdk).toBe(35); + expect(gradle.targetSdk).toBe(36); }); - it('derives a monotonic Play versionCode from AIRBRIDGE_VERSION_CODE or git commit count', async () => { + it('derives a monotonic Play versionCode (> 2300179) from AIRBRIDGE_VERSION_CODE or git commit count', async () => { const gradle = await readAppBuildGradle(); expect(gradle.rawText).toContain('AIRBRIDGE_VERSION_CODE'); expect(gradle.rawText).toContain('2_300_000 + gitCommitCount'); + expect(gradle.rawText).toContain('resolvedVersionCode > 2_300_179'); }); it('aligns Android applicationId (com.airbridge.app) and versionName with package.json', async () => { diff --git a/tests/e2e/tier1-feature-coverage/f19_anr_and_discovery_fix.test.ts b/tests/e2e/tier1-feature-coverage/f19_anr_and_discovery_fix.test.ts index 691d22c..ca53de6 100644 --- a/tests/e2e/tier1-feature-coverage/f19_anr_and_discovery_fix.test.ts +++ b/tests/e2e/tier1-feature-coverage/f19_anr_and_discovery_fix.test.ts @@ -11,6 +11,16 @@ describe('F19: ANR Elimination & Non-Blocking mDNS Discovery Queue', () => { expect(disc).toContain('RESOLVE_TIMEOUT_MS = 5_000L'); expect(disc).toContain('Handler(Looper.getMainLooper())'); expect(disc).toContain('queue.finish(generation)'); + expect(disc).toContain('DiscoveryUrlFormatter.pickBestAddress(info.hostAddresses)'); + }); + + it('uses Camera2 SessionConfiguration and View/Context display on Android 9+/11+ in QrScannerView', async () => { + const qr = await readRepoFile('android/app/src/main/kotlin/com/airbridge/app/QrScannerView.kt'); + expect(qr).toContain('SessionConfiguration('); + expect(qr).toContain('OutputConfiguration('); + expect(qr).toContain('this.display'); + const proguard = await readRepoFile('android/app/proguard-rules.pro'); + expect(proguard).toContain('-keep class androidx.activity.EdgeToEdge'); }); it('prefers non-loopback IPv4 addresses and formats IPv6 ws URLs with brackets in DiscoveryUrlFormatter', async () => { diff --git a/tests/e2e/tier1-feature-coverage/f21_phone_continuity_android.test.ts b/tests/e2e/tier1-feature-coverage/f21_phone_continuity_android.test.ts index 539923c..1287c08 100644 --- a/tests/e2e/tier1-feature-coverage/f21_phone_continuity_android.test.ts +++ b/tests/e2e/tier1-feature-coverage/f21_phone_continuity_android.test.ts @@ -124,6 +124,17 @@ describe('F21: Phone continuity (Android)', () => { expect(svc).toContain('BUFFER_FLAG_KEY_FRAME'); expect(svc).not.toContain('Bitmap.CompressFormat.JPEG'); expect(svc).toContain('createScreenCaptureIntent()'); + // API 34/35/36 foreground service timeout handlers stop sharing gracefully. + expect(svc).toContain('override fun onTimeout(startId: Int)'); + expect(svc).toContain('override fun onTimeout(startId: Int, fgsType: Int)'); + }); + + it('uses TelephonyCallback on Android 12+ without file-wide deprecation suppression', async () => { + const src = await readRepoFile(`${APP}/PhoneContinuity.kt`); + expect(src).not.toContain('@file:Suppress("DEPRECATION")'); + expect(src).toContain('TelephonyCallback.CallStateListener'); + expect(src).toContain('registerTelephonyCallback'); + expect(src).toContain('unregisterTelephonyCallback'); }); it('accepts shared vCards from contacts apps and wires the engine callbacks', async () => { diff --git a/tests/e2e/tier4-real-world/scenario_10_app_upgrade_history_sync.test.ts b/tests/e2e/tier4-real-world/scenario_10_app_upgrade_history_sync.test.ts index 2734b71..d834553 100644 --- a/tests/e2e/tier4-real-world/scenario_10_app_upgrade_history_sync.test.ts +++ b/tests/e2e/tier4-real-world/scenario_10_app_upgrade_history_sync.test.ts @@ -21,8 +21,8 @@ describe('Tier 4 Scenario 10: Seamless Play Upgrade Continuity & Encrypted Histo expect(isV1SigningEnabled(gradle, 'release')).toBe(true); expect(isV2SigningEnabled(gradle, 'release')).toBe(true); expect(gradle.rawText).toContain('hasReleaseSigning'); - expect(gradle.compileSdk).toBe(35); - expect(gradle.targetSdk).toBe(35); + expect(gradle.compileSdk).toBe(36); + expect(gradle.targetSdk).toBe(36); }); it('rejoins same room across app restart/upgrade and synchronizes encrypted transfer history cleanly', async () => { diff --git a/tests/gradle-compat.test.ts b/tests/gradle-compat.test.ts index 0106b65..e012cb2 100644 --- a/tests/gradle-compat.test.ts +++ b/tests/gradle-compat.test.ts @@ -23,3 +23,36 @@ describe('Gradle 8.x / 9.x compatibility in android/engine/build.gradle.kts', () expect(buildScript).toContain('resilienceAndContinuityAudioTest,'); }); }); + +describe('Android API 36 & Gradle wrapper / AGP alignment', () => { + const rootGradle = fs.readFileSync( + path.resolve(process.cwd(), 'android/build.gradle.kts'), + 'utf8', + ); + const wrapperProps = fs.readFileSync( + path.resolve(process.cwd(), 'android/gradle/wrapper/gradle-wrapper.properties'), + 'utf8', + ); + const gitignore = fs.readFileSync(path.resolve(process.cwd(), '.gitignore'), 'utf8'); + + it('uses an AGP 8.13.x version compatible with API 36 and Gradle 8.14.3', () => { + const match = /id\("com\.android\.application"\)\s+version\s+"(\d+)\.(\d+)\.(\d+)"/.exec(rootGradle); + expect(match).not.toBeNull(); + const major = Number(match![1]); + const minor = Number(match![2]); + // AGP >= 8.9.1 is required for API 36; AGP 8.x runs on Gradle 8.14.3. + expect(major).toBe(8); + expect(minor).toBeGreaterThanOrEqual(10); + }); + + it('pins gradle-wrapper.properties to Gradle 8.14.3 matching CI and AGP 8.x', () => { + expect(wrapperProps).toContain('gradle-8.14.3-bin.zip'); + expect(wrapperProps).not.toContain('gradle-9.'); + }); + + it('ignores machine-local android/local.properties and removes it from the repository', () => { + expect(gitignore).toContain('android/local.properties'); + expect(fs.existsSync(path.resolve(process.cwd(), 'android/local.properties'))).toBe(false); + }); +}); + diff --git a/tests/release-workflow-guards.test.ts b/tests/release-workflow-guards.test.ts index 7b3294c..1ab0dcc 100644 --- a/tests/release-workflow-guards.test.ts +++ b/tests/release-workflow-guards.test.ts @@ -22,7 +22,31 @@ describe("Release workflow guards", () => { const fetchDepthZero = release.match(/fetch-depth: 0/g) ?? []; expect(fetchDepthZero.length).toBeGreaterThanOrEqual(2); const ci = fs.readFileSync(".github/workflows/ci.yml", "utf8"); - expect(ci.slice(ci.indexOf(" android:"))).toMatch(/uses: actions\/checkout@v4\s+with:\s+fetch-depth: 0/); + expect(ci.slice(ci.indexOf(" android:"))).toMatch(/uses: actions\/checkout@v5\s+with:\s+fetch-depth: 0/); + }); + + it("uses Node-24-compatible GitHub Actions, least-privilege permissions, and Android SDK 36 across workflows", () => { + const ci = fs.readFileSync(".github/workflows/ci.yml", "utf8"); + const release = fs.readFileSync(".github/workflows/release.yml", "utf8"); + const pages = fs.readFileSync(".github/workflows/pages.yml", "utf8"); + + expect(ci).toContain("permissions:\n contents: read"); + for (const yml of [ci, release, pages]) { + expect(yml).not.toContain("actions/checkout@v4"); + expect(yml).not.toContain("actions/setup-node@v4"); + expect(yml).not.toContain("actions/setup-java@v4"); + expect(yml).not.toContain("gradle/actions/setup-gradle@v4"); + expect(yml).not.toContain("actions/upload-artifact@v4"); + expect(yml).not.toContain("actions/download-artifact@v4"); + expect(yml).not.toContain("actions/attest-build-provenance@v2"); + expect(yml).not.toContain("actions/configure-pages@v5"); + expect(yml).not.toContain("actions/upload-pages-artifact@v3"); + expect(yml).not.toContain("actions/deploy-pages@v4"); + expect(yml).not.toContain("platforms;android-35"); + } + expect(ci).toContain("platforms;android-36"); + expect(release).toContain("platforms;android-36"); + expect(release).toContain('if [ "$AIRBRIDGE_VERSION_CODE" -le 2300179 ]'); }); it("refuses to mint a version code from a shallow clone", () => { diff --git a/tests/website-hardening.test.ts b/tests/website-hardening.test.ts index a6cefa0..b68f882 100644 --- a/tests/website-hardening.test.ts +++ b/tests/website-hardening.test.ts @@ -77,12 +77,12 @@ describe("Website Revamp, Horizontal Overflow Prevention & Hardening", () => { expect(styles).not.toContain(".nav-links{display:none}"); }); - it("showcases all AirBridge v2.5.2 capabilities, comparison table, honest platform disclosures, and creator About section", () => { + it("showcases all AirBridge v2.5.3 capabilities, comparison table, honest platform disclosures, and creator About section", () => { expect(indexHtml).toContain('