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

Filter by extension

Filter by extension


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

# Builds the Android test app (an APK for arm64 phones, handhelds and TVs). It runs when the
# Android parts change, or by hand. The APK is kept for one day only: it's a test build.

on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/android.yml
- src-tauri/gen/android/**
- src-tauri/src/mobile.rs
- src-tauri/src/*_mobile.rs

permissions:
contents: read

concurrency:
group: android-${{ github.ref }}
cancel-in-progress: true

jobs:
apk:
name: Android test APK
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v6
with:
node-version: 24
cache: npm

- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17

- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android

- uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri -> target
key: android
save-if: false

- name: Install
run: npm ci

# The runner has the Android SDK and NDK already (ANDROID_HOME, ANDROID_NDK_LATEST_HOME).
- name: Build the APK
run: |
export NDK_HOME="${ANDROID_NDK_LATEST_HOME:-$ANDROID_NDK_HOME}"
echo "NDK: $NDK_HOME"
npx tauri android build --debug --apk --target aarch64

- uses: actions/upload-artifact@v5
with:
name: recomplauncher-android-test
path: src-tauri/gen/android/app/build/outputs/apk/**/*.apk
retention-days: 1
if-no-files-found: error
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
node_modules/
src-tauri/target/
src-tauri/gen/
# Made by each build (schemas); the Android project in gen/android is kept.
src-tauri/gen/*
!src-tauri/gen/android/
*.log
.DS_Store
dist/arch/
Expand Down
23 changes: 23 additions & 0 deletions docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,29 @@ Set `RL_API` to point the launcher somewhere other than recomplauncher.com, for
Start the launcher with `RECOMPLAUNCHER_TEST_CONTROL` set to a token of your own, and an MCP client
(an AI agent, or a script) can drive it: see [TEST-CONTROL.md](TEST-CONTROL.md). It's off otherwise.

## Android (test builds)

The Android app is in early testing and isn't released. It needs Android 8.0 or newer (the RAR unpacker and installing other apps both need it). It's the same Rust core and window as
the PC launcher, built with Tauri's Android support; the Android Studio project is
`src-tauri/gen/android`.

The Android build leaves out what only a PC has: the tray icon, global shortcuts, a second copy
handing over to the first, Discord status and the picture clipboard. Controllers are read by the
window (`navigator.getGamepads`) instead of SDL. Window calls a phone doesn't have (minimise,
full screen, frameless windows) do nothing there; `src-tauri/src/mobile.rs` keeps the shared code
the same for both. `pads_mobile.rs` and `tray_mobile.rs` stand in for `pads.rs` and `tray.rs`.

To build it yourself you need Android Studio (its SDK and NDK), Java 17 and the Rust target:

```
rustup target add aarch64-linux-android
export ANDROID_HOME=<your Android SDK> NDK_HOME=$ANDROID_HOME/ndk/<version>
npx tauri android build --debug --apk --target aarch64
```

The Android workflow (`.github/workflows/android.yml`) builds the same APK on GitHub when the
Android parts change, or when run by hand, and keeps it for a day.

## Pull request builds

The `PR checks` GitHub Actions workflow runs the Rust and UI tests and builds installers on
Expand Down
12 changes: 8 additions & 4 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,23 @@ backhand = { version = "0.21", default-features = false, features = ["gzip", "xz
dwarfs = { version = "0.2", default-features = false, features = ["zstd"] }
dirs = "5"
thiserror = "1"
tauri-plugin-single-instance = "2"
tauri-plugin-notification = "2"
tauri-plugin-global-shortcut = "2"
fs2 = "0.4"
crc32fast = "1"
chrono = { version = "0.4", default-features = false, features = ["clock"] }
arboard = { version = "3", default-features = false, features = ["image-data"] }
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
discord-rich-presence = "1"
regex-lite = "0.1"
qrcode = { version = "0.14", default-features = false, features = ["svg"] }
plist = "1"
tauri-plugin-deep-link = "2"

# Desktop only: Android and iOS have no tray, global shortcuts, second copies, Discord client or
# desktop clipboard, and read controllers through the window (navigator.getGamepads).
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-single-instance = "2"
tauri-plugin-global-shortcut = "2"
discord-rich-presence = "1"
arboard = { version = "3", default-features = false, features = ["image-data"] }
# Controllers. SDL 3 is built from source and linked in, with only its joystick and HIDAPI parts:
# no SDL library to ship, and nothing needed on the player's system.
sdl3-sys = { version = "=0.7.2", default-features = false, features = ["build-from-source-static", "no-default-subsystems", "sdl-joystick", "sdl-hidapi", "sdl-unix-console-build"] }
Expand Down
14 changes: 14 additions & 0 deletions src-tauri/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ fn main() {
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
clang_runtime();
}
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("android") {
empty_pthread();
}
tauri_build::build()
}

Expand All @@ -59,6 +62,17 @@ fn clang_runtime() {
}
}

/// unrar_sys always links libpthread, but Android has its threads in libc and no libpthread at
/// all, so the link fails. An empty libpthread.a lets it through; the real calls come from libc.
fn empty_pthread() {
let Ok(out) = std::env::var("OUT_DIR") else { return };
let dir = std::path::Path::new(&out).join("android-pthread");
let _ = std::fs::create_dir_all(&dir);
if std::fs::write(dir.join("libpthread.a"), b"!<arch>\n").is_ok() {
println!("cargo:rustc-link-search=native={}", dir.display());
}
}

/// unrar_sys's C++ sources, in Cargo's download folder.
fn unrar_src() -> Option<std::path::PathBuf> {
let home = std::env::var_os("CARGO_HOME").map(std::path::PathBuf::from).or_else(|| std::env::var_os("HOME").map(|h| std::path::PathBuf::from(h).join(".cargo")))?;
Expand Down
12 changes: 12 additions & 0 deletions src-tauri/gen/android/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
20 changes: 20 additions & 0 deletions src-tauri/gen/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
build
/captures
.externalNativeBuild
.cxx
local.properties
key.properties
keystore.properties

/.tauri
/tauri.settings.gradle
6 changes: 6 additions & 0 deletions src-tauri/gen/android/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/src/main/**/generated
/src/main/jniLibs/**/*.so
/src/main/assets/tauri.conf.json
/tauri.build.gradle.kts
/proguard-tauri.pro
/tauri.properties
83 changes: 83 additions & 0 deletions src-tauri/gen/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import java.util.Properties
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("rust")
}

