Automate isolated Android APK builds and fix phone onboarding
android-ci / android-arm64 (push) Failing after 1m29s

This commit is contained in:
bit9992 committed 2026-11-11 22:07:47 +03:00
1 parent 32318e3e3f
commit 8d25224816
19 files changed
+664 -231

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
{
"schema": 1,
"rust": {
"version": "1.96.0",
"target": "aarch64-linux-android",
"rustupVersion": "1.29.3",
"rustupUrl": "https://static.rust-lang.org/rustup/archive/1.29.3/x86_64-unknown-linux-gnu/rustup-init",
"rustupSha256": "b1c8cb14e30889e7e2999e6b69e62d9e9b9ffc0f4df8180564d306d9680e6c55",
"checksumSource": "https://static.rust-lang.org/rustup/archive/1.29.3/x86_64-unknown-linux-gnu/rustup-init.sha256"
},
"android": {
"commandLineToolsVersion": "15859902",
"commandLineToolsUrl": "https://dl.google.com/android/repository/commandlinetools-linux-15859902_latest.zip",
"commandLineToolsSha256": "4e4c464f145a7512b57d088ac6c278c03c9eea610886b35a5e0804e74eedf583",
"checksumSource": "https://developer.android.com/studio#command-line-tools-only",
"platform": "android-36",
"buildTools": "36.0.0",
"ndk": "28.2.13676358"
},
"gradle": {
"version": "8.14.3",
"pinSource": "platform/android/gradle/wrapper/gradle-wrapper.properties"
},
"skia": {
"revision": "m153-0.101.2",
"url": "https://codeload.github.com/rust-skia/skia/tar.gz/m153-0.101.2",
"sha256": "30c8b51a0a32fae63562c303bdc91605519a9598951422610e3fb8685b3c4f6f",
"metadataSource": "https://raw.githubusercontent.com/rust-skia/rust-skia/0.153.3/skia-bindings/Cargo.toml",
"urlSource": "https://raw.githubusercontent.com/rust-skia/rust-skia/0.153.3/skia-bindings/build_support/binary_cache/download.rs",
"gnRevision": "b2afae122eeb6ce09c52d63f67dc53fc517dbdc8",
"gnPinSource": "https://raw.githubusercontent.com/rust-skia/skia/m153-0.101.2/bin/fetch-gn"
},
"bundletool": {
"version": "1.18.3",
"url": "https://github.com/google/bundletool/releases/download/1.18.3/bundletool-all-1.18.3.jar",
"sha256": "a099cfa1543f55593bc2ed16a70a7c67fe54b1747bb7301f37fdfd6d91028e29",
"checksumSource": "https://api.github.com/repos/google/bundletool/releases/tags/1.18.3"
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ case "$variant" in
*) echo "Expected harness or production" >&2; exit 2 ;;
esac
out="dist/android/$variant"
cargo run --locked -p xtask -- build --target "$TARGET" --llvm-dir "$LLVM_HOME" --skia-source "$SKIA_SOURCE_DIR" --test-harness "$harness"
cargo run --locked -p xtask -- build --target "$TARGET" --llvm-dir "$LLVM_HOME" --skia-source "$SKIA_SOURCE_DIR" --test-harness "$harness" --jobs "${CARGO_BUILD_JOBS:-1}"
# Explicit online dependency resolution supports a fresh Gradle cache.
# Bootstrap still requires the local checksum-pinned zip; SDK downloads stay disabled.
cargo run --locked -p xtask -- package --target "$TARGET" --out "$out" --test-harness "$harness" --gradle-online true
+228
View File
@@ -0,0 +1,228 @@
#!/usr/bin/env bash
# Only the explicitly authorized, disposable Android CI job container may install tools.
set -euo pipefail
umask 022
fail() { printf 'Android CI provisioning refused: %s\n' "$*" >&2; exit 1; }
[[ "$(uname -s)" == Linux && "$(uname -m)" == x86_64 ]] || fail 'Linux x86_64 is required'
[[ "${ANDROID_CI_PROVISION:-}" == container ]] || fail 'ANDROID_CI_PROVISION=container is required'
[[ "${GITHUB_ACTIONS:-}" == true || "${GITEA_ACTIONS:-}" == true ]] || fail 'an Actions job is required'
[[ -f /.dockerenv || -f /run/.containerenv ]] || fail 'no Docker/Podman container marker; host provisioning is forbidden'
: "${GITHUB_WORKSPACE:?Actions workspace is required}"
: "${GITHUB_ENV:?Actions environment output is required}"
: "${GITHUB_PATH:?Actions PATH output is required}"
if (( EUID == 0 )); then
elevate=()
else
command -v sudo >/dev/null || fail 'root or passwordless sudo is required inside the container'
sudo -n true || fail 'passwordless sudo is required inside the container'
elevate=(sudo -n)
fi
# No apt update, download, installation, or cache creation precedes this gate.
# MemAvailable alone can describe the host, so also respect every visible cgroup ancestor.
for filesystem in "$GITHUB_WORKSPACE" /; do
free="$(df --output=avail -B1 "$filesystem")"
free="${free##*$'\n'}"
[[ "$free" =~ ^[[:space:]]*[0-9]+[[:space:]]*$ ]] || fail 'cannot determine free disk'
printf 'RESOURCE disk=%s availableBytes=%s requiredBytes=%s\n' "$filesystem" "$free" "$((100 * 1024**3))"
(( free >= 100 * 1024**3 )) || fail 'resource gate needs at least 100 GiB free disk, including cache hits; no provisioning performed'
done
available=0
while read -r key value _; do
if [[ "$key" == MemAvailable: ]]; then available=$((value * 1024)); break; fi
done < /proc/meminfo
(( available > 0 )) || fail 'cannot determine available memory'
limit_count=0
while IFS=: read -r _ controllers relative; do
if [[ -z "$controllers" ]]; then
cgroup_root=/sys/fs/cgroup
limit_names=(memory.max memory.high)
usage_name=memory.current
elif [[ ",$controllers," == *,memory,* ]]; then
cgroup_root=/sys/fs/cgroup/memory
limit_names=(memory.limit_in_bytes)
usage_name=memory.usage_in_bytes
else
continue
fi
current="$(realpath -m "$cgroup_root/${relative#/}")"
case "$current" in "$cgroup_root"|"$cgroup_root/"*) ;; *) current="$cgroup_root" ;; esac
[[ -d "$current" ]] || current="$cgroup_root"
while :; do
for limit_name in "${limit_names[@]}"; do
if [[ -f "$current/$limit_name" && -f "$current/$usage_name" ]]; then
limit="$(<"$current/$limit_name")"
if [[ "$limit" != max ]]; then
[[ "$limit" =~ ^[0-9]+$ ]] || fail 'invalid cgroup memory limit'
usage="$(<"$current/$usage_name")"
[[ "$usage" =~ ^[0-9]+$ ]] || fail 'invalid cgroup memory usage'
remaining=$((limit > usage ? limit - usage : 0))
(( remaining >= available )) || available="$remaining"
limit_count=$((limit_count + 1))
fi
fi
done
[[ "$current" != "$cgroup_root" ]] || break
current="${current%/*}"
done
done < /proc/self/cgroup
printf 'RESOURCE effectiveAvailableMemoryBytes=%s requiredBytes=%s cgroupLimits=%s\n' "$available" "$((8 * 1024**3))" "$limit_count"
(( available >= 8 * 1024**3 )) || fail 'resource gate needs at least 8 GiB available memory; no provisioning performed'
# Stock noble packages provide matching LLVM/libclang18 and JDK21 without third-party apt setup.
# shellcheck disable=SC1091
source /etc/os-release
[[ "$ID" == ubuntu && "$VERSION_ID" == 24.04 ]] || fail 'the container image must use Ubuntu 24.04 (noble)'
workspace="$(realpath "$GITHUB_WORKSPACE")"
cd "$workspace"
[[ ! -L .android-ci && ! -L .android-ci/tools ]] || fail 'tool cache roots must not be symlinks'
tools="$workspace/.android-ci/tools"
mkdir -p "$tools"/{downloads,home,tmp,cache,config,data,apt/archives/partial,apt/lists/partial}
export HOME="$tools/home" TMPDIR="$tools/tmp"
export XDG_CACHE_HOME="$tools/cache" XDG_CONFIG_HOME="$tools/config" XDG_DATA_HOME="$tools/data"
export CARGO_HOME="$tools/cargo" RUSTUP_HOME="$tools/rustup" GRADLE_USER_HOME="$tools/gradle"
export ANDROID_USER_HOME="$tools/android-user" ANDROID_EMULATOR_HOME="$tools/android-user/emulator"
export ANDROID_SDK_HOME="$HOME" JAVA_TOOL_OPTIONS="-Duser.home=$HOME"
export GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null GIT_TERMINAL_PROMPT=0
export PIP_CACHE_DIR="$tools/pip-cache" CIPD_CACHE_DIR="$tools/cipd-cache" VPYTHON_VIRTUALENV_ROOT="$tools/vpython-cache"
export DEPOT_TOOLS_METRICS=0 DEPOT_TOOLS_UPDATE=0
mkdir -p "$CARGO_HOME" "$RUSTUP_HOME" "$GRADLE_USER_HOME" "$ANDROID_USER_HOME"
# Apt archives/lists are workspace-local; installed packages exist only in this job container.
apt_options=(-o "Dir::Cache::archives=$tools/apt/archives" -o "Dir::State::lists=$tools/apt/lists" -o APT::Sandbox::User=root)
"${elevate[@]}" env DEBIAN_FRONTEND=noninteractive apt-get "${apt_options[@]}" update
"${elevate[@]}" env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get "${apt_options[@]}" install -y --no-install-recommends \
ca-certificates openjdk-21-jdk-headless clang-18 llvm-18 lld-18 libclang-18-dev \
cmake ninja-build git python3 curl unzip zip pkg-config build-essential \
autoconf automake libtool bison flex gperf nasm binutils file patch rsync \
xz-utils bzip2 zstd gettext libxml2-utils locales \
libc6-i386 lib32gcc-s1 lib32stdc++6 zlib1g-dev libbz2-dev liblzma-dev \
libssl-dev libffi-dev libelf-dev libcap-dev libudev-dev libglib2.0-dev \
libnss3-dev libnspr4-dev libdbus-1-dev libdrm-dev libgbm-dev \
libasound2-dev libpulse-dev libcups2-dev libatk1.0-dev libatspi2.0-dev \
libcairo2-dev libpango1.0-dev libgtk-3-dev libfontconfig1-dev libfreetype6-dev \
libx11-dev libx11-xcb-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev \
libxext-dev libxfixes-dev libxi-dev libxrandr-dev libxrender-dev libxss-dev libxtst-dev \
libxkbcommon-dev libxshmfence-dev libwayland-dev libegl1-mesa-dev libgl1-mesa-dev
# Read checked-in pins; Gradle's URL and checksum have exactly one authority: its wrapper.
pins="$(python3 - <<'PY'
import json, pathlib, re, shlex, tomllib
p = json.loads(pathlib.Path('.gitea/android-ci-tools.json').read_text())
assert p['schema'] == 1
rust = tomllib.loads(pathlib.Path('rust-toolchain.toml').read_text())['toolchain']['channel']
assert rust == p['rust']['version'] == '1.96.0', 'toolchain pin mismatch'
props = dict(line.split('=', 1) for line in pathlib.Path(p['gradle']['pinSource']).read_text().splitlines() if '=' in line)
gradle_url = props['distributionUrl'].replace('\\:', ':')
assert gradle_url == 'https://services.gradle.org/distributions/gradle-8.14.3-bin.zip'
assert re.fullmatch(r'[0-9a-f]{64}', props['distributionSha256Sum'])
values = {
'rust_version': rust, 'rust_target': p['rust']['target'],
'rustup_url': p['rust']['rustupUrl'], 'rustup_sha': p['rust']['rustupSha256'],
'sdk_tools_version': p['android']['commandLineToolsVersion'],
'sdk_tools_url': p['android']['commandLineToolsUrl'], 'sdk_tools_sha': p['android']['commandLineToolsSha256'],
'sdk_platform': p['android']['platform'], 'build_tools': p['android']['buildTools'], 'ndk_version': p['android']['ndk'],
'gradle_url': gradle_url, 'gradle_sha': props['distributionSha256Sum'],
'skia_revision': p['skia']['revision'], 'skia_url': p['skia']['url'], 'skia_sha': p['skia']['sha256'],
'skia_gn_revision': p['skia']['gnRevision'],
'bundletool_version': p['bundletool']['version'], 'bundletool_url': p['bundletool']['url'], 'bundletool_sha': p['bundletool']['sha256'],
}
for key, value in values.items():
assert '\n' not in value and '\r' not in value
print(f'{key}={shlex.quote(value)}')
PY
)"
eval "$pins"
fetch() {
local url="$1" digest="$2" destination="$3"
if [[ -f "$destination" ]]; then
printf '%s %s\n' "$digest" "$destination" | sha256sum --check --status || fail "cached download checksum mismatch: $destination"
return
fi
curl --fail --location --show-error --silent --retry 3 --proto '=https' --tlsv1.2 "$url" -o "$destination.part"
printf '%s %s\n' "$digest" "$destination.part" | sha256sum --check --status || fail "download checksum mismatch: $url"
mv "$destination.part" "$destination"
}
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 LLVM_HOME=/usr/lib/llvm-18 LIBCLANG_PATH=/usr/lib/llvm-18/lib
export PATH="$CARGO_HOME/bin:$JAVA_HOME/bin:$LLVM_HOME/bin:$PATH"
fetch "$rustup_url" "$rustup_sha" "$tools/downloads/rustup-init"
chmod +x "$tools/downloads/rustup-init"
if [[ ! -x "$CARGO_HOME/bin/rustup" ]]; then
"$tools/downloads/rustup-init" -y --no-modify-path --profile minimal --default-toolchain none
fi
rustup toolchain install "$rust_version" --profile minimal --no-self-update
rustup target add --toolchain "$rust_version" "$rust_target"
export RUSTUP_TOOLCHAIN="$rust_version"
export ANDROID_HOME="$tools/android-sdk" ANDROID_SDK_ROOT="$tools/android-sdk"
fetch "$sdk_tools_url" "$sdk_tools_sha" "$tools/downloads/commandlinetools-linux-$sdk_tools_version.zip"
if [[ ! -x "$ANDROID_SDK_ROOT/cmdline-tools/$sdk_tools_version/bin/sdkmanager" ]]; then
stage="$(mktemp -d "$tools/tmp/sdk-tools.XXXXXXXX")"
unzip -q "$tools/downloads/commandlinetools-linux-$sdk_tools_version.zip" -d "$stage"
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
mv "$stage/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/$sdk_tools_version"
rmdir "$stage"
fi
sdkmanager="$ANDROID_SDK_ROOT/cmdline-tools/$sdk_tools_version/bin/sdkmanager"
# The owner explicitly authorized SDK license acceptance in this isolated CI container.
# Ignore only yes(1)'s expected SIGPIPE; sdkmanager's own failure remains fatal.
set +e
yes | "$sdkmanager" --sdk_root="$ANDROID_SDK_ROOT" --licenses
license_status=("${PIPESTATUS[@]}")
set -e
[[ "${license_status[1]}" == 0 ]] || fail 'sdkmanager license acceptance failed'
"$sdkmanager" --sdk_root="$ANDROID_SDK_ROOT" --install "platforms;$sdk_platform" "build-tools;$build_tools" "ndk;$ndk_version" platform-tools
export ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk/$ndk_version"
export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT" ANDROID_NDK="$ANDROID_NDK_ROOT"
export ANDROID_JAR="$ANDROID_SDK_ROOT/platforms/$sdk_platform/android.jar"
export ANDROID_PLATFORM=android-26 ANDROID_API_LEVEL=26
export PATH="$ANDROID_SDK_ROOT/cmdline-tools/$sdk_tools_version/bin:$ANDROID_SDK_ROOT/build-tools/$build_tools:$ANDROID_SDK_ROOT/platform-tools:$PATH"
export TEAMSPEACH_GRADLE_DISTRIBUTION="$tools/downloads/gradle-8.14.3-bin.zip"
fetch "$gradle_url" "$gradle_sha" "$TEAMSPEACH_GRADLE_DISTRIBUTION"
export TEAMSPEACH_BUNDLETOOL="$tools/downloads/bundletool-all-$bundletool_version.jar"
fetch "$bundletool_url" "$bundletool_sha" "$TEAMSPEACH_BUNDLETOOL"
export SKIA_SOURCE_DIR="$tools/skia-$skia_revision"
fetch "$skia_url" "$skia_sha" "$tools/downloads/skia-$skia_revision.tar.gz"
if [[ ! -f "$SKIA_SOURCE_DIR/.android-ci-archive-sha256" ]]; then
[[ ! -e "$SKIA_SOURCE_DIR" ]] || fail 'incomplete Skia cache; remove only that CI cache entry before retrying'
stage="$(mktemp -d "$tools/tmp/skia.XXXXXXXX")"
tar -xzf "$tools/downloads/skia-$skia_revision.tar.gz" --strip-components=1 -C "$stage"
printf '%s\n' "$skia_sha" > "$stage/.android-ci-archive-sha256"
mv "$stage" "$SKIA_SOURCE_DIR"
fi
[[ "$(cat "$SKIA_SOURCE_DIR/.android-ci-archive-sha256")" == "$skia_sha" ]] || fail 'Skia cache pin mismatch'
# Android does not use emscripten. This skips only that unrelated toolchain, not native deps or GN.
GIT_SYNC_DEPS_SKIP_EMSDK=1 python3 "$SKIA_SOURCE_DIR/tools/git-sync-deps"
python3 - "$SKIA_SOURCE_DIR" "$skia_gn_revision" <<'PY'
import pathlib, runpy, subprocess, sys
root = pathlib.Path(sys.argv[1])
assert (root / 'BUILD.gn').is_file()
assert sys.argv[2] in (root / 'bin/fetch-gn').read_text(), 'GN revision changed'
deps = runpy.run_path(str(root / 'tools/git-sync-deps'))['parse_file_to_dict'](str(root / 'DEPS'))['deps']
for relative, spec in deps.items():
if not isinstance(spec, str):
continue
expected = spec.rsplit('@', 1)[1]
actual = subprocess.check_output(['git', '-C', str(root / relative), 'rev-parse', 'HEAD'], text=True).strip()
assert actual == expected, f'Skia dependency mismatch: {relative}'
PY
export SKIA_GN_COMMAND="$SKIA_SOURCE_DIR/bin/gn" SKIA_NINJA_COMMAND="$(command -v ninja)" SKIA_FORCE_BUILD=1
[[ -x "$SKIA_GN_COMMAND" && -f "$ANDROID_JAR" && -x "$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" ]] || fail 'provisioned Android/Skia files are missing'
# Workflow steps are new shells. Publish the complete isolated tools/cache contract.
for name in HOME TMPDIR XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME CARGO_HOME RUSTUP_HOME RUSTUP_TOOLCHAIN \
GRADLE_USER_HOME ANDROID_USER_HOME ANDROID_EMULATOR_HOME ANDROID_SDK_HOME JAVA_TOOL_OPTIONS \
GIT_CONFIG_NOSYSTEM GIT_CONFIG_GLOBAL GIT_TERMINAL_PROMPT PIP_CACHE_DIR CIPD_CACHE_DIR VPYTHON_VIRTUALENV_ROOT \
DEPOT_TOOLS_METRICS DEPOT_TOOLS_UPDATE JAVA_HOME LLVM_HOME LIBCLANG_PATH \
ANDROID_HOME ANDROID_SDK_ROOT ANDROID_NDK_ROOT ANDROID_NDK_HOME ANDROID_NDK ANDROID_JAR ANDROID_PLATFORM ANDROID_API_LEVEL \
TEAMSPEACH_GRADLE_DISTRIBUTION TEAMSPEACH_BUNDLETOOL SKIA_SOURCE_DIR SKIA_GN_COMMAND SKIA_NINJA_COMMAND SKIA_FORCE_BUILD; do
[[ "${!name}" != *$'\n'* && "${!name}" != *$'\r'* ]] || fail "invalid multiline environment value: $name"
printf '%s=%s\n' "$name" "${!name}" >> "$GITHUB_ENV"
done
printf '%s\n' "$CARGO_HOME/bin" "$JAVA_HOME/bin" "$LLVM_HOME/bin" \
"$ANDROID_SDK_ROOT/cmdline-tools/$sdk_tools_version/bin" "$ANDROID_SDK_ROOT/build-tools/$build_tools" "$ANDROID_SDK_ROOT/platform-tools" >> "$GITHUB_PATH"
printf 'Android CI tools provisioned in %s (no build, signing or publication performed by setup).\n' "$tools"
+105 -186
View File
@@ -1,19 +1,18 @@
# Trusted manual runs only. Inventory uses the existing generic runner;
# full builds require an administrator-provisioned Linux x64 Android runner.
# Neither mode installs host tools, publishes, or uses a device.
# Trusted mobile-branch pushes only; never execute fork pull requests on the shared runner.
# Installs occur only inside the disposable Ubuntu container. No releases or phone actions.
name: android-ci
on:
push:
branches: [feature/mobile-port]
workflow_dispatch:
inputs:
mode:
description: Inventory only, or full Android build on the dedicated runner
description: Build the test APK, or inspect resources only
required: true
default: inventory
default: build
type: choice
options:
- inventory
- build
options: [build, inventory]
permissions:
contents: read
@@ -21,210 +20,130 @@ permissions:
defaults:
run:
shell: bash
working-directory: ${{ github.workspace }}/android-${{ github.run_id }}
working-directory: ${{ github.workspace }}
jobs:
runner-inventory:
if: ${{ github.event.inputs.mode != 'build' }}
runs-on: ubuntu-latest
timeout-minutes: 5
defaults:
run:
working-directory: ${{ github.workspace }}
env:
CONFIG_ANDROID_SDK_ROOT: ${{ vars.ANDROID_SDK_ROOT }}
CONFIG_ANDROID_JAVA_HOME: ${{ vars.ANDROID_JAVA_HOME }}
CONFIG_NATIVE_LLVM_HOME: ${{ vars.NATIVE_LLVM_HOME }}
CONFIG_NATIVE_LIBCLANG_PATH: ${{ vars.NATIVE_LIBCLANG_PATH }}
CONFIG_NATIVE_SKIA_SOURCE_DIR: ${{ vars.NATIVE_SKIA_SOURCE_DIR }}
CONFIG_ANDROID_GRADLE_DISTRIBUTION: ${{ vars.ANDROID_GRADLE_DISTRIBUTION }}
CONFIG_ANDROID_BUNDLETOOL: ${{ vars.ANDROID_BUNDLETOOL }}
steps:
# No checkout, downloads, env dump, secret access, build or installation.
- name: Inspect available runner resources and Android prerequisites
run: |
set -euo pipefail
printf 'OS=%s ARCH=%s\n' "$(uname -s)" "$(uname -m)"
printf 'CPU_COUNT=%s\n' "$(getconf _NPROCESSORS_ONLN)"
df -Pk .
if [ -r /proc/meminfo ]; then
while IFS=: read -r key value; do
case "$key" in
MemTotal|MemAvailable|SwapTotal|SwapFree|CommitLimit|Committed_AS) printf '%s:%s\n' "$key" "$value" ;;
esac
done < /proc/meminfo
fi
for file in /sys/fs/cgroup/memory.max /sys/fs/cgroup/memory.current /sys/fs/cgroup/memory.swap.max /sys/fs/cgroup/cpu.max /sys/fs/cgroup/memory/memory.limit_in_bytes /sys/fs/cgroup/memory/memory.usage_in_bytes /sys/fs/cgroup/cpu/cpu.cfs_quota_us /sys/fs/cgroup/cpu/cpu.cfs_period_us; do
if [ -r "$file" ]; then printf '%s=' "$file"; cat "$file"; fi
done
for tool in cargo rustc rustup git cmake ninja python3 pkg-config clang clang++ ar llvm-strip llvm-readelf java javac jar keytool jarsigner sh zipalign aapt2 apksigner sdkmanager node; do
if command -v "$tool" >/dev/null 2>&1; then printf 'TOOL %s=present\n' "$tool"; else printf 'TOOL %s=missing-from-PATH\n' "$tool"; fi
done
for tool in java javac clang cmake ninja; do
if command -v "$tool" >/dev/null 2>&1; then
printf 'VERSION %s\n' "$tool"
case "$tool" in java|javac) flag=-version ;; *) flag=--version ;; esac
timeout 10s "$tool" "$flag" 2>&1 || printf 'VERSION %s=unavailable\n' "$tool"
fi
done
# Never invoke rustup proxies: even --version can auto-install a toolchain.
rust_home="${RUSTUP_HOME:-$HOME/.rustup}"
rust_found=false
for toolchain in "$rust_home"/toolchains/1.96.0-*; do
if [ -x "$toolchain/bin/rustc" ]; then
rust_found=true
printf 'RUST_1_96_0=present\n'
if [ -d "$toolchain/lib/rustlib/aarch64-linux-android/lib" ]; then printf 'RUST_ANDROID_TARGET=present\n'; else printf 'RUST_ANDROID_TARGET=missing\n'; fi
fi
done
if [ "$rust_found" = false ]; then printf 'RUST_1_96_0=not-found-in-rustup-home\n'; fi
for name in ANDROID_SDK_ROOT ANDROID_JAVA_HOME NATIVE_LLVM_HOME NATIVE_LIBCLANG_PATH NATIVE_SKIA_SOURCE_DIR ANDROID_GRADLE_DISTRIBUTION ANDROID_BUNDLETOOL; do
key="CONFIG_$name"
if [ -z "${!key:-}" ]; then
printf 'VARIABLE %s=unset\n' "$name"
elif [ -e "${!key}" ]; then
printf 'VARIABLE %s=set,path-exists\n' "$name"
else
printf 'VARIABLE %s=set,path-missing\n' "$name"
fi
done
# Inspect only explicitly configured or inherited tool roots, never home/profile contents.
for name in ANDROID_HOME ANDROID_SDK_ROOT ANDROID_NDK_ROOT JAVA_HOME LLVM_HOME LIBCLANG_PATH SKIA_SOURCE_DIR; do
if [ -n "${!name:-}" ]; then printf 'RUNNER_ENV %s=set\n' "$name"; else printf 'RUNNER_ENV %s=unset\n' "$name"; fi
done
sdk="${CONFIG_ANDROID_SDK_ROOT:-${ANDROID_SDK_ROOT:-${ANDROID_HOME:-}}}"
if [ -n "$sdk" ]; then
for relative in platforms/android-36/android.jar build-tools/36.0.0/aapt2 ndk/28.2.13676358/source.properties; do
if [ -f "$sdk/$relative" ]; then printf 'SDK %s=present\n' "$relative"; else printf 'SDK %s=missing\n' "$relative"; fi
done
else
printf 'SDK=unknown,no-configured-root\n'
fi
skia="${CONFIG_NATIVE_SKIA_SOURCE_DIR:-${SKIA_SOURCE_DIR:-}}"
if [ -n "$skia" ]; then
for relative in BUILD.gn bin/gn third_party/externals; do
if [ -e "$skia/$relative" ]; then printf 'SKIA %s=present\n' "$relative"; else printf 'SKIA %s=missing\n' "$relative"; fi
done
else
printf 'SKIA=unknown,no-configured-root\n'
fi
printf 'INVENTORY_ONLY: no build, installation, signing, publication or device access\n'
android-arm64:
if: ${{ github.event.inputs.mode == 'build' }}
runs-on: teamspeach-android-linux-x64
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
timeout-minutes: 360
env:
CARGO_TERM_COLOR: never
TARGET: aarch64-linux-android
EXPECTED_REVISION: ${{ github.sha }}
CI_RUN_ID: ${{ github.run_id }}
CARGO_TARGET_DIR: ${{ github.workspace }}/android-${{ github.run_id }}/target
GRADLE_USER_HOME: ${{ github.workspace }}/android-${{ github.run_id }}/.gradle-ci
ANDROID_HOME: ${{ vars.ANDROID_SDK_ROOT }}
ANDROID_SDK_ROOT: ${{ vars.ANDROID_SDK_ROOT }}
JAVA_HOME: ${{ vars.ANDROID_JAVA_HOME }}
LLVM_HOME: ${{ vars.NATIVE_LLVM_HOME }}
LIBCLANG_PATH: ${{ vars.NATIVE_LIBCLANG_PATH }}
SKIA_SOURCE_DIR: ${{ vars.NATIVE_SKIA_SOURCE_DIR }}
TEAMSPEACH_GRADLE_DISTRIBUTION: ${{ vars.ANDROID_GRADLE_DISTRIBUTION }}
TEAMSPEACH_BUNDLETOOL: ${{ vars.ANDROID_BUNDLETOOL }}
ANDROID_CI_PROVISION: container
CARGO_TERM_COLOR: never
CARGO_BUILD_JOBS: "1"
CARGO_TARGET_DIR: ${{ github.workspace }}/.android-ci/cargo-target
CMAKE_BUILD_PARALLEL_LEVEL: "1"
steps:
- uses: actions/checkout@v4
with:
path: android-${{ github.run_id }}
clean: true
persist-credentials: false
- name: Require provisioned Linux Android tools (no host installation)
- name: Resource gate before checkout, cache restore or tool installation
id: resources
run: |
set -euo pipefail
test "$(uname -s)" = Linux
test "$(uname -m)" = x86_64
test "$(git rev-parse HEAD)" = "$EXPECTED_REVISION"
: "${ANDROID_SDK_ROOT:?set ANDROID_SDK_ROOT to installed SDK36 with build-tools/36.0.0 and NDK28.2.13676358}"
: "${JAVA_HOME:?set ANDROID_JAVA_HOME to installed JDK17+ (JDK21 is supported)}"
: "${LLVM_HOME:?set NATIVE_LLVM_HOME to installed LLVM}"
: "${LIBCLANG_PATH:?set NATIVE_LIBCLANG_PATH to the matching libclang directory}"
: "${SKIA_SOURCE_DIR:?set NATIVE_SKIA_SOURCE_DIR to a dependency-synchronized Skia checkout}"
: "${TEAMSPEACH_GRADLE_DISTRIBUTION:?set ANDROID_GRADLE_DISTRIBUTION to local gradle-8.14.3-bin.zip}"
: "${TEAMSPEACH_BUNDLETOOL:?set ANDROID_BUNDLETOOL to local bundletool.jar}"
export ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk/28.2.13676358"
export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT"
export PATH="$JAVA_HOME/bin:$LLVM_HOME/bin:$ANDROID_SDK_ROOT/build-tools/36.0.0:$PATH"
for tool in cargo rustc rustup git cmake ninja python3 pkg-config clang clang++ ar llvm-strip llvm-readelf java javac jar keytool jarsigner sh zipalign aapt2 apksigner; do
command -v "$tool"
test -f /.dockerenv
printf 'Architecture: '; uname -m
printf 'CPU count: '; getconf _NPROCESSORS_ONLN
df -Pk . /
while IFS=: read -r key value; do
case "$key" in MemTotal|MemAvailable) printf '%s:%s\n' "$key" "$value" ;; esac
done < /proc/meminfo
if [ '${{ github.event.inputs.mode }}' = inventory ]; then exit 0; fi
for path in . /; do
free=$(df --output=avail -B1 "$path")
free=${free##*$'\n'}
if ! [[ "$free" =~ ^[[:space:]]*[0-9]+[[:space:]]*$ ]] || (( free < 107374182400 )); then
echo "BLOCKED: Android cold source build requires 100 GiB free on workspace and container root; no tools installed. Ask runner administrator for build storage."
exit 1
fi
done
test -f "$ANDROID_SDK_ROOT/platforms/android-36/android.jar"
test -f "$ANDROID_NDK_ROOT/source.properties"
test -x "$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang"
test -f "$SKIA_SOURCE_DIR/BUILD.gn"
test -x "$SKIA_SOURCE_DIR/bin/gn"
test -d "$SKIA_SOURCE_DIR/third_party/externals"
test -f "$TEAMSPEACH_BUNDLETOOL"
test -d "$(rustc --print target-libdir --target "$TARGET")"
# A clean checkout and run-specific Cargo/Gradle/output trees prevent stale
# packages or dependency receipts from another job/revision being selected.
test ! -e target
test ! -e dist/android
test ! -e .gradle-ci
python3 - <<'PY'
import hashlib, os, pathlib, re, subprocess
ndk = pathlib.Path(os.environ['ANDROID_NDK_ROOT'], 'source.properties').read_text()
assert re.search(r'^Pkg\.Revision\s*=\s*28\.2\.13676358\s*$', ndk, re.M), 'NDK must match Gradle ndkVersion'
java = subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT, text=True)
assert int(re.search(r'version "(\d+)', java)[1]) >= 17, 'JDK17+ is required'
assert list(pathlib.Path(os.environ['LIBCLANG_PATH']).glob('libclang.so*')), 'matching LLVM libclang.so is required'
properties = pathlib.Path('platform/android/gradle/wrapper/gradle-wrapper.properties').read_text()
expected = re.search(r'^distributionSha256Sum=(\w+)$', properties, re.M)[1]
with open(os.environ['TEAMSPEACH_GRADLE_DISTRIBUTION'], 'rb') as source:
digest = hashlib.sha256()
for chunk in iter(lambda: source.read(1024 * 1024), b''):
digest.update(chunk)
assert digest.hexdigest() == expected, 'local Gradle zip checksum mismatch'
# No signing configuration is consumed from a dedicated runner's environment.
for name in ('TEAMSPEACH_ANDROID_KEYSTORE', 'TEAMSPEACH_ANDROID_STORE_PASSWORD', 'TEAMSPEACH_ANDROID_KEY_ALIAS', 'TEAMSPEACH_ANDROID_KEY_PASSWORD'):
assert name not in os.environ, 'remove production signing environment from this unsigned runner'
PY
echo "ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" >> "$GITHUB_ENV"
echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> "$GITHUB_ENV"
echo "$JAVA_HOME/bin" >> "$GITHUB_PATH"
echo "$LLVM_HOME/bin" >> "$GITHUB_PATH"
echo "$ANDROID_SDK_ROOT/build-tools/36.0.0" >> "$GITHUB_PATH"
echo "SKIA_GN_COMMAND=$SKIA_SOURCE_DIR/bin/gn" >> "$GITHUB_ENV"
echo "SKIA_NINJA_COMMAND=$(command -v ninja)" >> "$GITHUB_ENV"
available=0
while read -r key value unit; do if [ "$key" = MemAvailable: ]; then available=$value; fi; done < /proc/meminfo
if (( available < 8388608 )); then echo 'BLOCKED: at least 8 GiB available RAM required'; exit 1; fi
- name: Check workspace version and packaging behavior
- name: Bootstrap utilities inside the disposable job container
if: ${{ github.event.inputs.mode != 'inventory' }}
run: |
set -euo pipefail
test -f /.dockerenv
test "$(id -u)" = 0
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends ca-certificates git nodejs python3 zstd
- uses: actions/checkout@v4
if: ${{ github.event.inputs.mode != 'inventory' }}
with:
clean: true
persist-credentials: false
- name: Restore isolated tool and Cargo cache
if: ${{ github.event.inputs.mode != 'inventory' }}
id: cache
uses: actions/cache/restore@v3
with:
path: |
.android-ci/tools/downloads
.android-ci/tools/rustup
.android-ci/tools/cargo
.android-ci/tools/android-sdk
.android-ci/tools/skia-m153-0.101.2
.android-ci/tools/gradle
.android-ci/cargo-target
key: android-arm64-v1-${{ hashFiles('.gitea/android-ci-tools.json', '.gitea/setup-android-ci.sh', 'Cargo.lock', 'rust-toolchain.toml', 'platform/android/gradle/wrapper/gradle-wrapper.properties') }}-${{ github.sha }}
restore-keys: |
android-arm64-v1-${{ hashFiles('.gitea/android-ci-tools.json', '.gitea/setup-android-ci.sh', 'Cargo.lock', 'rust-toolchain.toml', 'platform/android/gradle/wrapper/gradle-wrapper.properties') }}-
- name: Provision pinned Android tools in the job container
if: ${{ github.event.inputs.mode != 'inventory' }}
run: bash .gitea/setup-android-ci.sh
- name: Require exact revision and no production signing
if: ${{ github.event.inputs.mode != 'inventory' }}
run: |
set -euo pipefail
test "$(git rev-parse HEAD)" = "$EXPECTED_REVISION"
test ! -e dist/android
for name in TEAMSPEACH_ANDROID_KEYSTORE TEAMSPEACH_ANDROID_STORE_PASSWORD TEAMSPEACH_ANDROID_KEY_ALIAS TEAMSPEACH_ANDROID_KEY_PASSWORD; do
if [[ -v "$name" ]]; then echo 'Production signing environment forbidden in test CI'; exit 1; fi
done
cargo run --locked -p xtask -- check-version
cargo test --locked -p xtask
- name: Build pinned Android WebRTC from source on Linux
run: cargo run --locked -p xtask -- deps --target "$TARGET" --llvm-dir "$LLVM_HOME"
# Source provenance is regenerated and verified, never trusted from an Actions cache.
- name: Build pinned WebRTC dependencies with one Ninja job
if: ${{ github.event.inputs.mode != 'inventory' }}
run: cargo run --locked -p xtask -- deps --target "$TARGET" --llvm-dir "$LLVM_HOME" --jobs 1
- name: Build and verify harness (full Skia + WebRTC)
- name: Build and verify full-feature test APK
if: ${{ github.event.inputs.mode != 'inventory' }}
run: bash .gitea/build-android-variant.sh harness
- name: Retain installable test-only ARM64 harness and exact receipts
- name: Upload installable Android test APK and provenance
if: ${{ github.event.inputs.mode != 'inventory' }}
uses: actions/upload-artifact@v3
with:
name: android-harness-arm64
name: android-harness-arm64-${{ github.sha }}
path: |
android-${{ github.run_id }}/dist/android/harness/*-harness-test.apk
android-${{ github.run_id }}/dist/android/harness/build-info.json
android-${{ github.run_id }}/dist/android/harness/aarch64-linux-android/*.json
dist/android/harness/*-harness-test.apk
dist/android/harness/build-info.json
dist/android/harness/aarch64-linux-android/*.json
if-no-files-found: error
retention-days: 14
- name: Build and verify unsigned production (full Skia + WebRTC)
run: bash .gitea/build-android-variant.sh production
- name: Retain unsigned production ARM64 APK and store AAB (not installable)
uses: actions/upload-artifact@v3
- name: Save verified build tool and Cargo cache
if: ${{ success() && github.event.inputs.mode != 'inventory' && steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
name: android-production-unsigned-arm64
path: |
android-${{ github.run_id }}/dist/android/production/*-unsigned.apk
android-${{ github.run_id }}/dist/android/production/*-unsigned.aab
android-${{ github.run_id }}/dist/android/production/build-info.json
android-${{ github.run_id }}/dist/android/production/aarch64-linux-android/*.json
if-no-files-found: error
.android-ci/tools/downloads
.android-ci/tools/rustup
.android-ci/tools/cargo
.android-ci/tools/android-sdk
.android-ci/tools/skia-m153-0.101.2
.android-ci/tools/gradle
.android-ci/cargo-target
key: ${{ steps.cache.outputs.cache-primary-key }}
+1
View File
@@ -8,6 +8,7 @@ dist/
# Native Cargo artifacts
target/
core/target/
.android-ci/
# local runtime data, logs and identities
*.log
+11
View File
@@ -2,6 +2,17 @@
## Unreleased
- Android CI now runs on trusted feature/mobile-port pushes using an isolated Ubuntu24.04 container.
Added checksum-pinned SDK/NDK/Rust/Skia/Gradle provisioning, early disk/RAM gates, one-job compilation,
tool/Cargo caches and SHA-labelled test APK artifacts; no automatic releases, signing or device actions.
- Android onboarding is now a full-screen page with a one-line 48dp nickname field, visible theme
choices, errors and Create/Cancel buttons; keyboard insets are handled before profile creation.
Cancel exits the matching Android Activity instead of reopening the same onboarding form.
- Fixed phone-reported identity creation refusal by canonicalizing only the OS-provided filesDir:
Android's app mount namespace can alias /data/user/0 to /data/data. Import/profile descendants
still reject symlinks; Android openat now uses target-correct libc O_NOFOLLOW/CLOEXEC/NONBLOCK flags.
- 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,
+51 -35
View File
@@ -84,37 +84,59 @@ Develop the existing Rust/Slint Android client on Windows; build/package on a se
Linux x64 machine. This can be the prepared Gitea workflow **or another developer's WSL2 Linux**.
WSL, Docker and an Android build SDK are **not required on this developer PC**. Tool installation and
resource limits belong to the chosen build machine; do not copy `mobile-build.local.md` or local
Windows compiler overrides to it. CI provisioning is currently deferred in favor of application work.
Windows compiler overrides to it. Gitea automatically builds the test APK on trusted mobile-branch pushes.
Pinned WebRTC's [official Android source-build documentation](https://github.com/webrtc-sdk/webrtc/blob/9c3a1386f07e4348c28cd85c066821cebc3b56e4/docs/native-code/android/README.md)
states “Android development is only supported on Linux.” This is a build-host requirement,
not a requirement to run Linux locally. A Windows WebRTC Android source build is not a supported
alternative. Keep the full **Skia + WebRTC** feature set and pinned-source/receipt checks.
#### CI administrator prerequisites
#### Automatic Gitea Android APK builds
The manual [`android-ci`](.gitea/workflows/android.yml) workflow is separate from the Linux desktop
workflows above. Before dispatch, an administrator must enable Gitea Actions and artifact support,
register a dedicated **Linux x64** runner labelled `teamspeach-android-linux-x64`, and provision its
toolchains and repository variables. Their presence is not established merely by committing the workflow.
[`android-ci`](.gitea/workflows/android.yml) runs on every push to **`feature/mobile-port`**.
It does not run on main, release tags or pull requests, and never publishes releases or uses a phone.
It selects the existing `ubuntu-latest` runner and an isolated official `ubuntu:24.04` job container.
The owner authorized Android SDK license acceptance and tool installation **inside that container only**.
No Android repository variables or preinstalled Android runner label are required.
| Repository variable | Required existing runner installation/input |
Before checkout, cache restore or package installation, the job requires a conservative **100 GiB free
disk** on workspace and container root, and **8 GiB available RAM**. Setup additionally accounts for
visible ancestor cgroup limits. This is a provisioning floor, not a measured maximum or a memory cap;
runner administrators must provide resource isolation/storage. The earlier runner had only about21GiB
free, so a job can stop at this gate until an administrator expands build storage. No automatic disk
expansion, host installation, privileged Docker socket or deletion of other jobs' files is performed.
`.gitea/setup-android-ci.sh` installs Ubuntu JDK21/LLVM18/libclang/CMake/Ninja prerequisites, then
checksummed pinned downloads listed in `.gitea/android-ci-tools.json`: Rust1.96.0, SDK36,
build-tools36.0.0, NDK28.2.13676358, Gradle8.14.3, synced Skia m153-0.101.2 and bundletool.
The output environment also supplies full NDK, ANDROID_JAR and Skia inputs needed by the real first build.
One Cargo/Ninja job and a six-hour job deadline limit workload; Windows-only optimization overrides
are not used. `xtask deps` regenerates dependency provenance; `build/package/verify-package` use the
existing full Skia+WebRTC path. Production signing environment is rejected.
Tools/downloads/SDK/Skia/Gradle/Cargo caches live under ignored `.android-ci/`; Actions cache v3 keys
include tool pins, Cargo.lock and source SHA, restoring only within the same tool/dependency prefix.
Only successful jobs save these caches. Private signing keys and user profiles are not cached/uploaded.
WebRTC source/object trees and completed receipts are **not** restored from Actions cache: every run
provisions pinned WebRTC and verifies its current receipts. Thus this workflow does not yet promise
incremental WebRTC across jobs; large persistent source caches require separate runner-admin storage.
Gitea cache service reachability/capacity must be provided by the runner administrator.
The artifact is **`android-harness-arm64-<full commit SHA>`**, retained14days, containing the test APK
and revision/hash/build/dependency/package receipts. Unsigned production APK/AAB remain available via
the explicit local Linux helper, not built automatically on every push.
For a separately prepared Linux/WSL host, use these existing inputs instead of CI provisioning:
| Environment variable | Required existing input |
| --- | --- |
| `ANDROID_SDK_ROOT` | Android SDK with API 36, `build-tools/36.0.0` and `ndk/28.2.13676358` |
| `ANDROID_JAVA_HOME` | JDK 17+ including `keytool` (JDK 21 is acceptable) |
| `NATIVE_LLVM_HOME` | LLVM tool directory used by `xtask` |
| `NATIVE_LIBCLANG_PATH` | libclang library directory |
| `NATIVE_SKIA_SOURCE_DIR` | Dependency-synchronized Skia source checkout containing `bin/gn` |
| `ANDROID_GRADLE_DISTRIBUTION` | Local `gradle-8.14.3-bin.zip`; bootstrap verifies its committed SHA-256 |
| `ANDROID_BUNDLETOOL` | Local `bundletool.jar` for AAB inspection |
| `ANDROID_SDK_ROOT` | SDK API36, build-tools36.0.0, NDK28.2.13676358 |
| `JAVA_HOME` | JDK21 |
| `LLVM_HOME`, `LIBCLANG_PATH` | Matching Linux LLVM/libclang |
| `SKIA_SOURCE_DIR` | Dependency-synchronized Skia m153-0.101.2 with bin/gn |
| `TEAMSPEACH_GRADLE_DISTRIBUTION` | Local wrapper-checksummed Gradle8.14.3 ZIP |
| `TEAMSPEACH_BUNDLETOOL` | Local bundletool JAR |
Also provision the pinned Rust toolchain and `aarch64-linux-android` target, Python 3, Git, CMake,
Ninja and required Linux native-build dependencies. The workflow does not install system SDKs or
download a Gradle distribution. It source-builds pinned WebRTC via `xtask deps`, builds the ARM64
application, packages both variants and runs `verify-package`. Its explicit `--gradle-online true`
allows Gradle dependency resolution on CI; the ordinary packaging default remains offline.
Provision runner resources for the full native build; local developer-machine limits are not a CI policy.
No production signing credentials are needed or used by this unsigned-artifact workflow.
#### Handoff to another developer's WSL2 machine
@@ -180,20 +202,14 @@ does not establish phone UI, permissions, audio routes, foreground behavior or t
#### Dispatch, download and install from Windows
1. Deliver the source changes through the normal authorized repository process. In the repository's
**Actions** page select **android-ci** (`android.yml`) and choose the intended branch/ref.
The default **inventory** mode runs a read-only, five-minute resource/tool inventory on the existing
`ubuntu-latest` runner, without checkout, downloads, builds or installation. It reports configured
variable presence, not their values; an inventory pass does not mean Android build readiness.
Select **build** explicitly only after provisioning the dedicated Android runner and variables above.
This workflow has no automatic push/tag trigger and does not publish releases.
2. Only after an actual successful run, download and extract **`android-harness-arm64`** and
**`android-production-unsigned-arm64`**. Each bundle includes root `build-info.json` identifying
the exact revision, package manifests/hashes and `aarch64-linux-android` package-verification,
native-build and dependency JSON receipts. Match the run/ref and APK SHA-256 to that evidence
before installing; a bare APK is not provenance.
For version `0.1.7`, the harness APK is `TeamsPeach-0.1.7-android-arm64-harness-test.apk`; the
production bundle contains `TeamsPeach-0.1.7-android-arm64-unsigned.apk` and `.aab`.
1. Push the authorized source changes to `feature/mobile-port`; **android-ci** starts automatically.
For a manual run select the intended ref and **build** (default), or **inventory** to inspect only
basic resources without checkout/provisioning. Main and release publishing are separate routes.
2. After an actual successful build, download **`android-harness-arm64-<full commit SHA>`**.
The bundle includes root `build-info.json` identifying the exact revision and SHA256 hashes, plus
`aarch64-linux-android` package-verification, native-build and dependency receipts. Match run/ref
and APK SHA256 before installing; a bare APK is not provenance.
For version0.1.7 the harness is `TeamsPeach-0.1.7-android-arm64-harness-test.apk`.
Use the version actually recorded by the selected run, not a stale download.
3. Use a separate **ARM64 Android 8/API 26+ test device**, enable USB debugging and approve this
PC's debugging authorization. From the extracted harness APK directory in PowerShell, with
+18
View File
@@ -466,3 +466,21 @@ build/test/CI и provisioning на потом и разрешил доработ
по-прежнему fail-closed; повторный выбор grants обязателен после restart, retained failed identity
staging не имеет отдельного UI восстановления. Compatibility inventory не повышен из pending.
### Phone-confirmed onboarding defect, 2026-11-11
Pulled `32318e3`; external Linux/WSL build and APK package verification are now reported in the
updated handoff, not equivalent to device acceptance. Owner launched the Android prerelease on
TECNO KJ7/API34 and exposed two concrete defects: required nickname hidden inside a tiny scroll area,
then profile creation rejected a system symlink in the app mount namespace. Metadata-only `/proc/PID/root`
inspection proved `/data/user/0 -> /data/data` inside the app; ordinary shell metadata differed.
`android/private_container.rs` canonicalizes OS filesDir before profile resolution; it does not
canonicalize user-selected/import sources or profile descendants. Android `open_unix_relative`
uses target-correct libc flags; desktop paths stay unchanged. Fullscreen Android onboarding uses
fixed48dp nickname input, visible theme/actions and no scrolling, with first-run lifecycle subscription
for keyboard insets. Generation-scoped Activity finish fixes onboarding Cancel bounce.
Host-side actual Slint rendering and pointer hit checks passed at360×760 and360×460; source helper
test and Rust syntax passed. New APK has not been built/installed, so fixed identity creation and
Cancel on the physical phone are pending. Evidence paths and privacy boundaries are in the handoff.
+54 -1
View File
@@ -1,6 +1,29 @@
# Мобильный порт: передача состояния
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.
Updated **2026-11-11**. Windows baseline remains `05e8d34bcf0e24a44f76e65220293c45b6821798`; active branch `feature/mobile-port` pulled fast-forward to `32318e3e3ff65b521f491fda8a23b30bb9aaf642`. First Android test APK was built on the OTHER developer's WSL machine (`C:/Users/Admin`), not this Windows workstation. Its WSL/provisioning authorization does not override this machine's ignored `mobile-build.local.md`. Published Android prerelease exists; owner has now launched it on a phone and reported onboarding defects. Local fixes below are not yet rebuilt into an APK.
## Automatic Android CI setup (authorized continuation)
- User explicitly authorized job-container Android tool installation, SDK license acceptance,
commit/push of mobile branch including current onboarding fixes and first automatic build.
No host modification, paid resources, disk expansion, production signing, release or device actions.
- `android.yml`: push only `feature/mobile-port`, manual build/inventory; existing `ubuntu-latest`
label with isolated official `ubuntu:24.04` container, six-hour deadline, one Cargo/Ninja job.
Precheckout/preinstall guard requires100GiB free on workspace/root and8GiB RAM; setup also checks
cgroup headroom. This conservative gate may block the previously observed≈21GiB runner.
- `.gitea/setup-android-ci.sh` / tools JSON provision pinned Android tool inputs; packages installed
only in the disposable container, host packages/runner configuration untouched. Existing source
build remains `xtask deps/build/package/verify-package`, full Skia+WebRTC, no prebuilt bypass.
- Actions cache v3 covers isolated downloads/SDK/Skia/Gradle/Rust/Cargo and Cargo target; WebRTC
source/object caches are deliberately NOT restored without separate persistent runner storage.
Each run generates and verifies current dependency provenance. No promise of fast incremental
WebRTC builds; cache capacity/service availability remain runner-admin prerequisites.
- Artifact `android-harness-arm64-<SHA>` keeps APK plus receipts14days. No production/release auto
publishing. Test signing remains isolated per package; never uninstall the phone app automatically
to resolve certificate mismatch. README updated; .android-ci ignored; local caches/policy untouched.
- Local validation: Bash syntax for setup/helper and every workflow run block, YAML parse/trigger
gates, embedded Python syntax and tool pin fields passed. Actual automatic run outcome recorded
after push; workflow presence alone is not APK success.
## First Android APK build
@@ -10,6 +33,36 @@ Updated **2026-11-11**. Windows baseline remains `05e8d34bcf0e24a44f76e65220293c
- 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.
## Phone onboarding diagnosis and local fix
- Published release checked: `android-test-0.1.7-20261111`, source `32318e3`, APK SHA256
`ab0c4119b4a8abfebbb31ed185459da8b1ef6c57c86324ad7862014aa1085d1b` (release metadata).
USB-selected TECNO KJ7, Android14/API34, installed version0.1.7/code107; installed APK hash was not read.
- User clarified Create was not dead: nickname was hidden inside a tiny scrolling dialog. After typing
ZXC the phone displayed **Symbolic links are not allowed in profile imports**. Screenshot captured
immediately: `target/desktop-acceptance/android-onboarding-error.png`.
- Metadata-only examination of the app process namespace proved `/data/user/0 -> /data/data`, while
ordinary shell/run-as namespace showed a directory. No profile files, identities or credentials read.
Android Binding now canonicalizes only OS filesDir before appending profile-v1; imported paths and
profile descendants retain strict no-follow checks. Also corrected Android-specific O_NOFOLLOW flag
using libc (arm64 differs from desktop Linux); desktop code remains unchanged.
- Android onboarding is full-screen, no ScrollView: visible nickname, theme buttons, error and actions.
Nickname height fixed at48dp as explicitly requested. Keyboard hides secondary explanatory/import
content, not nickname/theme/Create/Cancel. Lifecycle subscription starts before profile construction,
so insets/accessibility now reach first-run UI. Scoped Cancel exits the runtime and finishes only
the matching Android Activity; cancellation of import confirmation still returns to onboarding.
- **Verification:** actual cached Slint software renderer at360×760 and360×460, reviewed screenshots
`android-onboarding-normal-preview.png` and `android-onboarding-keyboard-preview.png` in the same
evidence directory; actual pointer clicks reached Create and Cancel in both sizes without scrolling.
This is host-side isolated rendering, not a newly installed phone APK. One real private-container
validation test passed on Windows; Rust syntax parse passed for8 modified files. Unix symlink tests
added but not run here; full Android/Rust/JNI build and new phone behavior remain unverified.
- Existing app was opened only for approved diagnosis/screenshots. No identity was created by the
assistant, no data cleared, APK reinstalled, microphone used or server contacted. New APK needs the
external Linux build host before verifying these fixes on this connected phone. No commit/push/release
performed in this fix stage; local resource policy and dependency caches preserved.
## Текущий этап: реализация Android, CI отложен
- По последнему указанию пользователя работа переключена с runner/provisioning на **сам Android-порт**.
+2
View File
@@ -17,6 +17,8 @@ impl Bootstrap {
state.snapshot.root=Some(self.root.clone());state.snapshot.loading=false;
if let Some(profile)=profile{if !profile.identities.list()?.identities.is_empty(){state.snapshot.bootstrap=BootstrapState::Ready;state.snapshot.profile_form=None;return Ok(())}}
let catalog=Catalog::default();let mut form=crate::ui::shell::forms::form("onboarding",Operation::CreateProfile,Target::application(),&catalog).ok_or_else(||error("profile_form","Username form is unavailable"))?;
#[cfg(target_os="android")]
form.actions.retain(|action|action.operation!=Operation::ChooseLegacyProfile);
state.snapshot.bootstrap=if self.interrupted{BootstrapState::RecoverImport}else if !self.candidates.is_empty(){BootstrapState::ChooseProfile}else{BootstrapState::Username};
if self.interrupted{form.description="An incomplete import was found. Retry the import, or explicitly discard its staging directory before creating a new identity. The source profile is unchanged.".into();form.actions.push(Action{form:None,..Action::new("discard-import",Operation::ConfirmOverwrite,Target::application(),&catalog)});}
for(index,path)in self.candidates.iter().enumerate(){let target=Target{entity:Entity::LegacyProfile(index.to_string()),name:path.to_string_lossy().into_owned(),..Target::application()};let mut action=Action::new(format!("legacy-{index}"),Operation::ImportLegacyProfile,target,&catalog);action.form=None;form.actions.push(action);}
+23 -2
View File
@@ -32,7 +32,13 @@ pub fn start(config:AppConfig)->std::result::Result<Arc<AppRuntime>,AppError>{
let(snapshots_tx,snapshots)=watch::channel(Arc::new(model::Snapshot::default()));let(effects_tx,effects)=mpsc::channel(128);let(finished_tx,finished)=watch::channel(None);
let runtime=Arc::new(AppRuntime{config:config.clone(),commands,cancel,snapshots,effects:Mutex::new(effects),services:Mutex::new(Weak::new()),wake:Mutex::new(None),pending_wake:AtomicBool::new(false),active_ui:AtomicU64::new(0),finished,worker:Mutex::new(None),#[cfg(not(any(target_os="android",target_os="ios")))]desktop:Mutex::new(None)});
let weak=Arc::downgrade(&runtime);
#[cfg(target_os="android")]
let bootstrap_platform=if config.allow_os_actions{
let sink=weak.clone();Some(crate::platform::lifecycle::subscribe(Arc::new(move|event|{if let Some(runtime)=sink.upgrade(){runtime.platform_event(event);}}))?)
}else{None};
let worker=std::thread::Builder::new().name("teamspeach-app".into()).spawn(move||{
#[cfg(target_os="android")]
let _platform=bootstrap_platform;
let observed=snapshots_tx.clone();let wake=weak.clone();
let result=executor.block_on(run(config,weak,incoming,cancelled,snapshots_tx,effects_tx));
if let Err(error)=&result{let mut snapshot=(**observed.borrow()).clone();snapshot.error=error.message.clone();snapshot.loading=false;snapshot.ready=true;snapshot.bootstrap=BootstrapState::Failed;observed.send_replace(Arc::new(snapshot));if let Some(runtime)=wake.upgrade(){runtime.notify_ui();}}
@@ -79,7 +85,10 @@ async fn construct(config:&AppConfig,profile:ProfileServices,runtime:Weak<AppRun
revision:AtomicU64::new(0),events,cancelled,dialogs:Semaphore::new(8),prompt_counter:AtomicU64::new(1)
});
if let Some(runtime)=runtime.upgrade(){*runtime.services.lock().expect("runtime services")=Arc::downgrade(&ctx);}
let weak=runtime.clone();let subscription=if config.allow_os_actions{Some(crate::platform::lifecycle::subscribe(Arc::new(move|event|{if let Some(runtime)=weak.upgrade(){runtime.platform_event(event);}}))?)}else{None};
#[cfg(not(target_os="android"))]
let subscription={let weak=runtime.clone();if config.allow_os_actions{Some(crate::platform::lifecycle::subscribe(Arc::new(move|event|{if let Some(runtime)=weak.upgrade(){runtime.platform_event(event);}}))?)}else{None}};
#[cfg(target_os="android")]
let subscription=None;
ctx.notifications.lock().map_err(|_|failed("Notifications unavailable"))?.set_presentation(crate::services::notifications::Presentation{focused:true,prohibit_os_effects:!config.allow_os_actions});
ctx.phishing.start();ctx.connected.connections.create().await.map_err(context::connection_error)?;
// Restoring configuration doesn't grant or open hardware, even for autostart/resume.
@@ -100,7 +109,11 @@ async fn run(config:AppConfig,runtime:Weak<AppRuntime>,mut commands:mpsc::Receiv
tokio::select! {
_=cancelled.changed()=>{if *cancelled.borrow(){break}},
command=commands.recv()=>{let Some(command)=command else{break};if jobs.len()>=64&&matches!(&command,RuntimeCommand::Settings(_)|RuntimeCommand::Chat(_)|RuntimeCommand::Shell(ShellAction::Invoke{..})){state.snapshot.error="Too many pending application actions; complete or cancel the current dialog first".into();dirty=true;continue}match command {
RuntimeCommand::Shell(ShellAction::Cancel{editor_id,..})=>{if prompts.front().is_some_and(|p|p.form.id==editor_id){if let Some(prompt)=prompts.pop_front(){let _=prompt.answer.send(Err(ServiceError::new("cancelled","Dialog cancelled")));}state.snapshot.dialog=prompts.front().map(|p|p.form.clone());}else if owner.is_none(){state.snapshot.dialog=None;}dirty=true;},
RuntimeCommand::Shell(ShellAction::Cancel{editor_id,target})=>{
#[cfg(target_os="android")]
if owner.is_none()&&state.snapshot.profile_form.as_ref().is_some_and(|form|form.id==editor_id&&form.target==target)&&state.snapshot.dialog.is_none(){break}
if prompts.front().is_some_and(|p|p.form.id==editor_id){if let Some(prompt)=prompts.pop_front(){let _=prompt.answer.send(Err(ServiceError::new("cancelled","Dialog cancelled")));}state.snapshot.dialog=prompts.front().map(|p|p.form.clone());}else if owner.is_none(){state.snapshot.dialog=None;}dirty=true;
},
RuntimeCommand::Shell(ShellAction::Submit{editor_id,target,operation,values,confirmation})=>{
if prompts.front().is_some_and(|p|p.form.id==editor_id){let prompt=prompts.pop_front().unwrap();let answer=if prompt.form.target!=target||prompt.form.confirmation.as_ref().is_some_and(|c|c!=&confirmation){Err(context::changed())}else{Ok(values)};let result=answer.as_ref().map(|_|()).map_err(Clone::clone);let _=prompt.answer.send(answer);send_effect(&runtime,&effects,UiEffect::FormComplete{id:editor_id,target,result}).await?;state.snapshot.dialog=prompts.front().map(|p|p.form.clone());dirty=true;continue}
if let Some(owner)=&owner{let ctx=owner.ctx.clone();let sender=events.clone();jobs.spawn(async move{let result=controller::dispatch(ctx,target.clone(),operation,values).await;let ack=result.as_ref().map(|_|()).map_err(Clone::clone);let _=sender.send(ServiceEvent::Effect(UiEffect::FormComplete{id:editor_id,target,result:ack})).await;let _=sender.send(ServiceEvent::Workflow(result)).await;});}
@@ -132,6 +145,14 @@ async fn run(config:AppConfig,runtime:Weak<AppRuntime>,mut commands:mpsc::Receiv
RuntimeCommand::Detached(_)=>{if let Some(owner)=&owner{if let Ok(mut notifications)=owner.ctx.notifications.lock(){let _=notifications.view_chat(None);}if let Err(error)=settings_actions::focus_lost(owner.ctx.clone()).await{state.snapshot.error=error.message;}dirty=true;}},
RuntimeCommand::WhisperStop(stop)=>{if let Some(owner)=&owner{let ctx=owner.ctx.clone();let sender=events.clone();jobs.spawn(async move{let result=ctx.request(&stop.key,stop.command).await.map(|_|events::WorkflowResult::default());let _=sender.send(ServiceEvent::Workflow(result)).await;});}},
RuntimeCommand::Platform(crate::platform::lifecycle::PlatformEvent::Quit)=>break,
#[cfg(target_os="android")]
RuntimeCommand::Platform(crate::platform::lifecycle::PlatformEvent::Insets{ui_generation,value}) if owner.is_none()=>{
if runtime.upgrade().is_some_and(|r|r.is_ui_current(ui_generation)){state.snapshot.insets=value;dirty=true;}
},
#[cfg(target_os="android")]
RuntimeCommand::Platform(crate::platform::lifecycle::PlatformEvent::Accessibility{ui_generation,text_scale,reduce_motion,high_contrast,..}) if owner.is_none()=>{
if runtime.upgrade().is_some_and(|r|r.is_ui_current(ui_generation))&&text_scale.is_finite(){state.snapshot.text_scale=text_scale.clamp(0.5,4.);state.snapshot.reduced_motion=reduce_motion;state.snapshot.high_contrast=high_contrast;dirty=true;}
},
RuntimeCommand::Platform(event)=>{if let Some(owner)=&owner{match platform(&owner.ctx,&runtime,&mut state,event).await{Ok(true)=>break,Ok(false)=>{},Err(error)=>state.snapshot.error=error.message}dirty=true;}},
}},
event=control_events.recv()=>{if let(Some(owner),Some(event))=(&owner,event){if let Err(error)=control(&owner.ctx,event).await{state.snapshot.error=error.message;}dirty=true;}},
+4 -1
View File
@@ -7,6 +7,7 @@ use super::{lifecycle::{self, Insets, NotificationAction, Permission, PlatformEv
mod documents;
mod smoke;
mod call_audio;
mod private_container;
pub use smoke::{AndroidSmokeRequest, smoke_request};
pub mod accessibility;
pub use accessibility::{attach_accessibility, AccessibilityLease};
@@ -38,6 +39,7 @@ fn with_env<T>(operation: impl FnOnce(&mut JNIEnv<'_>, &JClass<'_>) -> Result<T>
}
fn next_id() -> Result<u64> { NEXT.fetch_update(Ordering::AcqRel, Ordering::Acquire, |id| (id < i64::MAX as u64).then_some(id + 1)).map_err(|_| error("generation_exhausted", "Android action identity exhausted")) }
fn call_void(name: &str, signature: &str, args: &[JValue<'_, '_>]) -> Result<()> { with_env(|env, class| { java(env.call_static_method(class, name, signature, args))?; Ok(()) }) }
pub(crate) fn finish_activity(generation: u64) -> Result<()> { call_void("finishActivity", "(J)V", &[JValue::Long(generation as i64)]) }
fn complete(id: u64, response: Result<Response>) { if let Some(sender) = REQUESTS.lock().expect("Android requests").remove(&id) { let _ = sender.send(response); } }
struct Request { id: u64, receiver: Option<oneshot::Receiver<Result<Response>>> }
impl Request {
@@ -303,10 +305,11 @@ pub extern "system" fn Java_dev_teamspeach_mobile_PlatformBridge_nativeInstall(m
super::mobile_capture::install(&mut env, capture_application).map_err(|e|error("android_capture",e.message))?;
}
let files: String=java(env.get_string(&files))?.into();
let files = private_container::normalize_files_dir(std::path::Path::new(&files))?;
// Old immutable PendingIntents must not alias a new process's first call.
let mut nonce=[0u8;8];getrandom::fill(&mut nonce).map_err(|_|error("android_nonce","Unable to create process action identities"))?;
NEXT.store((u64::from_le_bytes(nonce)&0x3fff_ffff_ffff_ffff)|1,Ordering::Release);
let binding=Binding { vm, application:java(env.new_global_ref(application))?, class:java(env.new_global_ref(class))?, files:PathBuf::from(files) };
let binding=Binding { vm, application:java(env.new_global_ref(application))?, class:java(env.new_global_ref(class))?, files };
BINDING.set(binding).map_err(|_|error("android_context","Concurrent Application initialization"))?;
let (vm,application)=application_context()?;
if !unsafe { cpal::android_context::set_process_android_context(vm,application) } { return Err(error("android_context","CPAL process context conflict")); }
@@ -0,0 +1,51 @@
//! Resolve aliases only in Android's OS-provided private container, before adding profile paths.
use std::{fs, io, path::{Path, PathBuf}};
/// This must only receive Application.getFilesDir(), never a selected/import path or a profile root.
/// Android may expose the private container through a system-managed symlink. Resolve that trusted
/// prefix once; profile-v1, staging directories and every imported descendant retain no-follow checks.
pub(super) fn normalize_files_dir(files: &Path) -> io::Result<PathBuf> {
if !files.is_absolute() {
return Err(io::Error::new(io::ErrorKind::InvalidInput, "Android filesDir must be absolute"));
}
let files = fs::canonicalize(files)?;
if !fs::metadata(&files)?.is_dir() {
return Err(io::Error::new(io::ErrorKind::NotADirectory, "Android filesDir must be a directory"));
}
Ok(files)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn rejects_relative_missing_and_non_directory_containers() {
assert_eq!(normalize_files_dir(Path::new("relative")).unwrap_err().kind(), io::ErrorKind::InvalidInput);
let fixture = tempfile::tempdir().unwrap();
assert_eq!(normalize_files_dir(&fixture.path().join("missing")).unwrap_err().kind(), io::ErrorKind::NotFound);
let file = fixture.path().join("file");
fs::write(&file, b"").unwrap();
assert_eq!(normalize_files_dir(&file).unwrap_err().kind(), io::ErrorKind::NotADirectory);
}
#[cfg(unix)]
#[test]
fn resolves_os_container_alias_without_resolving_profile_descendants() {
use std::os::unix::fs::symlink;
let fixture = tempfile::tempdir().unwrap();
let real = fixture.path().join("real");
fs::create_dir_all(real.join("files")).unwrap();
let alias = fixture.path().join("os-alias");
symlink(&real, &alias).unwrap();
let outside = fixture.path().join("outside");
fs::create_dir(&outside).unwrap();
symlink(&outside, real.join("files/profile-v1")).unwrap();
let files = normalize_files_dir(&alias.join("files")).unwrap();
assert_eq!(crate::services::profile_import::initialize_native_root(&files.join("profile-v1")).unwrap_err().code, "profile_symlink");
assert_eq!(files, fs::canonicalize(real.join("files")).unwrap());
assert!(fs::symlink_metadata(files.join("profile-v1")).unwrap().file_type().is_symlink());
assert_eq!(fs::read_dir(outside).unwrap().count(), 0);
}
}
+6 -3
View File
@@ -435,12 +435,15 @@ fn open_unix_absolute(path: &Path) -> Result<File> {
fn open_unix_relative(root: &File, path: &Path) -> Result<File> {
use std::{ffi::CString, os::{fd::{AsRawFd, FromRawFd}, unix::ffi::OsStrExt}};
unsafe extern "C" { fn openat(fd: i32, path: *const std::ffi::c_char, flags: i32, ...) -> i32; }
// Android arm64 assigns O_NOFOLLOW a different bit than desktop Linux.
#[cfg(target_os = "android")]
use libc::{O_NOFOLLOW as NOFOLLOW, O_CLOEXEC as CLOEXEC, O_NONBLOCK as NONBLOCK};
#[cfg(any(target_os = "macos", target_os = "ios"))] const NOFOLLOW: i32 = 0x100;
#[cfg(not(any(target_os = "macos", target_os = "ios")))] const NOFOLLOW: i32 = 0x20000;
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] const NOFOLLOW: i32 = 0x20000;
#[cfg(any(target_os = "macos", target_os = "ios"))] const CLOEXEC: i32 = 0x1000000;
#[cfg(not(any(target_os = "macos", target_os = "ios")))] const CLOEXEC: i32 = 0x80000;
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] const CLOEXEC: i32 = 0x80000;
#[cfg(any(target_os = "macos", target_os = "ios"))] const NONBLOCK: i32 = 4;
#[cfg(not(any(target_os = "macos", target_os = "ios")))] const NONBLOCK: i32 = 0x800;
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] const NONBLOCK: i32 = 0x800;
let mut file = root.try_clone()?;
for component in path.components() {
let Component::Normal(name) = component else { return Err(err("invalid_profile_path", "Invalid path component")) };
@@ -189,6 +189,21 @@ fn symbolic_links_are_not_followed_even_inside_allowed_trees() {
assert!(import_profile(&source, &fixture.destination()).is_err()); assert!(!fixture.destination().exists());
}
#[cfg(unix)]
#[test]
fn descriptor_relative_opens_reject_directory_and_file_links() {
let fixture = Fixture::new();
let directory = fixture.0.join("real"); fs::create_dir(&directory).unwrap();
fs::write(directory.join("file"), b"sentinel").unwrap();
std::os::unix::fs::symlink(&directory, fixture.0.join("directory-link")).unwrap();
std::os::unix::fs::symlink(directory.join("file"), fixture.0.join("file-link")).unwrap();
let root = File::open(&fixture.0).unwrap();
assert!(open_unix_relative(&root, Path::new("real/file")).unwrap().metadata().unwrap().is_file());
// Exercise openat directly: ConfinedSource's earlier lstat must not mask wrong flag bits.
assert!(open_unix_relative(&root, Path::new("directory-link/file")).is_err());
assert!(open_unix_relative(&root, Path::new("file-link")).is_err());
}
#[test]
fn legacy_discovery_returns_all_real_candidates_without_opening_keys() {
let fixture = Fixture::new();
+5 -1
View File
@@ -108,7 +108,11 @@ fn update(ui:&AppWindow,runtime:&AppRuntime,bindings:&mut Bindings){
#[cfg(any(target_os="android",target_os="ios"))]{let size=ui.window().size();let scale=f64::from(ui.window().scale_factor());let _=runtime.commands.try_send(crate::app::runtime::RuntimeCommand::Pip{target,rect:[0.,0.,f64::from(size.width)/scale,f64::from(size.height)/scale]});}
},
UiEffect::StreamClose{target}=>{let _=bindings.shell.stream_effect(ui,&target,false,true);},
UiEffect::Quit=>{let _=ui.hide();let _=slint::quit_event_loop();},
UiEffect::Quit=>{
#[cfg(target_os="android")]
if let Err(error)=crate::platform::android::finish_activity(runtime.ui_generation()){ui.global::<ShellBridge>().set_error(error.message.into());}
let _=ui.hide();let _=slint::quit_event_loop();
},
UiEffect::Theme(theme)=>{let mut current=(*snapshot).clone();current.theme=Some(theme);apply_theme(ui,&current);},
#[cfg(target_os="android")]
UiEffect::Platform(crate::platform::lifecycle::PlatformEvent::Focus{focused:false,..}|crate::platform::lifecycle::PlatformEvent::Visibility{visible:false,..}|crate::platform::lifecycle::PlatformEvent::AndroidCallAudio{..})=>ui.invoke_focus_lost(),
+1
View File
@@ -61,6 +61,7 @@ fn project_editor(ui:&AppWindow,state:&mut State) {
let Some(editor)=&state.editor else {bridge.set_visible(false);return};
let c=state.presentation.catalog;
bridge.set_visible(true);bridge.set_title(editor.form.title.clone().into());bridge.set_description(editor.form.description.clone().into());
bridge.set_onboarding(editor.form.operation==Operation::CreateProfile);
bridge.set_error(editor.form.error.clone().into());bridge.set_busy(editor.form.busy);bridge.set_destructive(editor.form.destructive);
bridge.set_submit_label(editor.form.submit_label.clone().into());bridge.set_cancel_label(c.text("native.action.cancel").into());bridge.set_advanced_label(c.text("native.form.advanced").into());bridge.set_loading_label(c.text("native.status.loading").into());
bridge.set_confirmation_label(editor.form.confirmation.as_ref().map(|target|c.format("native.form.confirm",&[("target",target)])).unwrap_or_default().into());
+46 -1
View File
@@ -27,11 +27,56 @@ export global DialogBridge {
callback cancel();
}
// Android first-run is a page, not a small modal with its required fields hidden in a scroller.
component AndroidOnboarding inherits Rectangle {
background: Theme.shaded;
accessible-role: form;
accessible-label: DialogBridge.title;
property <bool> typing: Theme.ime-inset > 0px;
VerticalLayout {
padding: root.typing ? 12px : 24px;
spacing: root.typing ? 6px : 16px;
Text { text: DialogBridge.title; color: Theme.fg; font-size: Theme.font-size * (root.typing ? 1.25 : 1.8); font-weight: 700; wrap: word-wrap; }
if !root.typing: Text { text: DialogBridge.description; color: Theme.fg; font-size: Theme.font-size; wrap: word-wrap; }
for field in DialogBridge.fields: VerticalLayout {
spacing: 4px;
vertical-stretch: 0;
Text { text: field.label; color: Theme.fg; font-size: Theme.font-size; }
if field.kind == 0: TextField {
height: Theme.touch-target; vertical-stretch: 0;
text: field.value; placeholder: field.label; enabled: field.enabled && !DialogBridge.busy;
edited(value) => { DialogBridge.edit(field.id,value); }
accepted => { DialogBridge.submit(); }
}
if field.kind == 6: HorizontalLayout {
spacing: 8px; height: Theme.touch-target; vertical-stretch: 0;
for label[index] in field.choices: ActionButton {
text: label; primary: field.choice-index == index; enabled: field.enabled && !DialogBridge.busy;
horizontal-stretch: 1; clicked => { DialogBridge.choose(field.id,index); }
}
}
if field.error != "": Text { text: field.error; color: Theme.error; wrap: word-wrap; accessible-live-region: assertive; }
}
if DialogBridge.error != "": Text { text: DialogBridge.error; color: Theme.error; wrap: word-wrap; accessible-live-region: assertive; }
if DialogBridge.busy: Text { text: DialogBridge.loading-label; color: Theme.fg; }
Rectangle { vertical-stretch: 1; min-height: 0px; }
if !root.typing: VerticalLayout {
spacing: 4px;
vertical-stretch: 0;
for action in DialogBridge.actions: ActionButton { text: action.label; enabled: action.enabled && !DialogBridge.busy; destructive: action.destructive; clicked => { ShellBridge.invoke(action.id); } }
}
ActionButton { height: Theme.touch-target; vertical-stretch: 0; text: DialogBridge.submit-label; primary: true; enabled: !DialogBridge.busy; clicked => { DialogBridge.submit(); } }
ActionButton { height: Theme.touch-target; vertical-stretch: 0; text: DialogBridge.cancel-label; enabled: !DialogBridge.busy; clicked => { DialogBridge.cancel(); } }
}
}
export component ShellDialog inherits Rectangle {
background: Theme.contrast.with-alpha(0.75);
property <bool> fullscreen-onboarding: Theme.android && DialogBridge.onboarding;
// An overlay blocks background pointer input without turning Cancel into a submit.
TouchArea { }
dialog := Rectangle {
if root.fullscreen-onboarding: AndroidOnboarding { width: root.width; height: root.height; }
if !root.fullscreen-onboarding: dialog := Rectangle {
width: min(parent.width - 24px, 640px);
height: min(parent.height - 24px, layout.preferred-height);
x: (parent.width - self.width)/2;
@@ -141,6 +141,9 @@ public final class PlatformBridge {
}
public static boolean accessibility(long generation, String json) { return post(() -> { TeamsPeachActivity value = activity.get(); if (value != null && value.generation == generation && value.accessibility != null) value.accessibility.update(json); }); }
public static boolean attached(Activity owner, long generation) { return post(() -> { TeamsPeachActivity value = activity.get(); if (value == owner && !value.isDestroyed()) { value.generation = generation; value.attachSemantics(); value.reportConfiguration(); nativeEvent(generation, 0, value.resumed || value.isInPictureInPictureMode()); } }); }
public static void finishActivity(long generation) {
MAIN.post(() -> { TeamsPeachActivity value=activity.get(); if(value!=null&&value.generation==generation&&!value.isDestroyed()&&!value.isFinishing())value.finish(); });
}
static native boolean nativeInstall(Application application, String files);
static native void nativeEvent(long generation, int event, boolean value);
static native void nativePermission(long request, int permission, boolean granted);