From f2eb363db47f0526f49e11ff900c770ef8df26eb Mon Sep 17 00:00:00 2001 From: heaven Date: Tue, 23 Jun 2026 02:47:17 +0300 Subject: [PATCH] feat(calls): native self-managed Telecom backend for Android (Phase A/B, flag-gated off, validated on Samsung) --- android/app/build.gradle | 17 + android/app/src/main/AndroidManifest.xml | 9 + .../main/java/chat/vojo/app/MainActivity.java | 3 + .../java/chat/vojo/app/TelecomCallPlugin.java | 182 ++++++++++ .../java/chat/vojo/app/VojoCallsManager.kt | 318 ++++++++++++++++++ android/build.gradle | 5 + android/variables.gradle | 6 + docs/plans/telecom_migration.md | 266 +++++++++++++++ src/app/components/CallEmbedProvider.tsx | 4 + src/app/hooks/useAndroidCallForegroundSync.ts | 7 +- src/app/hooks/useCallSpeaker.ts | 25 +- src/app/hooks/useTelecomConnectionSync.ts | 94 ++++++ src/app/plugins/call/telecomCall.ts | 131 ++++++++ 13 files changed, 1061 insertions(+), 6 deletions(-) create mode 100644 android/app/src/main/java/chat/vojo/app/TelecomCallPlugin.java create mode 100644 android/app/src/main/java/chat/vojo/app/VojoCallsManager.kt create mode 100644 docs/plans/telecom_migration.md create mode 100644 src/app/hooks/useTelecomConnectionSync.ts create mode 100644 src/app/plugins/call/telecomCall.ts diff --git a/android/app/build.gradle b/android/app/build.gradle index 46ab402d..168c38f1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,4 +1,7 @@ apply plugin: 'com.android.application' +// Kotlin source-set for the Telecom module only (androidx.core:core-telecom is +// coroutine-first). All other native code stays Java; interop is seamless. +apply plugin: 'kotlin-android' // Mirror of resolveAppVersion() in ../../vite.config.js so the APK's // versionName matches __APP_VERSION__ rendered in the About screen. @@ -49,6 +52,12 @@ android { buildConfig = true } + // Match the Java compileOptions (VERSION_21 from capacitor.build.gradle) so + // the Kotlin telecom module and the Java sources target the same bytecode. + kotlinOptions { + jvmTarget = '21' + } + signingConfigs { release { if (project.hasProperty('VOJO_RELEASE_STORE_FILE')) { @@ -102,6 +111,14 @@ dependencies { // proxy credentials (proxy_support.md §15 #4). Not the deprecated // androidx.security EncryptedSharedPreferences. implementation "com.google.crypto.tink:tink-android:1.15.0" + // Telecom self-managed VoIP (docs/plans/telecom_migration.md). core-telecom + // wraps the API-34 transactional CallControl path and the ConnectionService + // backport (API 26-33) behind one CallsManager API. CallsManager is + // @RequiresApi(26) — every call site is gated on SDK_INT >= O; on API 24-25 + // the Telecom path is skipped. coroutines-android supplies Dispatchers.Main + // that VojoCallsManager runs its CallControlScope on. + implementation "androidx.core:core-telecom:$coreTelecomVersion" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" testImplementation "junit:junit:$junitVersion" androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 4ff1c8a7..78f5fdb7 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -135,6 +135,15 @@ pre-declared for the planned speaker-toggle plugin. --> + +