val tauriProperties = Properties().apply {
val propFile = file("tauri.properties")
if (propFile.exists()) {
propFile.inputStream().use { load(it) }
}
}

android {
compileSdk = 37
namespace = "com.recomplauncher.app"
defaultConfig {
manifestPlaceholders["usesCleartextTraffic"] = "false"
applicationId = "com.recomplauncher.app"
minSdk = 26
targetSdk = 37
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
}
buildTypes {
getByName("debug") {
manifestPlaceholders["usesCleartextTraffic"] = "true"
isDebuggable = true
isJniDebuggable = true
isMinifyEnabled = false
packaging {
jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
jniLibs.keepDebugSymbols.add("*/x86/*.so")
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
}
}
getByName("release") {
optimization {
enable = true
}
proguardFiles(
*fileTree(".") {
include("**/*.pro")
exclude("build/**")
}.files.toTypedArray()
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildFeatures {
buildConfig = true
}
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
}
}

rust {
rootDirRel = "../../../"
}

dependencies {
implementation("androidx.webkit:webkit:1.14.0")
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("androidx.activity:activity-ktx:1.10.1")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.lifecycle:lifecycle-process:2.10.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.4")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
}

apply(from = file("tauri.build.gradle.kts"))
21 changes: 21 additions & 0 deletions src-tauri/gen/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
37 changes: 37 additions & 0 deletions src-tauri/gen/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />

<!-- AndroidTV support -->
<uses-feature android:name="android.software.leanback" android:required="false" />

<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.recomplauncher"
android:usesCleartextTraffic="${usesCleartextTraffic}">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:launchMode="singleTask"
android:label="@string/main_activity_title"
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- AndroidTV support -->
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.recomplauncher.app

import android.os.Bundle
import androidx.activity.enableEdgeToEdge

class MainActivity : TauriActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
Loading
Loading