Fix Android ARM64 build integration and verify first test APK

This commit is contained in:
omar committed 2026-11-11 20:25:12 +03:00
1 parent 3d2e76eddd
commit 32318e3e3f
14 files changed
+253091 -15

No files matched your search

+1
View File
@@ -2,3 +2,4 @@
native/patches/** text eol=lf native/patches/** text eol=lf
xtask/src/*.rs text eol=lf xtask/src/*.rs text eol=lf
.gitea/*.sh text eol=lf .gitea/*.sh text eol=lf
platform/android/gradlew text eol=lf
+7
View File
@@ -2,6 +2,13 @@
## Unreleased ## Unreleased
- Built the first full Skia/WebRTC Android ARM64 test APK in authorized WSL2. Verified APK v2 signing,
16-KiB alignment, native ISA/imports, resources and exported WebRTC JNI symbols; no device run claimed.
- Fixed Android build integration: use the complete NDK r28c rather than Chromium's sysroot-only subset,
copy the matching WebRTC jar to Cargo's actual output directory, retain JNI exports in the final cdylib,
pin Gradle launcher LF/build-tools36, and use the public AppOps permission-change observer.
Corrected the pinned Slint NonNull pointer conversion in Android accessibility.
- Implemented Android call-scoped audio recovery: focus/route changes revoke microphone authorization, - Implemented Android call-scoped audio recovery: focus/route changes revoke microphone authorization,
restore receive-only playback when permitted, and reject stale lease/revision callbacks. Communication restore receive-only playback when permitted, and reject stale lease/revision callbacks. Communication
mode and Android 12+ communication-device notifications follow the active foreground call. mode and Android 12+ communication-device notifications follow the active foreground call.
Generated
+1
View File
@@ -7562,6 +7562,7 @@ dependencies = [
"usvg", "usvg",
"uuid", "uuid",
"webrtc-sys", "webrtc-sys",
"webrtc-sys-build",
"windows-sys 0.61.2", "windows-sys 0.61.2",
"zbus", "zbus",
"zeroize", "zeroize",
+5 -2
View File
@@ -150,6 +150,8 @@ This is the same Linux source-build route, not a separately tested WSL product c
export ANDROID_HOME="$ANDROID_SDK_ROOT" export ANDROID_HOME="$ANDROID_SDK_ROOT"
export ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk/28.2.13676358" export ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk/28.2.13676358"
export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT" export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT"
export ANDROID_NDK="$ANDROID_NDK_ROOT" # rust-skia uses this alias
export ANDROID_JAR="$ANDROID_SDK_ROOT/platforms/android-36/android.jar" # compile API, distinct from native minimum API26
export SKIA_GN_COMMAND="$SKIA_SOURCE_DIR/bin/gn" export SKIA_GN_COMMAND="$SKIA_SOURCE_DIR/bin/gn"
export SKIA_NINJA_COMMAND="$(command -v ninja)" export SKIA_NINJA_COMMAND="$(command -v ninja)"
export PATH="$JAVA_HOME/bin:$LLVM_HOME/bin:$ANDROID_SDK_ROOT/build-tools/36.0.0:$PATH" export PATH="$JAVA_HOME/bin:$LLVM_HOME/bin:$ANDROID_SDK_ROOT/build-tools/36.0.0:$PATH"
@@ -218,8 +220,9 @@ it requires the separate signing/store or APK-generation process. These bundles
The harness supports isolated offline smoke; a normal launch without smoke extras uses the ordinary The harness supports isolated offline smoke; a normal launch without smoke extras uses the ordinary
runtime and must be confined to an authorized disposable test installation. It is not production runtime and must be confined to an authorized disposable test installation. It is not production
feature/device acceptance. Neither configuration nor installation proves live voice, official-client feature/device acceptance. Neither configuration nor installation proves live voice, official-client
interoperability, Bluetooth/background behavior or full mobile parity. The read-only runner inventory interoperability, Bluetooth/background behavior or full mobile parity. The first local WSL2 ARM64
passed; no successful Android build, generated APK/AAB, device install or mobile acceptance is claimed. harness build and APK signature/16-KiB/JNI/package verification passed on 2026-11-11 after the build
integration fixes recorded in `docs/mobile-port-progress.md`. Phone execution remains unverified.
**iOS still requires macOS and Xcode/Apple SDKs**, either locally or on separately provisioned macOS **iOS still requires macOS and Xcode/Apple SDKs**, either locally or on separately provisioned macOS
CI, plus appropriate signing/provisioning for devices. Windows editing does not make iOS buildable CI, plus appropriate signing/provisioning for devices. Windows editing does not make iOS buildable
+9 -1
View File
@@ -1,6 +1,14 @@
# Мобильный порт: передача состояния # Мобильный порт: передача состояния
Обновлено: **2026-11-11**. Принятая Windows-база **`05e8d34bcf0e24a44f76e65220293c45b6821798`** опубликована в `origin/main` с тегом **`desktop-baseline-0.1.7-20261111`**. Активная мобильная ветка — **`feature/mobile-port`**; Android implementation подготовлена поверх `cb1d682dfb307ec41d73434ab40de5de0b30410e` к разрешённому владельцем commit/push. Получатель должен сверить полный SHA переданной ревизии, содержащей этот handoff и Android-код, с `git rev-parse HEAD`; прежний `cb1d682` не является ревизией готовой передачи. Следующий этап — Linux-сборка на WSL2 другого разработчика. На этом ПК WSL не возвращать. CI/provisioning и iOS отложены. Rust/Slint — единственный host; APK/device proof отсутствует. История ниже не заменяет текущий статус. Updated **2026-11-11**. Windows baseline remains `05e8d34bcf0e24a44f76e65220293c45b6821798`; active branch is `feature/mobile-port`. The owner explicitly authorized using existing WSL Ubuntu for Android builds (server1 container only as fallback), then committing/pushing fixes and publishing a separate Android APK tag/release. This supersedes the older no-local-WSL and no-release decisions below. Source base: `3d2e76eddd281e6801bb5fc591d2443a957568b7`, with the build fixes described here; the delivered build-info includes the exact source patch rather than claiming an unchanged base revision.
## First Android APK build
- Existing WSL Ubuntu24.04 x64, `/home/user/src/TeamsPeach`; full pinned Android WebRTC source build and Rust/Slint ARM64 release library succeeded. JDK21, Rust1.96, SDK36/build-tools36.0.0, full NDK28.2.13676358, LLVM18 and matching Skia m153-0.101.2 sources; one Cargo/Ninja job. No server1 container was needed.
- Fixed actual first-build failures: Chromium DEPS NDK is sysroot-only (Cargo needs complete NDK); Skia uses `ANDROID_NDK`, Slint Java compilation needs explicit SDK36 `ANDROID_JAR` despite native API26; vendored jar destination used the wrong target root; accessibility cast needs NonNull::as_ptr; Gradle launcher CRLF and implicit build-tools35; permission observer used non-public PackageManager API; WebRTC JNI linker arguments must be emitted by the final cdylib build script.
- `xtask package` and `verify-package` passed for `TeamsPeach-0.1.7-android-arm64-harness-test.apk`, 121385639 bytes, SHA256 `ab0c4119b4a8abfebbb31ed185459da8b1ef6c57c86324ad7862014aa1085d1b`. APK v2 test signature, ARM64, 16-KiB ZIP/ELF alignment and JNI exports verified. Android8/API26 minimum. Install with `adb install -t`; not a production signing identity.
- Delivery: `C:/Users/Admin/Desktop/TeamsPeach-Android-0.1.7/`, APK plus build-info, exact build-fixes.patch and dependency/build/package verification receipts. Private test keystore is not included. WSL caches retained for incremental builds. Phone runtime/UI/voice/background acceptance has NOT run; no device installed, microphone activated, server connected or Windows installation modified.
- Publication requested as a separate Android prerelease, not a `v*` desktop tag or desktop updater manifest. Record successful push/release only after remote acknowledgement; authorization failures are not publication.
## Текущий этап: реализация Android, CI отложен ## Текущий этап: реализация Android, CI отложен
+1
View File
@@ -98,3 +98,4 @@ i-slint-backend-android-activity = { version = "=1.18.1", default-features = fal
[build-dependencies] [build-dependencies]
slint-build.workspace = true slint-build.workspace = true
cc = "1" cc = "1"
webrtc-sys-build = "=0.3.21"
+5
View File
@@ -3,6 +3,11 @@ fn main() {
build_platform(); build_platform();
slint_build::compile("ui/app.slint").expect("compile native interface"); slint_build::compile("ui/app.slint").expect("compile native interface");
if std::env::var_os("CARGO_FEATURE_WEBRTC").is_some() { if std::env::var_os("CARGO_FEATURE_WEBRTC").is_some() {
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("android") {
// Link arguments from the webrtc-sys rlib do not propagate into this cdylib.
assert!(std::env::var_os("LK_CUSTOM_WEBRTC").is_some(), "Android requires verified source-built WebRTC");
webrtc_sys_build::configure_jni_symbols().expect("export matching WebRTC JNI entrypoints");
}
build_camera(); build_camera();
build_mobile_capture(); build_mobile_capture();
} }
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -27,7 +27,7 @@ fn flag(item:&ItemRc,property:P)->bool{item.accessible_string_property(property)
fn class(role:AccessibleRole)->&'static str{match role{AccessibleRole::Button=>"android.widget.Button",AccessibleRole::Checkbox=>"android.widget.CheckBox",AccessibleRole::Switch=>"android.widget.Switch",AccessibleRole::RadioButton=>"android.widget.RadioButton",AccessibleRole::TextInput=>"android.widget.EditText",AccessibleRole::Slider|AccessibleRole::Spinbox=>"android.widget.SeekBar",AccessibleRole::List|AccessibleRole::Tree=>"android.widget.ListView",AccessibleRole::Image=>"android.widget.ImageView",AccessibleRole::Text=>"android.widget.TextView",AccessibleRole::Combobox=>"android.widget.Spinner",AccessibleRole::ProgressIndicator=>"android.widget.ProgressBar",_=>"android.view.View"}} fn class(role:AccessibleRole)->&'static str{match role{AccessibleRole::Button=>"android.widget.Button",AccessibleRole::Checkbox=>"android.widget.CheckBox",AccessibleRole::Switch=>"android.widget.Switch",AccessibleRole::RadioButton=>"android.widget.RadioButton",AccessibleRole::TextInput=>"android.widget.EditText",AccessibleRole::Slider|AccessibleRole::Spinbox=>"android.widget.SeekBar",AccessibleRole::List|AccessibleRole::Tree=>"android.widget.ListView",AccessibleRole::Image=>"android.widget.ImageView",AccessibleRole::Text=>"android.widget.TextView",AccessibleRole::Combobox=>"android.widget.Spinner",AccessibleRole::ProgressIndicator=>"android.widget.ProgressBar",_=>"android.view.View"}}
impl State { impl State {
fn id(&mut self,item:&ItemRc)->Option<i32>{ fn id(&mut self,item:&ItemRc)->Option<i32>{
let key=(ItemTreeRef::as_ptr(ItemTreeRc::borrow(item.item_tree())) as usize,item.index()); let key=(ItemTreeRef::as_ptr(ItemTreeRc::borrow(item.item_tree())).as_ptr() as usize,item.index());
if let Some(entry)=self.items.get(&key){if entry.weak.upgrade().is_some_and(|old|old==*item){return Some(entry.id);}} if let Some(entry)=self.items.get(&key){if entry.weak.upgrade().is_some_and(|old|old==*item){return Some(entry.id);}}
let id=self.next;self.next=self.next.checked_add(1)?; let id=self.next;self.next=self.next.checked_add(1)?;
self.items.insert(key,Item{weak:item.downgrade(),id});Some(id) self.items.insert(key,Item{weak:item.downgrade(),id});Some(id)
+1 -1
View File
@@ -26,7 +26,7 @@
{ {
"path": "build.rs", "path": "build.rs",
"upstream_sha256": "4e9936c0d9dde5f74cd9c0557947e8d47ed7569a7bc0c6bc386f6f36b444ea91", "upstream_sha256": "4e9936c0d9dde5f74cd9c0557947e8d47ed7569a7bc0c6bc386f6f36b444ea91",
"modified_sha256": "0a5af9c3aac43e079778f6d33d556f3ccb990fd03f92ac5f9f27958189a19fe3" "modified_sha256": "a50b5cf92b547d51d91ce0a80d9f6e03c139b0d6b019e3a2900affc0f58bd5ee"
}, },
{ {
"path": "include/livekit/peer_connection_factory.h", "path": "include/livekit/peer_connection_factory.h",
+4 -6
View File
@@ -442,12 +442,10 @@ fn copy_libwebrtc_jar(webrtc_dir: &PathBuf) {
} }
fn get_output_path() -> PathBuf { fn get_output_path() -> PathBuf {
let manifest_dir_string = env::var("CARGO_MANIFEST_DIR").unwrap(); // OUT_DIR is <actual target-dir>/<target>/<profile>/build/<crate>/out.
let build_type = env::var("PROFILE").unwrap(); // It respects workspaces and CARGO_TARGET_DIR, unlike a path relative to this vendored crate.
let build_target = env::var("TARGET").unwrap(); let out = PathBuf::from(env::var_os("OUT_DIR").expect("Cargo OUT_DIR"));
let path = out.ancestors().nth(3).expect("Cargo profile output directory").to_owned()
Path::new(&manifest_dir_string).join("../target").join(build_target).join(build_type);
return PathBuf::from(path);
} }
fn configure_darwin_sysroot(builder: &mut cc::Build) { fn configure_darwin_sysroot(builder: &mut cc::Build) {
+1
View File
@@ -20,6 +20,7 @@ require(abi in listOf("arm64-v8a", "x86_64")) { "Only ARM64 production and x64 e
android { android {
namespace = "dev.teamspeach.mobile" namespace = "dev.teamspeach.mobile"
compileSdk = 36 compileSdk = 36
buildToolsVersion = "36.0.0"
ndkVersion = "28.2.13676358" ndkVersion = "28.2.13676358"
buildFeatures { buildConfig = true } buildFeatures { buildConfig = true }
signingConfigs.getByName("debug").storeFile = debugKey.get().asFile signingConfigs.getByName("debug").storeFile = debugKey.get().asFile
@@ -39,8 +39,9 @@ public final class PlatformBridge {
if (Build.VERSION.SDK_INT >= 33) value.registerReceiver(receiver, screen, Context.RECEIVER_NOT_EXPORTED); else value.registerReceiver(receiver, screen); if (Build.VERSION.SDK_INT >= 33) value.registerReceiver(receiver, screen, Context.RECEIVER_NOT_EXPORTED); else value.registerReceiver(receiver, screen);
value.getSystemService(AccessibilityManager.class).addAccessibilityStateChangeListener(enabled -> { TeamsPeachActivity current=activity.get();if(current!=null)current.reportConfiguration(); }); value.getSystemService(AccessibilityManager.class).addAccessibilityStateChangeListener(enabled -> { TeamsPeachActivity current=activity.get();if(current!=null)current.reportConfiguration(); });
final boolean[] previousPermissions = { granted(0), granted(1), granted(2) }; final boolean[] previousPermissions = { granted(0), granted(1), granted(2) };
value.getPackageManager().addOnPermissionsChangeListener(uid -> { AppOpsManager ops = value.getSystemService(AppOpsManager.class);
if (uid != android.os.Process.myUid()) return; AppOpsManager.OnOpChangedListener permissionChanged = (op, packageName) -> MAIN.post(() -> {
if (packageName != null && !packageName.equals(value.getPackageName())) return;
for (int permission = 0; permission < 3; permission++) { for (int permission = 0; permission < 3; permission++) {
boolean allowed = granted(permission); boolean allowed = granted(permission);
nativePermission(0, permission, allowed); nativePermission(0, permission, allowed);
@@ -51,6 +52,8 @@ public final class PlatformBridge {
previousPermissions[permission] = allowed; previousPermissions[permission] = allowed;
} }
}); });
ops.startWatchingMode(AppOpsManager.OPSTR_RECORD_AUDIO, value.getPackageName(), permissionChanged);
ops.startWatchingMode(AppOpsManager.OPSTR_CAMERA, value.getPackageName(), permissionChanged);
} }
static boolean post(Runnable work) { static boolean post(Runnable work) {
if (pending.incrementAndGet() > 32) { pending.decrementAndGet(); return false; } if (pending.incrementAndGet() > 32) { pending.decrementAndGet(); return false; }
+5 -2
View File
@@ -273,8 +273,11 @@ pub(crate) fn build(root: &Path, options: &Options) -> Result<(), String> {
} }
} }
"android" => { "android" => {
// Use the very same DEPS-pinned NDK for Rust CXX and the archive. // Chromium's DEPS NDK contains only sysroot/debugger files, not clang drivers.
let ndk = source.join("third_party/android_toolchain/ndk"); // Cargo/Skia/CXX need the complete SDK-installed NDK required by Android packaging.
let ndk = PathBuf::from(environment.get("ANDROID_NDK_ROOT").or_else(||environment.get("ANDROID_NDK_HOME")).ok_or("Android Cargo build requires the full installed NDK")?);
let properties=read_text(&ndk.join("source.properties"))?;
if !properties.lines().any(|line|line.split_once('=').is_some_and(|(key,value)|key.trim()=="Pkg.Revision"&&value.trim()=="28.2.13676358")){return Err("Android Cargo build requires NDK 28.2.13676358, matching Gradle".into());}
let bin = ndk.join("toolchains/llvm/prebuilt/linux-x86_64/bin"); let bin = ndk.join("toolchains/llvm/prebuilt/linux-x86_64/bin");
let clang = bin.join(format!("{}26-clang", target.triple)); let clang = bin.join(format!("{}26-clang", target.triple));
let clangxx = bin.join(format!("{}26-clang++", target.triple)); let clangxx = bin.join(format!("{}26-clang++", target.triple));