mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
feat: ship proot, DirectAudio, Xbox, Comet and hand tracking as CI-built add-on packs (#1198)
* perf: download hand tracking models and native libs on first use * feat: build and publish add-on packs in CI, add Xbox and Comet packs * feat: ship proot and DirectAudio drivers as CI-built packs * test: hand tracking readiness requires the tracking pack * ci: attach PR test-build packs to the PR release instead of Components
This commit is contained in:
1 parent
0663593920
commit
e3246b7dd5
72 files changed
+710
-112
No files matched your search
@@ -539,6 +539,9 @@ jobs:
|
||||
rustup target add --toolchain 1.90.0 aarch64-unknown-linux-gnu
|
||||
RUSTUP_TOOLCHAIN=1.90.0 bash tools/comet/build.sh
|
||||
|
||||
- name: Build the add-on packs
|
||||
run: bash tools/packs/build.sh app/build/packs
|
||||
|
||||
- name: Build
|
||||
id: build
|
||||
env:
|
||||
@@ -642,6 +645,14 @@ jobs:
|
||||
retention-days: 30
|
||||
compression-level: 0
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: droiddeck-packs
|
||||
path: app/build/packs/*.tar.zst
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
compression-level: 0
|
||||
|
||||
- name: Report on the pull request
|
||||
if: always() && github.event_name == 'pull_request'
|
||||
continue-on-error: true
|
||||
@@ -744,8 +755,17 @@ jobs:
|
||||
variants: ${{ needs.build.outputs.variants }}
|
||||
secrets: inherit
|
||||
|
||||
packs:
|
||||
needs: build
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
uses: ./.github/workflows/publish-packs.yml
|
||||
secrets: inherit
|
||||
|
||||
announce:
|
||||
needs: [build, sign]
|
||||
needs: [build, sign, packs]
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
|
||||
@@ -176,6 +176,27 @@ jobs:
|
||||
pattern: droiddeck-pr-signed-*
|
||||
merge-multiple: true
|
||||
path: signed
|
||||
- name: The add-on packs main has not published
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RUN: ${{ needs.authorize.outputs.run_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh run download "$RUN" -R "$GITHUB_REPOSITORY" -n droiddeck-packs -D packs
|
||||
mkdir -p pr-packs
|
||||
for file in packs/*.tar.zst; do
|
||||
name=$(basename "$file" .tar.zst)
|
||||
sha=$(sha256sum "$file" | cut -d' ' -f1)
|
||||
tag="pack-$name-${sha:0:16}"
|
||||
digest=$({ gh api "repos/Droid-Deck/DroidDeck-Components/releases/tags/$tag" 2>/dev/null || echo '{}'; } |
|
||||
jq -r --arg n "$name.tar.zst" '.assets // [] | .[] | select(.name == $n) | .digest // empty')
|
||||
if [ "$digest" = "sha256:$sha" ]; then
|
||||
echo "$name: served from DroidDeck-Components $tag"
|
||||
else
|
||||
cp "$file" "pr-packs/$tag.tar.zst"
|
||||
echo "$name: attached to the PR release as $tag.tar.zst"
|
||||
fi
|
||||
done
|
||||
- name: Describe the change
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
@@ -233,6 +254,7 @@ jobs:
|
||||
first=true
|
||||
fi
|
||||
echo "first=$first" >> "$GITHUB_OUTPUT"
|
||||
cp pr-packs/* signed/ 2>/dev/null || true
|
||||
gh release upload "$tag" signed/* -R "$repo" --clobber
|
||||
gh release edit "$tag" -R "$repo" --title "PR #$PR_NUMBER" --notes "$notes" --prerelease
|
||||
keep=$(cd signed && ls | jq -R . | jq -sc .)
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
name: Publish add-on packs
|
||||
|
||||
# The add-on packs (tools/packs/build.sh) a Build APK run made, published to DroidDeck-Components under
|
||||
# content-addressed tags (pack-<name>-<first 16 hex of sha256>). The APK from that run pins each pack's
|
||||
# SHA-256 and downloads it from that tag. A tag is created once and never replaced.
|
||||
# Only main and release builds publish here; a PR test build attaches the packs main has not published
|
||||
# to its pr-N release on DroidDeck-CI (pr-release-publish.yml), which is deleted when the PR closes.
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
run_id:
|
||||
description: The Build APK run whose packs to publish; empty for the calling run's own
|
||||
type: string
|
||||
default: ''
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: publish add-on packs
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
concurrency:
|
||||
group: publish-packs
|
||||
cancel-in-progress: false
|
||||
steps:
|
||||
- name: The packs (this run's build)
|
||||
if: inputs.run_id == ''
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: droiddeck-packs
|
||||
path: packs
|
||||
|
||||
- name: The packs (another Build APK run)
|
||||
if: inputs.run_id != ''
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RUN: ${{ inputs.run_id }}
|
||||
run: gh run download "$RUN" -R "$GITHUB_REPOSITORY" -n droiddeck-packs -D packs
|
||||
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: components-token
|
||||
with:
|
||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-Components
|
||||
|
||||
- name: Publish
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.components-token.outputs.token }}
|
||||
REPO: Droid-Deck/DroidDeck-Components
|
||||
BUILD_RUN: ${{ inputs.run_id || github.run_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
published_digest() {
|
||||
{ gh api "repos/$REPO/releases/tags/$1" 2>/dev/null || echo '{}'; } |
|
||||
jq -r --arg n "$2" '.assets // [] | .[] | select(.name == $n) | .digest // empty'
|
||||
}
|
||||
commit=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN" --jq .head_sha 2>/dev/null || echo "$GITHUB_SHA")
|
||||
for name in proot directaudio tracking xbox comet; do
|
||||
file="packs/$name.tar.zst"
|
||||
[ -f "$file" ] || { echo "::error::$name.tar.zst is missing from Build APK run $BUILD_RUN"; exit 1; }
|
||||
sha=$(sha256sum "$file" | cut -d' ' -f1)
|
||||
tag="pack-$name-${sha:0:16}"
|
||||
digest=$(published_digest "$tag" "$name.tar.zst")
|
||||
if [ -z "$digest" ]; then
|
||||
notes="DroidDeck add-on pack \`$name\`, built by [Build APK run $BUILD_RUN]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN) from \`$commit\` with tools/packs/build.sh and published by [run $GITHUB_RUN_ID]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID).
|
||||
|
||||
Size: $(stat -c %s "$file") bytes. SHA-256: $sha. APKs built in the same run pin this digest."
|
||||
gh release create "$tag" -R "$REPO" --title "$tag" --notes "$notes" "$file" \
|
||||
|| echo "::warning::creating $tag failed; checking whether another run published it"
|
||||
digest=$(published_digest "$tag" "$name.tar.zst")
|
||||
fi
|
||||
if [ "$digest" != "sha256:$sha" ]; then
|
||||
echo "::error::$tag holds ${digest:-nothing} for $name.tar.zst, not sha256:$sha"
|
||||
exit 1
|
||||
fi
|
||||
echo "- \`$name\`: [$tag]($GITHUB_SERVER_URL/$REPO/releases/tag/$tag) \`$sha\`" >> "$GITHUB_STEP_SUMMARY"
|
||||
done
|
||||
@@ -63,9 +63,19 @@ jobs:
|
||||
artifact: droiddeck-release
|
||||
secrets: inherit
|
||||
|
||||
packs:
|
||||
needs: find
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
uses: ./.github/workflows/publish-packs.yml
|
||||
with:
|
||||
run_id: ${{ needs.find.outputs.run_id }}
|
||||
secrets: inherit
|
||||
|
||||
publish:
|
||||
name: publish the release
|
||||
needs: [find, sign]
|
||||
needs: [find, sign, packs]
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
|
||||
+30
-16
@@ -84,6 +84,23 @@ def commitTime = (gitValue(['show', '-s', '--format=%ct', 'HEAD']) ?: '0').with
|
||||
def desktopKde = rootProject.file('tools/desktop-kde/release.env').readLines()
|
||||
.findAll { it.contains('=') && !it.startsWith('#') }
|
||||
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
|
||||
def trackingPack = rootProject.file('tools/packs/tracking/release.env').readLines()
|
||||
.findAll { it.contains('=') && !it.startsWith('#') }
|
||||
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
|
||||
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet'].collectEntries { name ->
|
||||
def pack = file("build/packs/${name}.tar.zst")
|
||||
if (!pack.isFile()) {
|
||||
if (ciBuild) throw new GradleException("Add-on pack ${pack} is missing: run tools/packs/build.sh app/build/packs")
|
||||
return [(name): [sha256: '', size: 0L]]
|
||||
}
|
||||
def digest = java.security.MessageDigest.getInstance('SHA-256')
|
||||
pack.withInputStream { input ->
|
||||
byte[] buffer = new byte[1 << 20]
|
||||
int n
|
||||
while ((n = input.read(buffer)) > 0) digest.update(buffer, 0, n)
|
||||
}
|
||||
[(name): [sha256: digest.digest().encodeHex().toString(), size: pack.length()]]
|
||||
}
|
||||
def desktopRemovalSources = new groovy.json.JsonSlurper().parse(file('src/main/assets/desktop-removal/sources.json'))
|
||||
if (desktopRemovalSources.archives[desktopKde.DESKTOP_KDE_TAG] != desktopKde.DESKTOP_KDE_SHA256) {
|
||||
throw new GradleException('Desktop removal inventories do not match the pinned archive')
|
||||
@@ -119,6 +136,10 @@ android {
|
||||
buildConfigField "String", "DESKTOP_KDE_URL", "\"https://github.com/${desktopKde.DESKTOP_KDE_REPO}/releases/download/${desktopKde.DESKTOP_KDE_TAG}/desktop-kde.tar.zst\""
|
||||
buildConfigField "String", "DESKTOP_KDE_SHA256", "\"${desktopKde.DESKTOP_KDE_SHA256}\""
|
||||
buildConfigField "long", "DESKTOP_KDE_SIZE", "${desktopKde.DESKTOP_KDE_SIZE}L"
|
||||
addonPacks.each { name, pack ->
|
||||
buildConfigField "String", "PACK_${name.toUpperCase()}_SHA256", "\"${pack.sha256}\""
|
||||
buildConfigField "long", "PACK_${name.toUpperCase()}_SIZE", "${pack.size}L"
|
||||
}
|
||||
|
||||
ndk {
|
||||
abiFilters 'arm64-v8a'
|
||||
@@ -172,6 +193,11 @@ android {
|
||||
disable 'ExpiredTargetSdkVersion'
|
||||
}
|
||||
|
||||
androidResources {
|
||||
// aapt's default ignore list, plus the trees shipped as add-on packs (tools/packs).
|
||||
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>directaudio'
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += ['META-INF/versions/9/OSGI-INF/MANIFEST.MF']
|
||||
@@ -179,6 +205,8 @@ android {
|
||||
jniLibs {
|
||||
useLegacyPackaging = true
|
||||
pickFirsts += ['**/libtermux.so']
|
||||
// Shipped in the proot and tracking packs (tools/packs) and run or loaded from there.
|
||||
excludes += ['**/libproot.so', '**/libproot-loader.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,22 +312,8 @@ def buildRustStores = tasks.register('buildRustStores', Exec) {
|
||||
if (!skipRust) android.sourceSets.main.jniLibs.srcDir(rustJniLibsDir)
|
||||
tasks.named('preBuild').configure { dependsOn(buildRustStores) }
|
||||
|
||||
def verifyHandModel = tasks.register('verifyHandModel') {
|
||||
def models = ['hand_landmarker.task': 'fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1',
|
||||
'hand_landmarker_lite.task': '173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8']
|
||||
.collectEntries { name, hash -> [(file("src/main/assets/models/$name")): hash] }
|
||||
inputs.files(models.keySet())
|
||||
doLast {
|
||||
models.each { model, expected ->
|
||||
def actual = java.security.MessageDigest.getInstance('SHA-256').digest(model.bytes).encodeHex().toString()
|
||||
if (actual != expected) throw new GradleException("Hand Landmarker model checksum mismatch: ${model.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.named('preBuild').configure { dependsOn(verifyHandModel) }
|
||||
|
||||
dependencies {
|
||||
implementation 'org.opencv:opencv:4.13.0'
|
||||
implementation "org.opencv:opencv:${trackingPack.OPENCV_VERSION}"
|
||||
implementation 'org.khronos.openxr:openxr_loader_for_android:1.1.49'
|
||||
implementation 'com.github.luben:zstd-jni:1.5.7-4@aar'
|
||||
implementation 'org.apache.commons:commons-compress:1.27.1'
|
||||
@@ -319,7 +333,7 @@ dependencies {
|
||||
implementation 'androidx.camera:camera-camera2:1.4.2'
|
||||
implementation 'androidx.camera:camera-lifecycle:1.4.2'
|
||||
implementation 'androidx.webkit:webkit:1.12.1'
|
||||
implementation('com.google.mediapipe:tasks-vision:1.0.0') {
|
||||
implementation("com.google.mediapipe:tasks-vision:${trackingPack.MEDIAPIPE_VERSION}") {
|
||||
exclude group: 'com.google.auto.value', module: 'auto-value'
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -30,6 +30,10 @@ class App : Application() {
|
||||
com.droiddeck.launcher.session.SessionPrefs.settleGpuDriverMode(this)
|
||||
com.droiddeck.launcher.update.AppUpdates.init(this)
|
||||
com.droiddeck.launcher.core.DownloadSource.init(this)
|
||||
if (com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(this).isDirectory) {
|
||||
com.droiddeck.launcher.core.AddonPack.PROOT.ensure(this)
|
||||
com.droiddeck.launcher.core.AddonPack.DIRECTAUDIO.ensure(this)
|
||||
}
|
||||
GpuClockPin.clearLeftover(this)
|
||||
com.droiddeck.launcher.glasses.Glasses.init(this)
|
||||
com.droiddeck.launcher.glasses.GlassesMenuMirror.initialize(this)
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.BuildConfig
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
|
||||
/**
|
||||
* A pack built by CI alongside this APK (tools/packs). Main and release builds publish it to
|
||||
* DroidDeck-Components under a content-addressed tag; a PR test build attaches packs that are not there
|
||||
* yet to its pr-N release on DroidDeck-CI. The APK pins the pack's SHA-256, so only the bytes this build
|
||||
* was made with install, whichever host serves them.
|
||||
*/
|
||||
internal class AddonPack(val name: String, private val sha256: String, val size: Long, private val required: List<String>) {
|
||||
sealed interface State {
|
||||
data object Missing : State
|
||||
data class Downloading(val progress: Float) : State
|
||||
data object Failed : State
|
||||
data object Ready : State
|
||||
}
|
||||
|
||||
private val mutableState = MutableStateFlow<State>(State.Missing)
|
||||
val state: StateFlow<State> = mutableState.asStateFlow()
|
||||
private val lock = Any()
|
||||
|
||||
val available: Boolean get() = sha256.isNotEmpty()
|
||||
private val tag get() = "pack-$name-${sha256.take(16)}"
|
||||
private val urls get() = listOfNotNull(
|
||||
"https://github.com/$REPO/releases/download/$tag/$name.tar.zst",
|
||||
BuildConfig.PR_NUMBER.takeIf { it > 0 }?.let { "https://github.com/$PR_REPO/releases/download/pr-$it/$tag.tar.zst" },
|
||||
)
|
||||
|
||||
private fun root(context: Context) = File(context.filesDir, "addons/$name")
|
||||
/** App-private and written only after the archive matched the pinned digest. */
|
||||
fun dir(context: Context) = File(root(context), sha256)
|
||||
fun file(context: Context, relative: String) = File(dir(context), relative)
|
||||
|
||||
fun installed(context: Context): Boolean = available && File(dir(context), COMPLETE).isFile
|
||||
|
||||
fun refresh(context: Context): State {
|
||||
val now = mutableState.value
|
||||
if (now is State.Downloading) return now
|
||||
return (if (installed(context)) State.Ready else if (now == State.Failed) State.Failed else State.Missing)
|
||||
.also { mutableState.value = it }
|
||||
}
|
||||
|
||||
/** Starts the download in the background unless the pack is already present or on its way. */
|
||||
fun ensure(context: Context, onReady: (Context) -> Unit = {}) {
|
||||
val app = context.applicationContext
|
||||
synchronized(lock) {
|
||||
if (installed(app)) { mutableState.value = State.Ready; return }
|
||||
if (mutableState.value is State.Downloading) return
|
||||
mutableState.value = State.Downloading(0f)
|
||||
}
|
||||
scope.launch {
|
||||
val ok = runCatching { install(app) }.onFailure { Log.w(TAG, "$name: install failed", it) }.getOrDefault(false)
|
||||
mutableState.value = if (ok) State.Ready else State.Failed
|
||||
if (ok) onReady(app)
|
||||
}
|
||||
}
|
||||
|
||||
/** Blocks a worker thread until the pack is installed, starting the download if needed. */
|
||||
@JvmOverloads
|
||||
fun await(context: Context, running: () -> Boolean = { true }, onState: (State) -> Unit = {}): Boolean {
|
||||
if (installed(context)) return true
|
||||
ensure(context)
|
||||
while (running()) {
|
||||
val now = state.value
|
||||
onState(now)
|
||||
when (now) {
|
||||
State.Ready -> return installed(context)
|
||||
State.Failed -> return false
|
||||
else -> try { Thread.sleep(250) } catch (e: InterruptedException) { return false }
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun install(context: Context): Boolean {
|
||||
if (!available) {
|
||||
Log.w(TAG, "$name: this build has no pack")
|
||||
return false
|
||||
}
|
||||
val root = root(context).apply { mkdirs() }
|
||||
val archive = File(root, "$sha256.tar.zst")
|
||||
val downloaded = urls.any { url ->
|
||||
Downloader.downloadFile(url, archive, true, sha256) { p -> mutableState.value = State.Downloading(p.coerceIn(0f, 1f)) }
|
||||
.also { if (!it) archive.delete() }
|
||||
}
|
||||
if (!downloaded) return false
|
||||
val staging = File(root, "$sha256.partial")
|
||||
staging.deleteRecursively()
|
||||
try {
|
||||
if (!FileInputStream(archive).use { TarZst.extract(it, staging) }) return false
|
||||
check(required.all { File(staging, it).isFile }) { "$name pack is incomplete" }
|
||||
File(staging, COMPLETE).writeText(sha256)
|
||||
val target = dir(context)
|
||||
target.deleteRecursively()
|
||||
check(staging.renameTo(target)) { "could not move the $name pack into place" }
|
||||
} finally {
|
||||
staging.deleteRecursively()
|
||||
archive.delete()
|
||||
}
|
||||
root.listFiles().orEmpty().filter { it.name != sha256 }.forEach { it.deleteRecursively() }
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AddonPack"
|
||||
private const val REPO = "Droid-Deck/DroidDeck-Components"
|
||||
private const val PR_REPO = "Droid-Deck/DroidDeck-CI"
|
||||
const val COMPLETE = ".complete"
|
||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||
|
||||
@JvmField
|
||||
val PROOT = AddonPack("proot", BuildConfig.PACK_PROOT_SHA256, BuildConfig.PACK_PROOT_SIZE,
|
||||
listOf("libproot.so", "libproot-loader.so"))
|
||||
@JvmField
|
||||
val DIRECTAUDIO = AddonPack("directaudio", BuildConfig.PACK_DIRECTAUDIO_SHA256, BuildConfig.PACK_DIRECTAUDIO_SIZE,
|
||||
listOf("linux-wine11/version.txt", "linux-wine11-systhread/version.txt"))
|
||||
val TRACKING = AddonPack("tracking", BuildConfig.PACK_TRACKING_SHA256, BuildConfig.PACK_TRACKING_SIZE, listOf(
|
||||
"hand_landmarker.task", "hand_landmarker_lite.task", "pose_landmarker_lite.task",
|
||||
"libopencv_java4.so", "libmediapipe_tasks_jni.so"))
|
||||
val XBOX = AddonPack("xbox", BuildConfig.PACK_XBOX_SHA256, BuildConfig.PACK_XBOX_SIZE,
|
||||
listOf("version", "xodus-cli", "xodus-service"))
|
||||
val COMET = AddonPack("comet", BuildConfig.PACK_COMET_SHA256, BuildConfig.PACK_COMET_SIZE,
|
||||
listOf("version", "comet"))
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.droiddeck.launcher.glasses
|
||||
|
||||
internal enum class HandModel(val asset: String, val sha256: String) {
|
||||
FULL("models/hand_landmarker.task", "fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1"),
|
||||
LITE("models/hand_landmarker_lite.task", "173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8");
|
||||
import com.droiddeck.launcher.handtracking.TrackingPack
|
||||
|
||||
internal enum class HandModel(val file: String, val sha256: String) {
|
||||
FULL(TrackingPack.HAND, "fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1"),
|
||||
LITE(TrackingPack.HAND_LITE, "173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8");
|
||||
|
||||
companion object {
|
||||
val DEFAULT = FULL
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.droiddeck.launcher.glasses
|
||||
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.handtracking.TrackingPack
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
@@ -11,7 +13,6 @@ import com.google.mediapipe.tasks.core.BaseOptions
|
||||
import com.google.mediapipe.tasks.core.Delegate
|
||||
import com.google.mediapipe.tasks.vision.core.RunningMode
|
||||
import com.google.mediapipe.tasks.vision.handlandmarker.HandLandmarker
|
||||
import org.opencv.android.OpenCVLoader
|
||||
import org.opencv.android.Utils
|
||||
import org.opencv.core.*
|
||||
import org.opencv.imgproc.Imgproc
|
||||
@@ -170,11 +171,11 @@ internal class StereoHandEngine(private val context: Context, private val token:
|
||||
} finally { calibrationProgress = calibrationProgress.copy(solving = false) }
|
||||
} }
|
||||
private fun detector(selected: HandModel=model, useGpu: Boolean=gpu, maxHands: Int=2): HandLandmarker {
|
||||
val bytes=context.assets.open(selected.asset).use { it.readBytes() }
|
||||
val bytes=TrackingPack.file(context,selected.file).readBytes()
|
||||
val hash=MessageDigest.getInstance("SHA-256").digest(bytes).joinToString("") { "%02x".format(it) }
|
||||
check(hash==selected.sha256) { context.getString(R.string.spatial_model_checksum_error) }
|
||||
return HandLandmarker.createFromOptions(context,HandLandmarker.HandLandmarkerOptions.builder()
|
||||
.setBaseOptions(BaseOptions.builder().setModelAssetPath(selected.asset)
|
||||
.setBaseOptions(BaseOptions.builder().setModelAssetBuffer(ByteBuffer.allocateDirect(bytes.size).put(bytes).apply { rewind() })
|
||||
.setDelegate(if(useGpu) Delegate.GPU else Delegate.CPU).build())
|
||||
.setRunningMode(RunningMode.VIDEO).setNumHands(maxHands).setMinHandDetectionConfidence(0.6f)
|
||||
.setMinHandPresenceConfidence(0.6f).setMinTrackingConfidence(0.6f).build())
|
||||
@@ -325,7 +326,11 @@ internal class StereoHandEngine(private val context: Context, private val token:
|
||||
SpatialTracking.session.setHands(generation,SpatialHand(),SpatialHand())
|
||||
}
|
||||
private fun loop() {
|
||||
try { check(OpenCVLoader.initLocal()) } catch(e: Throwable) { message=context.getString(R.string.spatial_opencv_error, e.message.orEmpty());return }
|
||||
val loaded=TrackingPack.awaitNative(context,{ running }) { state ->
|
||||
if(state is AddonPack.State.Downloading)
|
||||
message=context.getString(R.string.tracking_pack_downloading,(state.progress*100).toInt())
|
||||
}
|
||||
if(!loaded) { if(running) message=context.getString(R.string.tracking_pack_failed);return }
|
||||
var grayL=Mat();var grayR=Mat();val rgba=Mat()
|
||||
var bmpL: Bitmap?=null;var bmpR: Bitmap?=null
|
||||
var leftGray=ByteArray(0);var rightGray=ByteArray(0)
|
||||
@@ -336,7 +341,7 @@ internal class StereoHandEngine(private val context: Context, private val token:
|
||||
var lastSource=0L;var lastStamp=0L;var captureOn=false;var captureRate=1000;var lastInputSeq=0L
|
||||
var rate=0f
|
||||
try {
|
||||
check(OpenCVLoader.initLocal()) { context.getString(R.string.spatial_opencv_load_error) }
|
||||
check(TrackingPack.loadNative(context)) { context.getString(R.string.spatial_opencv_load_error) }
|
||||
joyConFlow=StereoJoyConFlow()
|
||||
while(running) {
|
||||
while(true) {
|
||||
|
||||
@@ -39,8 +39,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import java.io.File
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import java.util.concurrent.Executors
|
||||
import kotlin.math.abs
|
||||
|
||||
@@ -188,9 +186,8 @@ internal class HandCamera(
|
||||
private fun prepare() {
|
||||
if (stopped) return
|
||||
runCatching {
|
||||
val bytes = context.assets.open(MODEL).use { it.readBytes() }
|
||||
val model = ByteBuffer.allocateDirect(bytes.size).order(ByteOrder.nativeOrder()).put(bytes)
|
||||
model.rewind()
|
||||
check(TrackingPack.loadNative(context)) { "hand tracking download is not installed" }
|
||||
val model = TrackingPack.model(context, TrackingPack.POSE)
|
||||
val options = PoseLandmarker.PoseLandmarkerOptions.builder()
|
||||
.setBaseOptions(BaseOptions.builder().setModelAssetBuffer(model).setDelegate(Delegate.CPU).build())
|
||||
.setRunningMode(RunningMode.VIDEO)
|
||||
@@ -305,7 +302,6 @@ internal class HandCamera(
|
||||
|
||||
companion object {
|
||||
private const val TAG = "HandCamera"
|
||||
private const val MODEL = "handtracking/pose_landmarker_lite.task"
|
||||
private const val ANALYSIS_WIDTH = 960
|
||||
private const val ANALYSIS_HEIGHT = 720
|
||||
private const val MIN_CONFIDENCE = 0.5f
|
||||
|
||||
@@ -13,8 +13,6 @@ import com.google.mediapipe.tasks.core.BaseOptions
|
||||
import com.google.mediapipe.tasks.core.Delegate
|
||||
import com.google.mediapipe.tasks.vision.core.RunningMode
|
||||
import com.google.mediapipe.tasks.vision.handlandmarker.HandLandmarker
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import kotlin.math.hypot
|
||||
import kotlin.math.max
|
||||
|
||||
@@ -134,7 +132,6 @@ internal class HandModel private constructor(private val landmarkers: List<HandL
|
||||
hypot(fix.x - marks[WRISTS[side]].x * k.width, fix.y - marks[WRISTS[side]].y * k.height)
|
||||
|
||||
companion object {
|
||||
private const val MODEL = "handtracking/hand_landmarker.task"
|
||||
private val WRISTS = intArrayOf(BodyPose.LEFT_WRIST, BodyPose.RIGHT_WRIST)
|
||||
private val PINKIES = intArrayOf(BodyPose.LEFT_PINKY, BodyPose.RIGHT_PINKY)
|
||||
private val INDEXES = intArrayOf(BodyPose.LEFT_INDEX, BodyPose.RIGHT_INDEX)
|
||||
@@ -153,10 +150,9 @@ internal class HandModel private constructor(private val landmarkers: List<HandL
|
||||
private const val MIN_CONFIDENCE = 0.4f
|
||||
|
||||
fun open(context: Context): HandModel {
|
||||
val bytes = context.assets.open(MODEL).use { it.readBytes() }
|
||||
check(TrackingPack.loadNative(context)) { "hand tracking download is not installed" }
|
||||
fun landmarker(mode: RunningMode, hands: Int): HandLandmarker {
|
||||
val model = ByteBuffer.allocateDirect(bytes.size).order(ByteOrder.nativeOrder()).put(bytes)
|
||||
model.rewind()
|
||||
val model = TrackingPack.model(context, TrackingPack.HAND)
|
||||
return HandLandmarker.createFromOptions(context, HandLandmarker.HandLandmarkerOptions.builder()
|
||||
.setBaseOptions(BaseOptions.builder().setModelAssetBuffer(model).setDelegate(Delegate.CPU).build())
|
||||
.setRunningMode(mode)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.handtracking
|
||||
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
@@ -16,9 +17,10 @@ internal object HandTracking {
|
||||
val side: String? = null,
|
||||
val permitted: Boolean = false,
|
||||
val sides: Set<String> = emptySet(),
|
||||
val downloaded: Boolean = false,
|
||||
) {
|
||||
val usable: Boolean get() = sides.isNotEmpty()
|
||||
val ready: Boolean get() = enabled && permitted && usable
|
||||
val ready: Boolean get() = enabled && permitted && usable && downloaded
|
||||
}
|
||||
|
||||
private val state = MutableStateFlow(Settings())
|
||||
@@ -38,8 +40,11 @@ internal object HandTracking {
|
||||
side = prefs.getString(SIDE, null),
|
||||
permitted = permitted(context),
|
||||
sides = if (supported) TrackingCameras.sides(found) else emptySet(),
|
||||
downloaded = TrackingPack.installed(context),
|
||||
)
|
||||
state.value = next
|
||||
if (next.enabled && next.usable && !next.downloaded && TrackingPack.refresh(context) == AddonPack.State.Missing)
|
||||
TrackingPack.ensure(context)
|
||||
return next
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.droiddeck.launcher.handtracking
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.channels.FileChannel
|
||||
|
||||
/** Hand-tracking models and the OpenCV/MediaPipe native libraries, downloaded on first use. */
|
||||
internal object TrackingPack {
|
||||
const val HAND = "hand_landmarker.task"
|
||||
const val HAND_LITE = "hand_landmarker_lite.task"
|
||||
const val POSE = "pose_landmarker_lite.task"
|
||||
private const val OPENCV = "libopencv_java4.so"
|
||||
private const val MEDIAPIPE = "libmediapipe_tasks_jni.so"
|
||||
private const val TAG = "TrackingPack"
|
||||
|
||||
private val pack = AddonPack.TRACKING
|
||||
val state get() = pack.state
|
||||
val size get() = pack.size
|
||||
private val lock = Any()
|
||||
@Volatile private var nativeLoaded = false
|
||||
|
||||
fun installed(context: Context) = pack.installed(context)
|
||||
fun refresh(context: Context) = pack.refresh(context)
|
||||
fun ensure(context: Context) = pack.ensure(context) { HandTracking.load(it) }
|
||||
|
||||
fun file(context: Context, name: String): File = pack.file(context, name)
|
||||
|
||||
fun model(context: Context, name: String): ByteBuffer =
|
||||
FileInputStream(file(context, name)).use { it.channel.map(FileChannel.MapMode.READ_ONLY, 0, it.channel.size()) }
|
||||
|
||||
/**
|
||||
* Loads OpenCV and MediaPipe from the pack. MediaPipe's own System.loadLibrary then resolves to the
|
||||
* already-loaded library by soname, so this must run before any MediaPipe task class initializes.
|
||||
*/
|
||||
fun loadNative(context: Context): Boolean {
|
||||
if (nativeLoaded) return true
|
||||
synchronized(lock) {
|
||||
if (nativeLoaded) return true
|
||||
if (!pack.installed(context)) return false
|
||||
return runCatching {
|
||||
System.load(file(context, OPENCV).absolutePath)
|
||||
System.load(file(context, MEDIAPIPE).absolutePath)
|
||||
nativeLoaded = true
|
||||
true
|
||||
}.onFailure { Log.e(TAG, "native libraries failed to load", it) }.getOrDefault(false)
|
||||
}
|
||||
}
|
||||
|
||||
/** Blocks the calling worker thread until the pack is usable, starting the download if needed. */
|
||||
fun awaitNative(context: Context, running: () -> Boolean, onState: (AddonPack.State) -> Unit): Boolean =
|
||||
pack.await(context, running, onState) && loadNative(context)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.runtime;
|
||||
|
||||
import com.droiddeck.launcher.core.AddonPack;
|
||||
import android.content.Context;
|
||||
import android.os.Process;
|
||||
import android.system.ErrnoException;
|
||||
@@ -64,14 +65,12 @@ public final class LinuxRuntime {
|
||||
private static final String HOST_DIR = "opt/android-host";
|
||||
|
||||
public static File prootBinary(Context context) {
|
||||
File packaged = new File(context.getApplicationInfo().nativeLibraryDir, "libproot.so");
|
||||
if (packaged.isFile()) return packaged;
|
||||
if (AddonPack.PROOT.installed(context)) return AddonPack.PROOT.file(context, "libproot.so");
|
||||
return new File(rootDir(context), HOST_DIR + "/proot");
|
||||
}
|
||||
|
||||
public static File prootLoader(Context context) {
|
||||
File packaged = new File(context.getApplicationInfo().nativeLibraryDir, "libproot-loader.so");
|
||||
if (packaged.isFile()) return packaged;
|
||||
if (AddonPack.PROOT.installed(context)) return AddonPack.PROOT.file(context, "libproot-loader.so");
|
||||
return new File(rootDir(context), HOST_DIR + "/loader");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.runtime;
|
||||
|
||||
import com.droiddeck.launcher.core.AddonPack;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -261,6 +262,8 @@ public final class LinuxRuntimeInstaller {
|
||||
emptyTrash(LinuxRuntime.rootDir(context).getParentFile());
|
||||
String downloading = context.getString(R.string.rtinst_downloading);
|
||||
if (listener != null) listener.onProgress(Step.DOWNLOADING, downloading, 0);
|
||||
if (!AddonPack.PROOT.await(context)) throw new IOException("Cannot download proot");
|
||||
if (!AddonPack.DIRECTAUDIO.await(context)) throw new IOException("Cannot download DirectAudio");
|
||||
boolean ok = Downloader.downloadFile(release.url, archive, true, release.sha256, (fraction) -> {
|
||||
if (listener != null) {
|
||||
listener.onProgress(Step.DOWNLOADING, downloading,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
@@ -11,7 +12,7 @@ object ProotFastPath {
|
||||
|
||||
fun enabled(context: Context): Boolean =
|
||||
SessionPrefs.prootFastPath(context) && !SessionPrefs.prootNoSeccomp(context) &&
|
||||
LinuxRuntime.prootBinary(context).parent == context.applicationInfo.nativeLibraryDir
|
||||
LinuxRuntime.prootBinary(context).parentFile == AddonPack.PROOT.dir(context)
|
||||
|
||||
fun key(root: File, binds: List<String>): String? {
|
||||
if (binds.size > MAX_BINDS || binds.any { it.contains('|') } || root.path.contains('|')) return null
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
@@ -137,9 +138,7 @@ object SessionFiles {
|
||||
"usr/local/bin/gamescope" to "usr/local/bin/gamescope",
|
||||
"usr/local/lib/droiddeck/uruntime" to "usr/local/lib/droiddeck/uruntime",
|
||||
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
|
||||
) + listOf("xodus-cli", "xodus-service", "LICENSE.xodus", "LICENSE.nexus", "LICENSE.LGPL-2.1", "LICENSE.nghttp2", "backend.lock.json", "runtime.lock.json", "version",
|
||||
"windows/xgameruntime.dll", "windows/winhttp.dll", "windows/windows.web.dll", "windows/twinapi.appcore.dll", "windows/libnghttp2.dll")
|
||||
.map { "usr/local/lib/droiddeck-xbox/$it" to "usr/local/lib/droiddeck-xbox/$it" } + mangoapp + listOf("comet", "GalaxyCommunication.exe", "update-permissions.exe", "LICENSE", "version").map { "usr/local/lib/droiddeck-comet/$it" to "usr/local/lib/droiddeck-comet/$it" } + msitools.map { it to it } + vr + fexPreloads).filter { (asset, _) ->
|
||||
) + mangoapp + msitools.map { it to it } + vr + fexPreloads).filter { (asset, _) ->
|
||||
val dir = asset.substringBeforeLast('/')
|
||||
runCatching { context.assets.list("linuxfs/$dir")?.contains(asset.substringAfterLast('/')) == true }.getOrDefault(false)
|
||||
}
|
||||
@@ -173,7 +172,9 @@ object SessionFiles {
|
||||
"i386-windows/winedirectaudio.drv",
|
||||
"version.txt",
|
||||
)
|
||||
for (set in DIRECTAUDIO_SETS) for (relative in directAudio) {
|
||||
val directAudioPack = AddonPack.DIRECTAUDIO.takeIf { it.installed(context) }?.dir(context)
|
||||
if (directAudioPack == null) Log.w(TAG, "DirectAudio pack is not installed; drivers not staged")
|
||||
if (directAudioPack != null) for (set in DIRECTAUDIO_SETS) for (relative in directAudio) {
|
||||
val key = "$DIRECTAUDIO_DIR/$set/lib/wine/$relative"
|
||||
val target = File(root, key)
|
||||
if (ledger.current(key, target)) continue
|
||||
@@ -181,7 +182,7 @@ object SessionFiles {
|
||||
var installed = false
|
||||
try {
|
||||
target.parentFile?.mkdirs()
|
||||
context.assets.open("directaudio/$set/$relative").use { input ->
|
||||
File(directAudioPack, "$set/$relative").inputStream().use { input ->
|
||||
staged.outputStream().use { output -> FileUtils.copy(input, output) }
|
||||
}
|
||||
installed = staged.setReadable(true, false) && staged.renameTo(target)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import com.droiddeck.launcher.gpu.LinuxVulkanDriver
|
||||
import com.droiddeck.launcher.gpu.LinuxVulkanDriverManager
|
||||
|
||||
@@ -319,6 +320,8 @@ class SessionService : Service() {
|
||||
val sessionRoot = LinuxRuntime.sessionRoot(this).apply { mkdirs() }
|
||||
val runtimeDir = File(filesDir, ".wayland-rt").apply { mkdirs() }
|
||||
killStragglers()
|
||||
for (pack in listOf(AddonPack.PROOT, AddonPack.DIRECTAUDIO))
|
||||
if (!pack.await(this, { gen == sessionGen && SessionState.running })) Log.w(TAG, "${pack.name} pack unavailable")
|
||||
SessionFiles.stage(this, root, startsSession = true)
|
||||
// Earlier sessions' reports still read the Steam logs and VAC marker this session replaces.
|
||||
SessionArtifacts.awaitCollections()
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.Log
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.SessionEvents
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
@@ -24,7 +25,8 @@ import java.util.concurrent.TimeUnit
|
||||
|
||||
object GogComet {
|
||||
private const val TAG = "GogComet"
|
||||
private const val BIN = "/usr/local/lib/droiddeck-comet/comet"
|
||||
private const val DIR = "/usr/local/lib/droiddeck-comet"
|
||||
private const val BIN = "$DIR/comet"
|
||||
private val lock = Any()
|
||||
@Volatile private var process: Process? = null
|
||||
private var pid = -1
|
||||
@@ -41,7 +43,27 @@ object GogComet {
|
||||
|
||||
fun setEnabled(context: Context, on: Boolean) {
|
||||
GogPrefs.get(context).edit().putBoolean("achievements", on).apply()
|
||||
if (on) AddonPack.COMET.ensure(context)
|
||||
}
|
||||
|
||||
private fun stage(context: Context): Boolean {
|
||||
if (!AddonPack.COMET.installed(context)) {
|
||||
AddonPack.COMET.ensure(context)
|
||||
return false
|
||||
}
|
||||
val pack = AddonPack.COMET.dir(context)
|
||||
val root = File(LinuxRuntime.rootDir(context), DIR.removePrefix("/"))
|
||||
val packaged = File(pack, "version").readText()
|
||||
if (runCatching { File(root, "version").readText() }.getOrNull() == packaged) return true
|
||||
root.mkdirs()
|
||||
pack.listFiles().orEmpty().filter { it.isFile && it.name != "version" && it.name != AddonPack.COMPLETE }.forEach { source ->
|
||||
val staged = File(root, source.name + ".staged")
|
||||
source.inputStream().use { input -> staged.outputStream().use { input.copyTo(it) } }
|
||||
staged.setExecutable(true, false)
|
||||
check(staged.renameTo(File(root, source.name)))
|
||||
}
|
||||
File(root, "version").writeText(packaged)
|
||||
return true
|
||||
}
|
||||
|
||||
fun begin() = synchronized(lock) {
|
||||
@@ -113,7 +135,8 @@ object GogComet {
|
||||
return JSONObject().put("ok", true).put("ready", true).put("reason", "ready")
|
||||
}
|
||||
stopLocked()
|
||||
if (!File(LinuxRuntime.rootDir(context), BIN.removePrefix("/")).isFile) return reply(false, "not-installed")
|
||||
if (!runCatching { stage(context) }.onFailure { Log.w(TAG, "staging failed", it) }.getOrDefault(false) ||
|
||||
!File(LinuxRuntime.rootDir(context), BIN.removePrefix("/")).isFile) return reply(false, "not-installed")
|
||||
val data = File(context.filesDir, "gog-achievements").apply { mkdirs() }
|
||||
val ready = CountDownLatch(1)
|
||||
val command = LinuxRuntime.command(context, null, null, Environment.getExternalStorageDirectory(),
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.stores.xbox
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import org.json.JSONObject
|
||||
@@ -42,28 +43,30 @@ internal object Xodus {
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized private fun stage(app: Context) {
|
||||
@Synchronized private fun stage(app: Context): File {
|
||||
check(AddonPack.XBOX.await(app)) { "Couldn't download the Xbox components. Check your connection and try again." }
|
||||
val pack = AddonPack.XBOX.dir(app)
|
||||
val root = File(LinuxRuntime.rootDir(app), DIR.removePrefix("/"))
|
||||
val packaged = app.assets.open("linuxfs$DIR/version").bufferedReader().use { it.readText() }
|
||||
if (runCatching { File(root, "version").readText() }.getOrNull() == packaged) return
|
||||
fun copy(relative: String) {
|
||||
val entries = app.assets.list("linuxfs$DIR/$relative").orEmpty()
|
||||
if (entries.isNotEmpty()) { entries.forEach { copy(if (relative.isEmpty()) it else "$relative/$it") }; return }
|
||||
if (relative == "version") return
|
||||
val packaged = File(pack, "version").readText()
|
||||
if (runCatching { File(root, "version").readText() }.getOrNull() == packaged) return pack
|
||||
fun copy(source: File, relative: String) {
|
||||
if (source.isDirectory) { source.listFiles().orEmpty().forEach { copy(it, if (relative.isEmpty()) it.name else "$relative/${it.name}") }; return }
|
||||
if (relative == "version" || relative == AddonPack.COMPLETE) return
|
||||
val file = File(root, relative)
|
||||
file.parentFile?.mkdirs()
|
||||
val staged = File(file.path + ".staged")
|
||||
app.assets.open("linuxfs$DIR/$relative").use { input -> staged.outputStream().use { input.copyTo(it) } }
|
||||
source.inputStream().use { input -> staged.outputStream().use { input.copyTo(it) } }
|
||||
staged.setExecutable(true, false)
|
||||
check(staged.renameTo(file))
|
||||
}
|
||||
copy("")
|
||||
copy(pack, "")
|
||||
File(root, "version").writeText(packaged)
|
||||
return pack
|
||||
}
|
||||
|
||||
fun start(app: Context, args: List<String>, service: Boolean = false, runtimeDirectory: File? = null, launchDirectory: File? = null, credentialGeneration: String? = null): Child {
|
||||
check(LinuxRuntime.isInstalled(app)) { "Install the Linux runtime before using Xbox." }
|
||||
stage(app)
|
||||
val pack = stage(app)
|
||||
val binary = "$DIR/${if (service) "xodus-service" else "xodus-cli"}"
|
||||
check(File(LinuxRuntime.rootDir(app), binary.removePrefix("/")).isFile) { "The Xbox backend is missing. Update the Linux runtime." }
|
||||
val credentials = XboxCredentials(app, credentialGeneration)
|
||||
@@ -83,7 +86,7 @@ internal object Xodus {
|
||||
LinuxRuntime.prootLibraryPath(app).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
val digest = java.security.MessageDigest.getInstance("SHA-256")
|
||||
app.assets.open("linuxfs$binary").use { input ->
|
||||
File(pack, binary.removePrefix("$DIR/")).inputStream().use { input ->
|
||||
val buffer = ByteArray(65536)
|
||||
while (true) { val n = input.read(buffer); if (n < 0) break; digest.update(buffer, 0, n) }
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
import android.text.format.Formatter
|
||||
import android.speech.tts.TextToSpeech
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
@@ -70,6 +72,7 @@ import com.droiddeck.launcher.handtracking.Advice
|
||||
import com.droiddeck.launcher.handtracking.BodyPose
|
||||
import com.droiddeck.launcher.handtracking.HandCamera
|
||||
import com.droiddeck.launcher.handtracking.HandTracking
|
||||
import com.droiddeck.launcher.handtracking.TrackingPack
|
||||
import com.droiddeck.launcher.handtracking.Landmark
|
||||
import com.droiddeck.launcher.handtracking.TrackingCameras
|
||||
import kotlinx.coroutines.delay
|
||||
@@ -186,11 +189,27 @@ internal fun HandCameraRows(host: MenuHost, track: (String) -> Modifier, inSessi
|
||||
})
|
||||
!s.permitted -> ActionRow(stringResource(R.string.hand_camera_access), stringResource(R.string.hand_camera_access_hint),
|
||||
stringResource(R.string.hand_camera_allow_button), { ask.launch(Manifest.permission.CAMERA) })
|
||||
!s.downloaded -> TrackingPackRow()
|
||||
!inSession -> ActionRow(stringResource(R.string.hand_camera_placement), stringResource(R.string.hand_camera_placement_hint),
|
||||
stringResource(R.string.hand_camera_check), { HandTracking.requestCheck() })
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TrackingPackRow() {
|
||||
val context = LocalContext.current
|
||||
val pack by TrackingPack.state.collectAsState()
|
||||
val size = Formatter.formatShortFileSize(context, TrackingPack.size)
|
||||
when (val now = pack) {
|
||||
is AddonPack.State.Downloading -> ActionRow(stringResource(R.string.tracking_pack_title),
|
||||
stringResource(R.string.tracking_pack_hint, size), stringResource(R.string.tracking_pack_download), {}, progress = now.progress)
|
||||
AddonPack.State.Failed -> ActionRow(stringResource(R.string.tracking_pack_title),
|
||||
stringResource(R.string.tracking_pack_failed), stringResource(R.string.tracking_pack_retry), { TrackingPack.ensure(context) })
|
||||
else -> ActionRow(stringResource(R.string.tracking_pack_title),
|
||||
stringResource(R.string.tracking_pack_hint, size), stringResource(R.string.tracking_pack_download), { TrackingPack.ensure(context) })
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PlacementCheck(settings: HandTracking.Settings, play: Boolean, onPlay: () -> Unit, onClose: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
|
||||
@@ -29,13 +29,13 @@ import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.core.AppUiPrefs
|
||||
import com.droiddeck.launcher.glasses.CalibrationDistance
|
||||
import com.droiddeck.launcher.handtracking.TrackingPack
|
||||
import com.droiddeck.launcher.glasses.Glasses
|
||||
import com.droiddeck.launcher.glasses.SpatialCalibrationProgress
|
||||
import com.droiddeck.launcher.glasses.SpatialTracking
|
||||
import com.droiddeck.launcher.glasses.SpatialTrackingStatus
|
||||
import com.droiddeck.launcher.glasses.StereoCalibrator
|
||||
import kotlinx.coroutines.delay
|
||||
import org.opencv.android.OpenCVLoader
|
||||
import org.opencv.android.Utils
|
||||
import org.opencv.core.Mat
|
||||
import org.opencv.core.Size
|
||||
@@ -95,7 +95,7 @@ class SpatialTrackingActivity : ComponentActivity() {
|
||||
}
|
||||
override fun onPause() { SpatialTracking.diagnostics(false);super.onPause() }
|
||||
private fun printBoard() {
|
||||
if(!OpenCVLoader.initLocal()) return
|
||||
if(!TrackingPack.loadNative(this)) return
|
||||
val c=StereoCalibrator(this);val mat=Mat()
|
||||
c.board.generateImage(Size(1500.0,2100.0),mat,0,1)
|
||||
val bitmap=Bitmap.createBitmap(1500,2100,Bitmap.Config.ARGB_8888)
|
||||
|
||||
@@ -513,6 +513,9 @@ internal fun storesSettingsStep(at: Rect, s: androidx.compose.runtime.State<Fron
|
||||
Column(Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 11.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { DownloadControls(st, a) }
|
||||
val context = androidx.compose.ui.platform.LocalContext.current
|
||||
var gogAchievements by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(com.droiddeck.launcher.stores.gog.GogComet.enabled(context)) }
|
||||
androidx.compose.runtime.LaunchedEffect(Unit) {
|
||||
if (gogAchievements) com.droiddeck.launcher.core.AddonPack.COMET.ensure(context)
|
||||
}
|
||||
SettingsRow(stringResource(R.string.gog_achievements), stringResource(R.string.gog_achievements_hint)) {
|
||||
ToggleSwitch(gogAchievements, label = stringResource(R.string.gog_achievements)) {
|
||||
gogAchievements = it
|
||||
|
||||
@@ -3049,7 +3049,6 @@
|
||||
<string name="spatial_hands_wait_stable">جارٍ انتظار استقرار تتبع الرأس؛ أعد ضبط مركز التتبع إذا طُلب منك ذلك.</string>
|
||||
<string name="spatial_old_frame">المراقبة بالكاميرات قديمة جدًا؛ في انتظار زوج جديد</string>
|
||||
<string name="spatial_fit_ready">تناسب %1$.2f بكسل. قم بقياس المسافة التي حددتها من الكاميرا اليسرى إلى مركز هدف المعايرة، ثم قم بالتحقق من صحتها.</string>
|
||||
<string name="spatial_opencv_error">OpenCV غير متاح: %1$s</string>
|
||||
<string name="spatial_restored">تمت استعادة %1$d من المشاهدات المحفوظة. قم بحساب المعايرة لإعادة المحاولة، أو ابدأ مجموعة جديدة لالتقاط المزيد.</string>
|
||||
<string name="spatial_captured">ملتقطة %1$d / 24 مشاهدة. حافظ على هدف المعايرة ثابتًا؛ حرك النظارات الذكية للعرض التالي.</string>
|
||||
<string name="spatial_capture_corners">رُفض الالتقاط: تظهر %1$d / 12 زاوية مطلوبة في كلتا الكاميرتين. أظهر جزءًا أكبر من لوحة المعايرة، وابقَ ثابتًا ثم حاول مرة أخرى.</string>
|
||||
|
||||
@@ -2899,7 +2899,6 @@
|
||||
<string name="spatial_hands_wait_stable">Esperando un seguimiento de cabeza estable; restablece el centro de seguimiento si se solicita.</string>
|
||||
<string name="spatial_old_frame">La observación con cámara es demasiado antigua; esperando un par nuevo</string>
|
||||
<string name="spatial_fit_ready">Ajustar %1$.2f px. Mida la distancia seleccionada desde la cámara izquierda hasta el centro del objetivo de calibración y luego valide.</string>
|
||||
<string name="spatial_opencv_error">OpenCV no disponible: %1$s</string>
|
||||
<string name="spatial_restored">%1$d vistas guardadas restauradas. Calcule la calibración para volver a intentarlo o comience un nuevo conjunto para capturar más.</string>
|
||||
<string name="spatial_captured">Capturado %1$d / 24 vistas. Mantenga fijo el objetivo de calibración; Mueva las gafas inteligentes para la siguiente vista.</string>
|
||||
<string name="spatial_capture_corners">Captura rechazada: %1$d / 12 esquinas requeridas visibles en ambas cámaras. Muestre más del objetivo de calibración, quédese quieto y vuelva a intentarlo.</string>
|
||||
|
||||
@@ -2913,7 +2913,6 @@
|
||||
<string name="spatial_hands_wait_stable">Изчакване на стабилно проследяване на главата; нулиране на центъра за проследяване, ако е поискано.</string>
|
||||
<string name="spatial_old_frame">Наблюдението на камерата е твърде старо; в очакване на нов чифт</string>
|
||||
<string name="spatial_fit_ready">Побиране на %1$.2f пиксела. Измерете избраното разстояние от лявата камера до центъра на целта за калибриране, след което потвърдете.</string>
|
||||
<string name="spatial_opencv_error">OpenCV не е наличен: %1$s</string>
|
||||
<string name="spatial_restored">%1$d запазените изгледи са възстановени. Изчислете калибрирането, за да опитате отново, или започнете нов набор, за да заснемете повече.</string>
|
||||
<string name="spatial_captured">Заснето %1$d / 24 прегледа. Дръжте целта за калибриране фиксирана; преместете смарт очилата за следващия изглед.</string>
|
||||
<string name="spatial_capture_corners">Заснемането е отхвърлено: %1$d / 12 задължителни ъгъла, видими и в двете камери. Покажете още от целта за калибриране, задръжте неподвижно и опитайте отново.</string>
|
||||
|
||||
@@ -2981,7 +2981,6 @@
|
||||
<string name="spatial_hands_wait_stable">Čekání na stabilní sledování hlavy; resetování centra sledování je možné, pokud je požadováno.</string>
|
||||
<string name="spatial_old_frame">Pozorování kamerou je příliš staré; čekání na nový pár</string>
|
||||
<string name="spatial_fit_ready">Přizpůsobit %1$.2f pixelům. Změřte vybranou vzdálenost od levé kamery ke středu kalibračního cíle a poté potvrďte.</string>
|
||||
<string name="spatial_opencv_error">OpenCV není k dispozici: %1$s</string>
|
||||
<string name="spatial_restored">Bylo obnoveno %1$d uložených zobrazení. Vypočítejte kalibraci a zkuste to znovu, nebo spusťte novou sadu a zachyťte více.</string>
|
||||
<string name="spatial_captured">Pořízeno %1$d / 24 zobrazení. Udržujte kalibrační cíl pevný; posuňte chytré brýle pro další pohled.</string>
|
||||
<string name="spatial_capture_corners">Snímek zamítnut: %1$d / 12 požadovaných rohů viditelných v obou kamerách. Ukažte více z kalibračního cíle, nehýbejte se a zkuste to znovu.</string>
|
||||
|
||||
@@ -2913,7 +2913,6 @@
|
||||
<string name="spatial_hands_wait_stable">Venter på stabil hovedsporing; nulstil sporingscenter, hvis det anmodes om.</string>
|
||||
<string name="spatial_old_frame">Kameraobservation er for gammel; venter på et nyt par</string>
|
||||
<string name="spatial_fit_ready">Tilpas %1$.2f px. Mål din valgte afstand fra venstre kamera til kalibreringsmålets centrum, og valider derefter.</string>
|
||||
<string name="spatial_opencv_error">OpenCV utilgængelig: %1$s</string>
|
||||
<string name="spatial_restored">%1$d gemte visninger gendannet. Beregn kalibrering for at prøve igen, eller start et nyt sæt for at fange mere.</string>
|
||||
<string name="spatial_captured">Optaget %1$d / 24 visninger. Hold kalibreringsmålet fast; flyt de smarte briller til næste visning.</string>
|
||||
<string name="spatial_capture_corners">Optagelse afvist: %1$d / 12 påkrævede hjørner synlige i begge kameraer. Vis mere af kalibreringsmålet, hold stille, og prøv derefter igen.</string>
|
||||
|
||||
@@ -2913,7 +2913,6 @@
|
||||
<string name="spatial_hands_wait_stable">Warten auf stabiles Head-Tracking; Tracking-Zentrum bei Bedarf zurücksetzen.</string>
|
||||
<string name="spatial_old_frame">Kamerabeobachtung ist zu alt; warte auf ein neues Paar</string>
|
||||
<string name="spatial_fit_ready">%1$.2f px anpassen. Messen Sie den ausgewählten Abstand von der linken Kamera zum Zentrum des Kalibrierungsziels und bestätigen Sie ihn anschließend.</string>
|
||||
<string name="spatial_opencv_error">OpenCV nicht verfügbar: %1$s</string>
|
||||
<string name="spatial_restored">%1$d gespeicherte Ansichten wiederhergestellt. Berechnen Sie die Kalibrierung, um es erneut zu versuchen, oder starten Sie einen neuen Satz, um mehr zu erfassen.</string>
|
||||
<string name="spatial_captured">Aufgenommen %1$d / 24 Aufrufe. Halten Sie das Kalibrierungsziel fest; Bewegen Sie die Datenbrille für die nächste Ansicht.</string>
|
||||
<string name="spatial_capture_corners">Aufnahme abgelehnt: %1$d / 12 erforderliche Ecken in beiden Kameras sichtbar. Zeigen Sie mehr vom Kalibrierungsziel, halten Sie still und versuchen Sie es dann erneut.</string>
|
||||
|
||||
@@ -2913,7 +2913,6 @@
|
||||
<string name="spatial_hands_wait_stable">Αναμονή για σταθερή παρακολούθηση κεφαλής. Επαναφέρετε το κέντρο παρακολούθησης εάν ζητηθεί</string>
|
||||
<string name="spatial_old_frame">Η παρατήρηση με κάμερα είναι πολύ παλιά. περιμένοντας ένα φρέσκο ζευγάρι</string>
|
||||
<string name="spatial_fit_ready">Προσαρμογή %1$.2f px. Μετρήστε την επιλεγμένη απόσταση από την αριστερή κάμερα μέχρι το κέντρο στόχου βαθμονόμησης και, στη συνέχεια, επικυρώστε.</string>
|
||||
<string name="spatial_opencv_error">Το OpenCV δεν είναι διαθέσιμο: %1$s</string>
|
||||
<string name="spatial_restored">Αποκαταστάθηκαν οι αποθηκευμένες προβολές %1$d. Υπολογίστε τη βαθμονόμηση για να προσπαθήσετε ξανά ή ξεκινήστε ένα νέο σύνολο για να καταγράψετε περισσότερα.</string>
|
||||
<string name="spatial_captured">Λήψη %1$d / 24 προβολές. Διατηρήστε σταθερό τον στόχο βαθμονόμησης. μετακινήστε τα έξυπνα γυαλιά για την επόμενη προβολή.</string>
|
||||
<string name="spatial_capture_corners">Η λήψη απορρίφθηκε: %1$d / 12 απαιτούμενες γωνίες ορατές και στις δύο κάμερες. Εμφάνιση μεγαλύτερου μέρους του στόχου βαθμονόμησης, κρατήστε ακίνητο και μετά δοκιμάστε ξανά.</string>
|
||||
|
||||
@@ -2947,7 +2947,6 @@
|
||||
<string name="spatial_hands_wait_stable">Esperando un seguimiento de cabeza estable; restablece el centro de seguimiento si se solicita.</string>
|
||||
<string name="spatial_old_frame">La observación con cámara es demasiado antigua; esperando un par nuevo</string>
|
||||
<string name="spatial_fit_ready">Ajustar %1$.2f px. Mida la distancia seleccionada desde la cámara izquierda hasta el centro del objetivo de calibración y luego valide.</string>
|
||||
<string name="spatial_opencv_error">OpenCV no disponible: %1$s</string>
|
||||
<string name="spatial_restored">%1$d vistas guardadas restauradas. Calcule la calibración para volver a intentarlo o comience un nuevo conjunto para capturar más.</string>
|
||||
<string name="spatial_captured">Capturado %1$d / 24 vistas. Mantenga fijo el objetivo de calibración; Mueva las gafas inteligentes para la siguiente vista.</string>
|
||||
<string name="spatial_capture_corners">Captura rechazada: %1$d / 12 esquinas requeridas visibles en ambas cámaras. Muestre más del objetivo de calibración, quédese quieto y vuelva a intentarlo.</string>
|
||||
|
||||
@@ -2913,7 +2913,6 @@
|
||||
<string name="spatial_hands_wait_stable">Odotetaan vakaata pään seurantaa; nollaa seurantakeskus pyydettäessä.</string>
|
||||
<string name="spatial_old_frame">Kamerahavainto on liian vanha; uutta paria odotellessa</string>
|
||||
<string name="spatial_fit_ready">Sovita %1$.2f px. Mittaa valitsemasi etäisyys vasemmasta kamerasta kalibrointikohteen keskustaan ja vahvista sitten.</string>
|
||||
<string name="spatial_opencv_error">OpenCV ei saatavilla: %1$s</string>
|
||||
<string name="spatial_restored">%1$d tallennettua näkymää palautettu. Laske kalibrointi yrittääksesi uudelleen tai aloita uusi sarja, jos haluat ottaa lisää.</string>
|
||||
<string name="spatial_captured">Kuvattu %1$d / 24 katselukertaa. Pidä kalibrointitavoite kiinteänä; siirrä älylaseja seuraavaa näkymää varten.</string>
|
||||
<string name="spatial_capture_corners">Kuvaus hylätty: %1$d / 12 vaadittua kulmaa näkyvissä molemmissa kameroissa. Näytä lisää kalibrointikohdetta, pidä paikallaan ja yritä sitten uudelleen.</string>
|
||||
|
||||
@@ -2947,7 +2947,6 @@
|
||||
<string name="spatial_hands_wait_stable">Attente d\'un suivi de tête stable ; réinitialisation du centre de suivi si demandé.</string>
|
||||
<string name="spatial_old_frame">L\'observation par caméra est trop ancienne ; en attendant une nouvelle paire</string>
|
||||
<string name="spatial_fit_ready">Ajuster %1$.2f px. Mesurez la distance sélectionnée entre la caméra gauche et le centre de la cible de calibrage, puis validez.</string>
|
||||
<string name="spatial_opencv_error">OpenCV indisponible : %1$s</string>
|
||||
<string name="spatial_restored">%1$d vues enregistrées restaurées. Calculez l’étalonnage pour réessayer ou démarrez un nouvel ensemble pour en capturer davantage.</string>
|
||||
<string name="spatial_captured">Capturé %1$d / 24 vues. Gardez la cible d\'étalonnage fixe ; déplacez les lunettes intelligentes pour la vue suivante.</string>
|
||||
<string name="spatial_capture_corners">Capture rejetée : %1$d / 12 coins requis visibles dans les deux caméras. Affichez davantage la cible d\'étalonnage, restez immobile, puis réessayez.</string>
|
||||
|
||||
@@ -2913,7 +2913,6 @@
|
||||
<string name="spatial_hands_wait_stable">स्थिर हेड ट्रैकिंग की प्रतीक्षा कर रहा है; अनुरोध किए जाने पर ट्रैकिंग सेंटर को रीसेट करें</string>
|
||||
<string name="spatial_old_frame">कैमरा अवलोकन बहुत पुराना है; एक नई जोड़ी का इंतजार है</string>
|
||||
<string name="spatial_fit_ready">फ़िट %1$.2f पीएक्स। बाएं कैमरे से अंशांकन लक्ष्य केंद्र तक अपनी चयनित दूरी को मापें, फिर सत्यापित करें।</string>
|
||||
<string name="spatial_opencv_error">OpenCV अनुपलब्ध: %1$s</string>
|
||||
<string name="spatial_restored">%1$d सहेजे गए दृश्य पुनर्स्थापित किए गए। पुनः प्रयास करने के लिए अंशांकन की गणना करें, या अधिक कैप्चर करने के लिए एक नया सेट प्रारंभ करें।</string>
|
||||
<string name="spatial_captured">कैप्चर किया गया %1$d / 24 बार देखा गया। अंशांकन लक्ष्य निश्चित रखें; अगले दृश्य के लिए स्मार्ट चश्मा हटाएँ।</string>
|
||||
<string name="spatial_capture_corners">कैप्चर अस्वीकृत: %1$d / दोनों कैमरों में 12 आवश्यक कोने दिखाई दे रहे हैं। अंशांकन लक्ष्य को और अधिक दिखाएं, स्थिर रखें, फिर पुनः प्रयास करें।</string>
|
||||
|
||||
@@ -2911,7 +2911,6 @@
|
||||
<string name="spatial_hands_wait_stable">Várakozás stabil fejkövetésre; szükség esetén állítsa vissza a követőközpontot.</string>
|
||||
<string name="spatial_old_frame">A kamerás megfigyelés túl régi; friss párra vár</string>
|
||||
<string name="spatial_fit_ready">Fit %1$.2f px. Mérje meg a kiválasztott távolságot a bal oldali kamera és a kalibrációs célközép között, majd érvényesítse.</string>
|
||||
<string name="spatial_opencv_error">Az OpenCV nem érhető el: %1$s</string>
|
||||
<string name="spatial_restored">%1$d mentett nézet visszaállítva. Számítsa ki a kalibrációt az újrapróbálkozáshoz, vagy indítson új sorozatot, hogy többet rögzítsen.</string>
|
||||
<string name="spatial_captured">Rögzített %1$d / 24 megtekintés. Tartsa rögzítve a kalibrációs célt; mozgassa az okosszemüveget a következő nézethez.</string>
|
||||
<string name="spatial_capture_corners">Rögzítés elutasítva: %1$d / 12 szükséges sarok mindkét kamerán látható. Mutasson többet a kalibrációs célból, tartsa mozdulatlanul, majd próbálja újra.</string>
|
||||
|
||||
@@ -2888,7 +2888,6 @@
|
||||
<string name="spatial_hands_wait_stable">Menunggu pelacakan kepala yang stabil; reset pusat pelacakan jika diminta</string>
|
||||
<string name="spatial_old_frame">Pengamatan kamera terlalu tua; menunggu pasangan baru</string>
|
||||
<string name="spatial_fit_ready">Cocok dengan %1$.2f piksel. Ukur jarak yang Anda pilih dari kamera kiri ke pusat target kalibrasi, lalu validasi.</string>
|
||||
<string name="spatial_opencv_error">OpenCV tidak tersedia: %1$s</string>
|
||||
<string name="spatial_restored">%1$d tampilan tersimpan dipulihkan. Hitung kalibrasi untuk mencoba ulang, atau mulai rangkaian baru untuk menangkap lebih banyak.</string>
|
||||
<string name="spatial_captured">Diambil %1$d / 24 penayangan. Jaga agar target kalibrasi tetap; pindahkan kacamata pintar untuk tampilan selanjutnya.</string>
|
||||
<string name="spatial_capture_corners">Pengambilan gambar ditolak: %1$d / 12 sudut yang diperlukan terlihat di kedua kamera. Tampilkan lebih banyak target kalibrasi, diamkan, lalu coba lagi.</string>
|
||||
|
||||
@@ -2945,7 +2945,6 @@
|
||||
<string name="spatial_hands_wait_stable">In attesa di un tracciamento stabile della testa; ripristina il centro di tracciamento se richiesto.</string>
|
||||
<string name="spatial_old_frame">L’osservazione tramite telecamera è troppo vecchia; in attesa di un nuovo paio</string>
|
||||
<string name="spatial_fit_ready">Adatta %1$.2f px. Misura la distanza selezionata dalla telecamera sinistra al centro del target di calibrazione, quindi convalida.</string>
|
||||
<string name="spatial_opencv_error">OpenCV non disponibile: %1$s</string>
|
||||
<string name="spatial_restored">%1$d visualizzazioni salvate ripristinate. Calcola la calibrazione per riprovare o avvia un nuovo set per acquisirne di più.</string>
|
||||
<string name="spatial_captured">Acquisito %1$d / 24 visualizzazioni. Mantenere fisso il target di calibrazione; sposta gli occhiali intelligenti per la visualizzazione successiva.</string>
|
||||
<string name="spatial_capture_corners">Acquisizione rifiutata: %1$d / 12 angoli obbligatori visibili in entrambe le telecamere. Mostra una parte maggiore del target di calibrazione, resta fermo e riprova.</string>
|
||||
|
||||
@@ -2886,7 +2886,6 @@
|
||||
<string name="spatial_hands_wait_stable">安定したヘッドトラッキングを待機中。必要に応じてトラッキングセンターをリセットします。</string>
|
||||
<string name="spatial_old_frame">カメラによる観察は古すぎる。新しいペアを待っています</string>
|
||||
<string name="spatial_fit_ready">%1$.2f ピクセルにフィットします。左側のカメラからキャリブレーション ターゲットの中心までの選択した距離を測定し、検証します。</string>
|
||||
<string name="spatial_opencv_error">OpenCV は利用できません: %1$s</string>
|
||||
<string name="spatial_restored">%1$d 個の保存されたビューが復元されました。キャリブレーションを計算して再試行するか、新しいセットを開始してさらにキャプチャします。</string>
|
||||
<string name="spatial_captured">%1$d / 24 ビューをキャプチャしました。キャリブレーションターゲットを固定してください。次のビューのためにスマート グラスを移動します。</string>
|
||||
<string name="spatial_capture_corners">キャプチャが拒否されました: %1$d / 12 個の必須コーナーが両方のカメラに表示されます。キャリブレーション ターゲットをさらに表示し、静止してからもう一度試してください。</string>
|
||||
|
||||
@@ -2817,7 +2817,6 @@
|
||||
<string name="spatial_rejected_wrist">스테레오 또는 모션 검사에 의해 손목 위치가 거부됨</string>
|
||||
<string name="spatial_inconsistent_palm">스테레오 포인트가 감지되었지만 손바닥 형상이 일치하지 않습니다.</string>
|
||||
<string name="spatial_fit_ready">%1$.2f픽셀에 맞춥니다. 왼쪽 카메라에서 보정 대상 중심까지 선택한 거리를 측정한 다음 확인합니다.</string>
|
||||
<string name="spatial_opencv_error">OpenCV를 사용할 수 없습니다: %1$s</string>
|
||||
<string name="spatial_restored">%1$d 저장된 뷰가 복원되었습니다. 다시 시도하려면 보정을 계산하고, 더 많은 것을 캡처하려면 새 세트를 시작하세요.</string>
|
||||
<string name="spatial_captured">캡쳐 %1$d / 조회수 24입니다. 교정 대상을 고정된 상태로 유지하십시오. 다음 보기를 위해 스마트 안경을 이동하세요.</string>
|
||||
<string name="spatial_capture_corners">캡처 거부됨: %1$d / 두 카메라 모두에 12개의 필수 모서리가 표시됩니다. 보정 대상을 더 많이 표시하고 가만히 있다가 다시 시도하세요.</string>
|
||||
|
||||
@@ -2886,7 +2886,6 @@
|
||||
<string name="spatial_hands_wait_stable">Menunggu penjejakan kepala yang stabil; tetapkan semula pusat penjejakan jika diminta</string>
|
||||
<string name="spatial_old_frame">Pemerhatian kamera terlalu lama; menunggu pasangan baru</string>
|
||||
<string name="spatial_fit_ready">Muat %1$.2f px. Ukur jarak pilihan anda dari kamera kiri ke pusat sasaran penentukuran, kemudian sahkan.</string>
|
||||
<string name="spatial_opencv_error">OpenCV tidak tersedia: %1$s</string>
|
||||
<string name="spatial_restored">%1$d paparan yang disimpan dipulihkan. Kira penentukuran untuk mencuba semula, atau mulakan set baharu untuk menangkap lebih banyak lagi.</string>
|
||||
<string name="spatial_captured">Ditangkap %1$d / 24 paparan. Pastikan sasaran penentukuran tetap; alihkan cermin mata pintar untuk paparan seterusnya.</string>
|
||||
<string name="spatial_capture_corners">Tangkapan ditolak: %1$d / 12 sudut yang diperlukan kelihatan dalam kedua-dua kamera. Tunjukkan lebih banyak sasaran penentukuran, tahan diam, kemudian cuba lagi.</string>
|
||||
|
||||
@@ -2913,7 +2913,6 @@
|
||||
<string name="spatial_hands_wait_stable">Venter på stabil hodesporing; tilbakestill sporingssenteret hvis forespurt.</string>
|
||||
<string name="spatial_old_frame">Kameraobservasjon er for gammel; venter på et nytt par</string>
|
||||
<string name="spatial_fit_ready">Fit %1$.2f px. Mål den valgte avstanden fra venstre kamera til kalibreringsmålsenteret, og valider deretter.</string>
|
||||
<string name="spatial_opencv_error">OpenCV utilgjengelig: %1$s</string>
|
||||
<string name="spatial_restored">%1$d lagrede visninger gjenopprettet. Beregn kalibrering for å prøve på nytt, eller start et nytt sett for å fange mer.</string>
|
||||
<string name="spatial_captured">Fanget %1$d / 24 visninger. Hold kalibreringsmålet fast; flytt smartbrillene for neste visning.</string>
|
||||
<string name="spatial_capture_corners">Opptaket avvist: %1$d / 12 nødvendige hjørner synlige i begge kameraene. Vis mer av kalibreringsmålet, hold stille, og prøv på nytt.</string>
|
||||
|
||||
@@ -2911,7 +2911,6 @@
|
||||
<string name="spatial_hands_wait_stable">Wachten op stabiele hoofdtracking; reset het trackingcentrum indien aangevraagd.</string>
|
||||
<string name="spatial_old_frame">Cameraobservatie is te oud; wachtend op een nieuw paar</string>
|
||||
<string name="spatial_fit_ready">Pas %1$.2f px aan. Meet de door u geselecteerde afstand vanaf de linkercamera tot het midden van het kalibratiedoel en valideer vervolgens.</string>
|
||||
<string name="spatial_opencv_error">OpenCV niet beschikbaar: %1$s</string>
|
||||
<string name="spatial_restored">%1$d opgeslagen weergaven hersteld. Bereken de kalibratie om het opnieuw te proberen, of start een nieuwe set om meer vast te leggen.</string>
|
||||
<string name="spatial_captured">Vastgelegd %1$d / 24 weergaven. Houd het kalibratiedoel vast; verplaats de slimme bril voor de volgende weergave.</string>
|
||||
<string name="spatial_capture_corners">Opname afgewezen: %1$d / 12 vereiste hoeken zichtbaar in beide camera\'s. Laat meer van het kalibratiedoel zien, blijf stil staan en probeer het opnieuw.</string>
|
||||
|
||||
@@ -2978,7 +2978,6 @@
|
||||
<string name="spatial_hands_wait_stable">Oczekiwanie na stabilne śledzenie głowy; zresetuj centrum śledzenia, jeśli zostaniesz o to poproszony.</string>
|
||||
<string name="spatial_old_frame">Obserwacja kamerą jest zbyt stara; czekam na świeżą parę</string>
|
||||
<string name="spatial_fit_ready">Dopasuj %1$.2f pikseli. Zmierz wybraną odległość od lewej kamery do środka celu kalibracji, a następnie zatwierdź.</string>
|
||||
<string name="spatial_opencv_error">OpenCV niedostępne: %1$s</string>
|
||||
<string name="spatial_restored">Przywrócono %1$d zapisane widoki. Oblicz kalibrację, aby spróbować ponownie, lub rozpocznij nową serię, aby uchwycić więcej.</string>
|
||||
<string name="spatial_captured">Zarejestrowane widoki: %1$d / 24. Utrzymuj cel kalibracji nieruchomo; przesuń inteligentne okulary, aby uzyskać następny widok.</string>
|
||||
<string name="spatial_capture_corners">Przechwytywanie odrzucone: %1$d / 12 wymaganych rogów widocznych w obu kamerach. Pokaż więcej celu kalibracji, przytrzymaj nieruchomo i spróbuj ponownie.</string>
|
||||
|
||||
@@ -2946,7 +2946,6 @@
|
||||
<string name="spatial_hands_wait_stable">Aguarda rastreio de cabeça estável; reponha o centro de rastreio se solicitado.</string>
|
||||
<string name="spatial_old_frame">A observação da câmara é muito antiga; à espera de um novo par</string>
|
||||
<string name="spatial_fit_ready">Ajustar %1$.2f px. Meça a distância selecionada da câmara esquerda até ao centro do alvo de calibração e valide.</string>
|
||||
<string name="spatial_opencv_error">OpenCV indisponível: %1$s</string>
|
||||
<string name="spatial_restored">%1$d visualizações guardadas restauradas. Calcule a calibração para tentar novamente ou inicie um novo conjunto para captar mais.</string>
|
||||
<string name="spatial_captured">Capturado %1$d/24 visualizações. Mantenha o alvo de calibração fixo; mova os óculos inteligentes para a visualização seguinte.</string>
|
||||
<string name="spatial_capture_corners">Captura rejeitada: %1$d/12 cantos necessários visíveis em ambas as câmaras. Mostre mais do alvo de calibração, mantenha-se imóvel e tente novamente.</string>
|
||||
|
||||
@@ -2946,7 +2946,6 @@
|
||||
<string name="spatial_hands_wait_stable">Aguardando rastreamento de cabeça estável; redefina o centro de rastreamento se solicitado.</string>
|
||||
<string name="spatial_old_frame">A observação da câmera é muito antiga; esperando por um novo par</string>
|
||||
<string name="spatial_fit_ready">Ajustar %1$.2f px. Meça a distância selecionada da câmera esquerda até o centro do alvo de calibração e valide.</string>
|
||||
<string name="spatial_opencv_error">OpenCV indisponível: %1$s</string>
|
||||
<string name="spatial_restored">%1$d visualizações salvas restauradas. Calcule a calibração para tentar novamente ou inicie um novo conjunto para capturar mais.</string>
|
||||
<string name="spatial_captured">Capturado %1$d/24 visualizações. Mantenha o alvo de calibração fixo; mova os óculos inteligentes para a próxima visualização.</string>
|
||||
<string name="spatial_capture_corners">Captura rejeitada: %1$d/12 cantos necessários visíveis em ambas as câmeras. Mostre mais do alvo de calibração, fique imóvel e tente novamente.</string>
|
||||
|
||||
@@ -2947,7 +2947,6 @@
|
||||
<string name="spatial_hands_wait_stable">Se așteaptă o urmărire stabilă a capului; resetează centrul de urmărire dacă este solicitat</string>
|
||||
<string name="spatial_old_frame">Observarea camerei este prea veche; așteptând o pereche proaspătă</string>
|
||||
<string name="spatial_fit_ready">Eroare de calibrare: %1$.2f px. Măsoară distanța selectată de la camera din stânga la centrul țintei de calibrare, apoi validează.</string>
|
||||
<string name="spatial_opencv_error">OpenCV indisponibil: %1$s</string>
|
||||
<string name="spatial_restored">Au fost restaurate %1$d vederi salvate. Calculează calibrarea pentru a reîncerca sau începe un set nou pentru a captura mai multe.</string>
|
||||
<string name="spatial_captured">Captură %1$d / 24 de vizualizări. Păstrează ținta de calibrare fixă; mută ochelarii inteligenți pentru următoarea vizualizare.</string>
|
||||
<string name="spatial_capture_corners">Captură respinsă: %1$d / 12 colțuri necesare sunt vizibile în ambele camere. Arată o porțiune mai mare din ținta de calibrare, stai nemișcat, apoi încearcă din nou.</string>
|
||||
|
||||
@@ -2978,7 +2978,6 @@
|
||||
<string name="spatial_hands_wait_stable">Ожидание стабильного отслеживания головы; сбросьте центр отслеживания, если потребуется.</string>
|
||||
<string name="spatial_old_frame">Камера наблюдения устарела; жду новую пару</string>
|
||||
<string name="spatial_fit_ready">По размеру %1$.2f пикселей. Измерьте выбранное расстояние от левой камеры до центра калибровочной цели, а затем подтвердите.</string>
|
||||
<string name="spatial_opencv_error">OpenCV недоступен: %1$s</string>
|
||||
<string name="spatial_restored">%1$d сохраненные просмотры восстановлены. Рассчитайте калибровку, чтобы повторить попытку, или начните новую настройку, чтобы захватить больше.</string>
|
||||
<string name="spatial_captured">Снято %1$d / 24 просмотра. Держите цель калибровки фиксированной; переместите умные очки для следующего просмотра.</string>
|
||||
<string name="spatial_capture_corners">Захват отклонен: %1$d / 12 требуемых углов видны в обеих камерах. Покажите больше калибровочной цели, задержитесь и повторите попытку.</string>
|
||||
|
||||
@@ -2912,7 +2912,6 @@
|
||||
<string name="spatial_hands_wait_stable">Väntar på stabil huvudspårning; återställ spårningscenter om det begärs.</string>
|
||||
<string name="spatial_old_frame">Kameraobservation är för gammal; väntar på ett nytt par</string>
|
||||
<string name="spatial_fit_ready">Fit %1$.2f px. Mät det valda avståndet från den vänstra kameran till kalibreringsmålets centrum och validera sedan.</string>
|
||||
<string name="spatial_opencv_error">OpenCV inte tillgängligt: %1$s</string>
|
||||
<string name="spatial_restored">%1$d sparade vyer återställda. Beräkna kalibreringen för att försöka igen, eller starta en ny uppsättning för att fånga mer.</string>
|
||||
<string name="spatial_captured">Fångad %1$d / 24 visningar. Håll kalibreringsmålet fixerat; flytta de smarta glasögonen för nästa vy.</string>
|
||||
<string name="spatial_capture_corners">Bilden avvisades: %1$d / 12 nödvändiga hörn synliga i båda kamerorna. Visa mer av kalibreringsmålet, håll stilla och försök sedan igen.</string>
|
||||
|
||||
@@ -2888,7 +2888,6 @@
|
||||
<string name="spatial_hands_wait_stable">กำลังรอการติดตามศีรษะที่เสถียร รีเซ็ตจุดศูนย์กลางการติดตามหากมีการร้องขอ</string>
|
||||
<string name="spatial_old_frame">การสังเกตด้วยกล้องเก่าเกินไป รอคู่ใหม่ครับ</string>
|
||||
<string name="spatial_fit_ready">พอดี %1$.2f พิกเซล วัดระยะทางที่คุณเลือกจากกล้องด้านซ้ายไปยังศูนย์กลางเป้าหมายการสอบเทียบ จากนั้นตรวจสอบ</string>
|
||||
<string name="spatial_opencv_error">OpenCV ไม่พร้อมใช้งาน: %1$s</string>
|
||||
<string name="spatial_captured">ถ่ายแล้ว %1$d / 24 ครั้ง รักษาเป้าหมายการสอบเทียบให้คงที่ เลื่อนแว่นตาอัจฉริยะเพื่อดูมุมมองถัดไป</string>
|
||||
<string name="spatial_capture_corners">การจับภาพถูกปฏิเสธ: %1$d / 12 มุมที่ต้องมองเห็นได้ในกล้องทั้งสองตัว แสดงเป้าหมายการสอบเทียบเพิ่มเติม ให้ค้างไว้แล้วลองอีกครั้ง</string>
|
||||
<string name="spatial_validation_error">การตรวจสอบระยะทางไม่เสร็จสิ้น: %1$s ลองอีกครั้ง</string>
|
||||
|
||||
@@ -2912,7 +2912,6 @@
|
||||
<string name="spatial_hands_wait_stable">Sabit kafa izlemesi bekleniyor; istenirse izleme merkezini sıfırlayın</string>
|
||||
<string name="spatial_old_frame">Kamera gözlemi çok eski; yeni bir çift bekliyorum</string>
|
||||
<string name="spatial_fit_ready">%1$.2f piksele sığdır. Sol kameradan kalibrasyon hedef merkezine kadar seçtiğiniz mesafeyi ölçün ve ardından doğrulayın.</string>
|
||||
<string name="spatial_opencv_error">OpenCV kullanılamıyor: %1$s</string>
|
||||
<string name="spatial_restored">%1$d kayıtlı görünüm geri yüklendi. Yeniden denemek için kalibrasyonu hesaplayın veya daha fazlasını yakalamak için yeni bir set başlatın.</string>
|
||||
<string name="spatial_captured">Yakalandı %1$d / 24 görüntüleme. Kalibrasyon hedefini sabit tutun; Bir sonraki görünüm için akıllı gözlükleri hareket ettirin.</string>
|
||||
<string name="spatial_capture_corners">Yakalama reddedildi: %1$d / 12 gerekli köşe her iki kamerada da görünüyor. Kalibrasyon hedefinin daha fazlasını gösterin, sabit durun ve tekrar deneyin.</string>
|
||||
|
||||
@@ -2980,7 +2980,6 @@
|
||||
<string name="spatial_hands_wait_stable">Очікування стабільного відстеження голови; скиньте центр відстеження, якщо запитується.</string>
|
||||
<string name="spatial_old_frame">Камера спостереження занадто стара; в очікуванні свіжої пари</string>
|
||||
<string name="spatial_fit_ready">Розмістити %1$.2f пікс. Виміряйте вибрану відстань від лівої камери до центру калібрувальної мішені, а потім перевірте.</string>
|
||||
<string name="spatial_opencv_error">OpenCV недоступний: %1$s</string>
|
||||
<string name="spatial_restored">%1$d збережені перегляди відновлено. Обчисліть калібрування, щоб повторити спробу, або почніть новий набір, щоб отримати більше.</string>
|
||||
<string name="spatial_captured">Знято %1$d / 24 перегляди. Тримайте цілі калібрування фіксованими; перемістіть розумні окуляри для наступного перегляду.</string>
|
||||
<string name="spatial_capture_corners">Зйомку відхилено: %1$d / 12 необхідних кутів видно в обох камерах. Покажіть більше калібрувальної мішені, затримайтеся та повторіть спробу.</string>
|
||||
|
||||
@@ -2887,7 +2887,6 @@
|
||||
<string name="spatial_hands_wait_stable">Đang chờ theo dõi đầu ổn định; đặt lại trung tâm theo dõi nếu được yêu cầu</string>
|
||||
<string name="spatial_old_frame">Camera quan sát quá cũ; đang chờ một cặp mới</string>
|
||||
<string name="spatial_fit_ready">Vừa vặn %1$.2f px. Đo khoảng cách đã chọn của bạn từ camera bên trái đến trung tâm mục tiêu hiệu chỉnh, sau đó xác thực.</string>
|
||||
<string name="spatial_opencv_error">OpenCV không có sẵn: %1$s</string>
|
||||
<string name="spatial_restored">%1$d lượt xem đã lưu được khôi phục. Tính toán hiệu chuẩn để thử lại hoặc bắt đầu một bộ mới để thu được nhiều dữ liệu hơn.</string>
|
||||
<string name="spatial_captured">Đã chụp được %1$d / 24 lượt xem. Giữ mục tiêu hiệu chuẩn cố định; di chuyển kính thông minh để xem tiếp theo.</string>
|
||||
<string name="spatial_capture_corners">Ảnh chụp bị từ chối: %1$d / 12 góc bắt buộc hiển thị ở cả hai máy ảnh. Hiển thị thêm mục tiêu hiệu chỉnh, giữ yên rồi thử lại.</string>
|
||||
|
||||
@@ -2885,7 +2885,6 @@
|
||||
<string name="spatial_hands_wait_stable">正在等待稳定的头部追踪;如果需要,请重置追踪中心。</string>
|
||||
<string name="spatial_old_frame">相机观察太旧;等待一双新的</string>
|
||||
<string name="spatial_fit_ready">适合 %1$.2f 像素。测量您选择的从左摄像头到校准目标中心的距离,然后进行验证。</string>
|
||||
<string name="spatial_opencv_error">OpenCV 不可用:%1$s</string>
|
||||
<string name="spatial_restored">%1$d 已恢复保存的视图。计算校准以重试,或开始新的一组以捕获更多。</string>
|
||||
<string name="spatial_captured">已捕获 %1$d / 24 次观看。保持校准目标固定;移动智能眼镜以查看下一个视图。</string>
|
||||
<string name="spatial_capture_corners">捕获被拒绝:%1$d / 12 个必需的角在两个摄像头中均可见。显示更多校准目标,保持不动,然后重试。</string>
|
||||
|
||||
@@ -2885,7 +2885,6 @@
|
||||
<string name="spatial_hands_wait_stable">正在等待穩定的頭部追蹤;如果需要,請重設追蹤中心。</string>
|
||||
<string name="spatial_old_frame">相機觀察太舊;等待一雙新的</string>
|
||||
<string name="spatial_fit_ready">適合 %1$.2f 像素。測量您選擇的從左側攝影機到校準目標中心的距離,然後進行驗證。</string>
|
||||
<string name="spatial_opencv_error">OpenCV 不可用:%1$s</string>
|
||||
<string name="spatial_restored">%1$d 已恢復已儲存的視圖。計算校準以重試,或開始新的一組以捕獲更多。</string>
|
||||
<string name="spatial_captured">已捕獲 %1$d / 24 次觀看。保持校準目標固定;移動智慧眼鏡以查看下一個視圖。</string>
|
||||
<string name="spatial_capture_corners">捕捉被拒絕:%1$d / 12 個必需的角落在兩個攝影機中均可見。顯示更多校準目標,保持不動,然後重試。</string>
|
||||
|
||||
@@ -2885,7 +2885,6 @@
|
||||
<string name="spatial_hands_wait_stable">正在等待穩定的頭部追蹤;如果需要,請重設追蹤中心。</string>
|
||||
<string name="spatial_old_frame">相機觀察太舊;等待一雙新的</string>
|
||||
<string name="spatial_fit_ready">適合 %1$.2f 像素。測量您選擇的從左側攝影機到校準目標中心的距離,然後進行驗證。</string>
|
||||
<string name="spatial_opencv_error">OpenCV 不可用:%1$s</string>
|
||||
<string name="spatial_restored">%1$d 已恢復已儲存的視圖。計算校準以重試,或開始新的一組以捕獲更多。</string>
|
||||
<string name="spatial_captured">已捕獲 %1$d / 24 次觀看。保持校準目標固定;移動智慧眼鏡以查看下一個視圖。</string>
|
||||
<string name="spatial_capture_corners">捕捉被拒絕:%1$d / 12 個必需的角落在兩個攝影機中均可見。顯示更多校準目標,保持不動,然後重試。</string>
|
||||
|
||||
@@ -2541,6 +2541,12 @@
|
||||
<string name="hand_camera_placement">Camera placement</string>
|
||||
<string name="hand_camera_placement_hint">Check that the camera can see you before you play.</string>
|
||||
<string name="hand_camera_check">Check</string>
|
||||
<string name="tracking_pack_title">Hand tracking download</string>
|
||||
<string name="tracking_pack_hint">Hand tracking needs a one-time %1$s download.</string>
|
||||
<string name="tracking_pack_download">Download</string>
|
||||
<string name="tracking_pack_retry">Retry</string>
|
||||
<string name="tracking_pack_downloading">Downloading hand tracking… %1$d%%</string>
|
||||
<string name="tracking_pack_failed">Hand tracking couldn\'t be downloaded. Check your connection and try again.</string>
|
||||
<string name="hand_camera_check_title">Camera placement</string>
|
||||
<string name="hand_camera_how_rear">Stand the device up 1.5 to 2 metres away at about chest height, with the back camera facing you. Then step into view with your hands out.</string>
|
||||
<string name="hand_camera_how_front">Stand the device up 1.5 to 2 metres away at about chest height, with the screen facing you. Then step into view with your hands out.</string>
|
||||
@@ -2936,7 +2942,6 @@
|
||||
<string name="spatial_hands_wait_stable">Waiting for stable head tracking; recenter if requested</string>
|
||||
<string name="spatial_old_frame">Camera observation is too old; waiting for a fresh pair</string>
|
||||
<string name="spatial_fit_ready">Fit %1$.2f px. Measure your selected distance from the left camera to the board center, then validate.</string>
|
||||
<string name="spatial_opencv_error">OpenCV unavailable: %1$s</string>
|
||||
<string name="spatial_restored">%1$d saved views restored. Calculate calibration to retry, or start a new set to capture more.</string>
|
||||
<string name="spatial_captured">Captured %1$d / 24 views. Keep the board fixed; move the glasses for the next view.</string>
|
||||
<string name="spatial_capture_corners">Capture rejected: %1$d / 12 required corners visible in both cameras. Show more of the board, hold still, then try again.</string>
|
||||
|
||||
@@ -45,11 +45,12 @@ class HandTrackingTest {
|
||||
assertEquals(TrackingCameras.REAR, s.side)
|
||||
}
|
||||
|
||||
@Test fun trackingNeedsThePermissionAndACamera() {
|
||||
@Test fun trackingNeedsThePermissionACameraAndTheTrackingPack() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
assertFalse(both.copy(enabled = true).ready)
|
||||
assertTrue(both.copy(enabled = true, permitted = true).ready)
|
||||
assertFalse(HandTracking.Settings(enabled = true, permitted = true).ready)
|
||||
assertFalse(both.copy(enabled = true, downloaded = true).ready)
|
||||
assertFalse(both.copy(enabled = true, permitted = true).ready)
|
||||
assertTrue(both.copy(enabled = true, permitted = true, downloaded = true).ready)
|
||||
assertFalse(HandTracking.Settings(enabled = true, permitted = true, downloaded = true).ready)
|
||||
shadowOf(context).grantPermissions(Manifest.permission.CAMERA)
|
||||
HandTracking.refreshPermission(context)
|
||||
assertTrue(HandTracking.settings.value.permitted)
|
||||
|
||||
@@ -106,7 +106,7 @@ The optional Lite bundle can be rebuilt with `mediapipe==0.10.21` using:
|
||||
python tools/build_hand_lite.py --palm palm_detection_lite.tflite --lite hand_landmark_lite.tflite
|
||||
```
|
||||
|
||||
Source URLs and hashes are in `app/src/main/assets/models/hand_landmarker_lite.provenance.json`.
|
||||
Source URLs and hashes are in `tools/packs/tracking/hand_landmarker_lite.provenance.json`.
|
||||
These changes still need live moving-hand, closed-fist, gesture-continuity, and latency validation.
|
||||
Earlier Lite/normalized-input validation passed 52 focused JVM tests, and bundle rebuild and label-archive reproducibility
|
||||
checks passed. Desktop MediaPipe 0.10.21 inference succeeded on color hand fixtures. All six
|
||||
|
||||
@@ -13,7 +13,7 @@ The base enables experimental hand tracking without requiring every user to repe
|
||||
|
||||
Use the existing optional `droiddeck.vitureSdk` local property with the external VITURE Android SDK 2.4.0. No vendor headers or libraries are checked into the repository. `-PvitureSdkDir=` explicitly builds without the SDK. The ordinary runtime freshness checks remain enabled. Rebuild the ARM64 VR components with `tools/vr/build_windows.py`; its manifest includes `spatialpose_shm.h`.
|
||||
|
||||
The hand pipeline pins MediaPipe Tasks Vision 1.0.0, OpenCV 4.13.0, and the model and SHA-256 recorded in `app/src/main/assets/models/hand_landmarker.provenance.json`. Both Gradle and the inference worker verify the model checksum. CPU inference, the full model, concurrent camera inference, scheduled hand discovery, and automatic input-rate adjustment are the defaults, including after app restarts, reconnects, and provider restarts. **Show diagnostics → GPU hand inference** temporarily enables GPU until the next tracking restart; GPU remains experimental because SteamVR restarts and Vulkan device loss were observed during testing. Diagnostics report the selection as `handGpuEnabled` and the initialized detectors as `handInferenceBackend`; `not initialized` means detector startup has not completed. Sustained performance acceptance remains unresolved.
|
||||
The hand pipeline pins MediaPipe Tasks Vision 1.0.0, OpenCV 4.13.0, and the model and SHA-256 recorded in `tools/packs/tracking/hand_landmarker.provenance.json`. The model, OpenCV and MediaPipe native libraries are downloaded on first use as the tracking pack (`tools/packs`); the pack build and the inference worker verify the model checksum. CPU inference, the full model, concurrent camera inference, scheduled hand discovery, and automatic input-rate adjustment are the defaults, including after app restarts, reconnects, and provider restarts. **Show diagnostics → GPU hand inference** temporarily enables GPU until the next tracking restart; GPU remains experimental because SteamVR restarts and Vulkan device loss were observed during testing. Diagnostics report the selection as `handGpuEnabled` and the initialized detectors as `handInferenceBackend`; `not initialized` means detector startup has not completed. Sustained performance acceptance remains unresolved.
|
||||
|
||||
Hand input starts by copying 500 permille of stereo callbacks, approximately 12.5 pairs per second at the SDK's documented 25 Hz camera rate. On CPU, automatic adjustment can raise this to 600 or 800 permille (about 15 or 20 Hz) only after eight consecutive valid observations have sufficient processing and freshness headroom. Promotion requires average processing at most 55 ms and observation age at most 110 ms for 15 Hz, then at most 40 ms and 90 ms for 20 Hz. A moving average allows occasional scheduled discovery frames while preserving a sustained processing budget. An average above the selected period reduces the rate; any single processing cost of 80 ms or observation age of 140 ms immediately returns it to 500 permille. Tracking failure and detector resets also return it to 500. This policy requests more input only when processing can accommodate it; it does not guarantee that many completed or valid hand updates.
|
||||
|
||||
|
||||
+10
-6
@@ -2,13 +2,18 @@
|
||||
|
||||
## Included
|
||||
|
||||
None of these files ship in the APK. The app downloads them on first use as one tracking pack
|
||||
(`tracking.tar.zst`), built in CI by `tools/packs/build.sh` from the pinned sources
|
||||
below, together with `libopencv_java4.so` and `libmediapipe_tasks_jni.so` taken unchanged from
|
||||
the OpenCV and MediaPipe Maven AARs.
|
||||
|
||||
[MediaPipe](https://github.com/google-ai-edge/mediapipe) Tasks Vision 1.0.0
|
||||
(`com.google.mediapipe:tasks-vision`, shared with the Luma stereo tracking pipeline;
|
||||
copyright Google LLC and the MediaPipe authors, Apache License 2.0, `LICENSE_MEDIAPIPE` here) finds
|
||||
the player's body in each camera frame. It comes from Maven Central with its dependencies
|
||||
(Guava, Flogger, protobuf-javalite and Google's `datatransport`), all Apache-2.0.
|
||||
|
||||
`app/src/main/assets/handtracking/pose_landmarker_lite.task` is MediaPipe's Pose Landmarker (Lite)
|
||||
`pose_landmarker_lite.task` in the tracking pack (below) is MediaPipe's Pose Landmarker (Lite)
|
||||
model, BlazePose GHUM 3D, unchanged from
|
||||
`https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task`
|
||||
(SHA-256 `59929e1d1ee95287735ddd833b19cf4ac46d29bc7afddbbf6753c459690d574a`). Its
|
||||
@@ -16,7 +21,7 @@ model, BlazePose GHUM 3D, unchanged from
|
||||
licenses it under the Apache License 2.0 and lists its limits: one person, up to about 4 metres
|
||||
from the camera, the head in view, and depth that is approximate rather than metric.
|
||||
|
||||
`app/src/main/assets/handtracking/hand_landmarker.task` is MediaPipe's Hand Landmarker (full) model
|
||||
`hand_landmarker.task` in the tracking pack is MediaPipe's Hand Landmarker (full) model
|
||||
bundle, a palm detector and a hand landmark model, unchanged from
|
||||
`https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task`
|
||||
(SHA-256 `fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1`). Its
|
||||
@@ -24,14 +29,13 @@ bundle, a palm detector and a hand landmark model, unchanged from
|
||||
licenses it under the Apache License 2.0; it gives 21 landmarks per hand in the picture and in metres,
|
||||
based on the GHUM hand model, and is meant for prominently shown hands.
|
||||
|
||||
The Luma stereo pipeline defaults to the Full bundle at
|
||||
`app/src/main/assets/models/hand_landmarker.task`, with the same checksum as the Full bundle
|
||||
above. The optional `app/src/main/assets/models/hand_landmarker_lite.task` is built from
|
||||
The Luma stereo pipeline defaults to the same Full bundle. The optional
|
||||
`hand_landmarker_lite.task` is built from
|
||||
the official `palm_detection_lite.tflite` and `hand_landmark_lite.tflite` assets at
|
||||
`https://storage.googleapis.com/mediapipe-assets/`. It uses the matching tensor metadata and
|
||||
associated labels from the Full task bundle. These models share the MediaPipe hand tracking
|
||||
model card and Apache License 2.0. Source checksums and the generated bundle checksum are in
|
||||
`app/src/main/assets/models/hand_landmarker_lite.provenance.json`; `tools/build_hand_lite.py`
|
||||
`tools/packs/tracking/hand_landmarker_lite.provenance.json`; `tools/build_hand_lite.py`
|
||||
reproduces the bundle with MediaPipe 0.10.21 metadata tooling.
|
||||
|
||||
[CameraX](https://developer.android.com/jetpack/androidx/releases/camera) 1.4.2
|
||||
|
||||
@@ -61,9 +61,9 @@ def build(full, lite, palm, output):
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--full', type=Path, default=Path('app/src/main/assets/models/hand_landmarker.task'))
|
||||
parser.add_argument('--full', type=Path, required=True)
|
||||
parser.add_argument('--lite', type=Path, required=True, help='Pinned hand_landmark_lite.tflite from storage.googleapis.com/mediapipe-assets/')
|
||||
parser.add_argument('--palm', type=Path, required=True, help='Pinned palm_detection_lite.tflite from storage.googleapis.com/mediapipe-assets/')
|
||||
parser.add_argument('--output', type=Path, default=Path('app/src/main/assets/models/hand_landmarker_lite.task'))
|
||||
parser.add_argument('--output', type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
build(args.full, args.lite, args.palm, args.output)
|
||||
@@ -364,6 +364,7 @@ if ! restore_step comet "${comet_key}" "${comet_out}"; then
|
||||
DROIDDECK_BUILD_IMAGE="${image_name}" bash tools/comet/build-local.sh
|
||||
save_step comet "${comet_key}" "${comet_out}"
|
||||
fi
|
||||
bash tools/packs/build.sh app/build/packs
|
||||
python3 tools/release/runtime_inputs.py record
|
||||
./gradlew "${gradle_task}" --console=plain -PndkVersion="${ndk_version}" ${gradle_rust_arg}
|
||||
python3 tools/release/check_session_assets.py "app/build/outputs/apk/${build_variant}/app-${build_variant}.apk"
|
||||
|
||||
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds the add-on packs the app downloads on first use instead of shipping in the APK:
|
||||
# proot.tar.zst the patched proot and its loader (built by tools/proot)
|
||||
# directaudio.tar.zst the Wine DirectAudio drivers (fetched by tools/directaudio/fetch.sh)
|
||||
# tracking.tar.zst hand-tracking models and the OpenCV/MediaPipe native libraries
|
||||
# xbox.tar.zst the Xbox backend (built by tools/xbox) for /usr/local/lib/droiddeck-xbox
|
||||
# comet.tar.zst the GOG Galaxy companion (built by tools/comet) for /usr/local/lib/droiddeck-comet
|
||||
# Only CI publishes these (.github/workflows/publish-packs.yml); the APK built from the same
|
||||
# directory pins each pack's SHA-256.
|
||||
# Usage: tools/packs/build.sh <out-dir>
|
||||
set -euo pipefail
|
||||
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
repo=$(cd "$here/../.." && pwd)
|
||||
out=${1:?usage: build.sh <out-dir>}
|
||||
mkdir -p "$out"
|
||||
out=$(cd "$out" && pwd)
|
||||
linuxfs="$repo/app/src/main/assets/linuxfs/usr/local/lib"
|
||||
# shellcheck source=tracking/release.env
|
||||
source "$here/tracking/release.env"
|
||||
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
|
||||
sha256() { if command -v sha256sum >/dev/null; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi; }
|
||||
|
||||
fetch() {
|
||||
local url=$1 expected=$2 dest=$3
|
||||
curl -fsSL --retry 4 -o "$dest" "$url"
|
||||
local actual
|
||||
actual=$(sha256 "$dest")
|
||||
if [ "$actual" != "$expected" ]; then
|
||||
echo "checksum mismatch for $url: $actual" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
pack() {
|
||||
local name=$1 src=$2
|
||||
shift 2
|
||||
for required in "$@"; do
|
||||
[ -f "$src/$required" ] || { echo "$name pack: $src/$required is missing" >&2; exit 1; }
|
||||
done
|
||||
python3 -I - "$src" "$work/$name.tar" <<'EOF'
|
||||
import os, sys, tarfile
|
||||
src, dest = sys.argv[1], sys.argv[2]
|
||||
files = []
|
||||
for base, dirs, names in os.walk(src):
|
||||
dirs.sort()
|
||||
for name in names:
|
||||
path = os.path.join(base, name)
|
||||
if os.path.islink(path) or not os.path.isfile(path):
|
||||
sys.exit(f"{path}: only regular files can be packed")
|
||||
files.append(os.path.relpath(path, src))
|
||||
with tarfile.open(dest, "w", format=tarfile.USTAR_FORMAT) as tar:
|
||||
for rel in sorted(files):
|
||||
path = os.path.join(src, rel)
|
||||
info = tar.gettarinfo(path, arcname=rel)
|
||||
info.mtime, info.uid, info.gid, info.uname, info.gname = 0, 0, 0, "", ""
|
||||
info.mode = 0o755 if os.stat(path).st_mode & 0o111 else 0o644
|
||||
with open(path, "rb") as f:
|
||||
tar.addfile(info, f)
|
||||
EOF
|
||||
zstd -q -19 -f "$work/$name.tar" -o "$out/$name.tar.zst"
|
||||
echo "$name $(sha256 "$out/$name.tar.zst") $(wc -c < "$out/$name.tar.zst" | tr -d ' ')"
|
||||
}
|
||||
|
||||
mkdir "$work/tracking"
|
||||
fetch "https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task" \
|
||||
fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1 "$work/tracking/hand_landmarker.task"
|
||||
fetch "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task" \
|
||||
59929e1d1ee95287735ddd833b19cf4ac46d29bc7afddbbf6753c459690d574a "$work/tracking/pose_landmarker_lite.task"
|
||||
cp "$here/tracking/hand_landmarker_lite.task" "$work/tracking/"
|
||||
[ "$(sha256 "$work/tracking/hand_landmarker_lite.task")" = 173c0f47ecee7e935bd4a1e93aa580756b4180c1307c07d709313e82c28672c8 ] || {
|
||||
echo "checksum mismatch for hand_landmarker_lite.task" >&2; exit 1; }
|
||||
fetch "https://repo1.maven.org/maven2/org/opencv/opencv/${OPENCV_VERSION}/opencv-${OPENCV_VERSION}.aar" \
|
||||
"$OPENCV_AAR_SHA256" "$work/opencv.aar"
|
||||
fetch "https://dl.google.com/dl/android/maven2/com/google/mediapipe/tasks-core/${MEDIAPIPE_VERSION}/tasks-core-${MEDIAPIPE_VERSION}.aar" \
|
||||
"$MEDIAPIPE_AAR_SHA256" "$work/tasks-core.aar"
|
||||
unzip -q -j "$work/opencv.aar" jni/arm64-v8a/libopencv_java4.so -d "$work/tracking"
|
||||
unzip -q -j "$work/tasks-core.aar" jni/arm64-v8a/libmediapipe_tasks_jni.so -d "$work/tracking"
|
||||
chmod 0644 "$work/tracking"/*
|
||||
|
||||
mkdir "$work/proot"
|
||||
install -m755 "$repo/app/src/main/jniLibs/arm64-v8a/libproot.so" "$repo/app/src/main/jniLibs/arm64-v8a/libproot-loader.so" "$work/proot/"
|
||||
pack proot "$work/proot" libproot.so libproot-loader.so
|
||||
pack directaudio "$repo/app/src/main/assets/directaudio" \
|
||||
linux-wine11/version.txt linux-wine11-systhread/version.txt
|
||||
pack tracking "$work/tracking" hand_landmarker.task hand_landmarker_lite.task pose_landmarker_lite.task \
|
||||
libopencv_java4.so libmediapipe_tasks_jni.so
|
||||
pack xbox "$linuxfs/droiddeck-xbox" version xodus-cli xodus-service
|
||||
pack comet "$linuxfs/droiddeck-comet" version comet
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,4 @@
|
||||
OPENCV_VERSION=4.13.0
|
||||
OPENCV_AAR_SHA256=a8c9b0929d8d6367bb476320a1f36587db2b57ea18d8f7521ce509514903ca04
|
||||
MEDIAPIPE_VERSION=1.0.0
|
||||
MEDIAPIPE_AAR_SHA256=609c6fcfe59f58c9739194f65ae5882281c327710e1a616aa7f533a4d9238ca3
|
||||
@@ -12,6 +12,14 @@ from zipfile import ZipFile
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
MANIFEST = Path('app/build/runtime-inputs.json')
|
||||
PACKS = Path('app/build/packs')
|
||||
# Runtime trees shipped as add-on packs (tools/packs/build.sh) rather than inside the APK.
|
||||
PACKED = {'assets/linuxfs/usr/local/lib/droiddeck-xbox/': 'xbox', 'assets/linuxfs/usr/local/lib/droiddeck-comet/': 'comet',
|
||||
'assets/directaudio/': 'directaudio'}
|
||||
PACKED_FILES = {'lib/arm64-v8a/libproot.so': ('proot', 'libproot.so'),
|
||||
'lib/arm64-v8a/libproot-loader.so': ('proot', 'libproot-loader.so')}
|
||||
PACKED_LIBRARIES = ['lib/arm64-v8a/libopencv_java4.so', 'lib/arm64-v8a/libmediapipe_tasks_jni.so']
|
||||
PACK_NAMES = ['proot', 'directaudio', 'tracking', 'xbox', 'comet']
|
||||
SOURCE_PATHS = ['app/build.gradle', 'app/src/main/cpp/fakeinput_steam.cpp', 'app/src/main/assets/pulseaudio.tzst',
|
||||
'tools/linuxfs', 'tools/proot', 'tools/aaudio-sink', 'tools/directaudio',
|
||||
'tools/gamescope/release.env', 'tools/droiddeck-esync/release.env',
|
||||
@@ -157,10 +165,49 @@ def verify(root=ROOT):
|
||||
return data
|
||||
|
||||
|
||||
def pack_digests(root, name):
|
||||
path = root / PACKS / (name + '.tar.zst')
|
||||
if not path.is_file():
|
||||
raise ValueError('Missing add-on pack ' + name + '. Run tools/packs/build.sh app/build/packs.')
|
||||
process = subprocess.Popen(['zstd', '-dc', str(path)], stdout=subprocess.PIPE)
|
||||
digests = {}
|
||||
try:
|
||||
with tarfile.open(fileobj=process.stdout, mode='r|') as archive:
|
||||
for member in archive:
|
||||
if member.isfile():
|
||||
digests[member.name] = hashlib.sha256(archive.extractfile(member).read()).hexdigest()
|
||||
finally:
|
||||
process.stdout.close()
|
||||
if process.wait():
|
||||
raise ValueError('Invalid add-on pack ' + name)
|
||||
return digests
|
||||
|
||||
|
||||
def check_apk(apk, root=ROOT):
|
||||
data = verify(root)
|
||||
packs = {name: pack_digests(root, name) for name in PACK_NAMES}
|
||||
with ZipFile(apk) as package:
|
||||
names = set(package.namelist())
|
||||
for library in PACKED_LIBRARIES:
|
||||
if library in names:
|
||||
raise ValueError('APK still carries ' + library + ', which the tracking pack provides')
|
||||
if library.rsplit('/', 1)[1] not in packs['tracking']:
|
||||
raise ValueError('Tracking pack missing ' + library)
|
||||
for name, output in data['outputs'].items():
|
||||
if name in PACKED_FILES:
|
||||
pack, rel = PACKED_FILES[name]
|
||||
if name in names:
|
||||
raise ValueError('APK still carries ' + name + ', which the ' + pack + ' pack provides')
|
||||
if packs[pack].get(rel) != output['sha256']:
|
||||
raise ValueError('Add-on pack ' + pack + ' is missing or has a stale ' + name)
|
||||
continue
|
||||
prefix = next((p for p in PACKED if name.startswith(p)), None)
|
||||
if prefix:
|
||||
if name in names:
|
||||
raise ValueError('APK still carries ' + name + ', which the ' + PACKED[prefix] + ' pack provides')
|
||||
if packs[PACKED[prefix]].get(name[len(prefix):]) != output['sha256']:
|
||||
raise ValueError('Add-on pack ' + PACKED[prefix] + ' is missing or has a stale ' + name)
|
||||
continue
|
||||
try:
|
||||
content = package.read(name)
|
||||
except KeyError:
|
||||
|
||||
@@ -29,6 +29,32 @@ class RuntimeInputsTest(unittest.TestCase):
|
||||
self.source.parent.mkdir(parents=True)
|
||||
self.source.write_text('current source')
|
||||
self.audio(['pactl', 'modules/arm64/module-aaudio-sink.so', 'modules/arm64/module-directaudio-native-sink.so'])
|
||||
self.packs()
|
||||
|
||||
def pack(self, name, files):
|
||||
stream = io.BytesIO()
|
||||
with tarfile.open(fileobj=stream, mode='w') as archive:
|
||||
for rel, content in files.items():
|
||||
entry = tarfile.TarInfo(rel)
|
||||
entry.size = len(content)
|
||||
archive.addfile(entry, io.BytesIO(content))
|
||||
path = self.root / runtime.PACKS / (name + '.tar.zst')
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_bytes(subprocess.run(['zstd', '-q', '-c'], input=stream.getvalue(), capture_output=True, check=True).stdout)
|
||||
|
||||
def packs(self):
|
||||
self.pack('tracking', {library.rsplit('/', 1)[1]: b'library' for library in runtime.PACKED_LIBRARIES})
|
||||
proot = {}
|
||||
for name, (pack, rel) in runtime.PACKED_FILES.items():
|
||||
proot[rel] = (self.root / runtime.outputs(self.root)[name]).read_bytes()
|
||||
self.pack('proot', proot)
|
||||
for prefix, name in runtime.PACKED.items():
|
||||
base = self.root / 'app/src/main' / prefix
|
||||
self.pack(name, {path.relative_to(base).as_posix(): path.read_bytes() for path in base.rglob('*') if path.is_file()})
|
||||
|
||||
@staticmethod
|
||||
def in_apk(name):
|
||||
return name not in runtime.PACKED_FILES and not any(name.startswith(prefix) for prefix in runtime.PACKED)
|
||||
|
||||
def audio(self, names):
|
||||
stream = io.BytesIO()
|
||||
@@ -40,6 +66,11 @@ class RuntimeInputsTest(unittest.TestCase):
|
||||
path = self.root / 'app/build/prepared-assets/pulseaudio.tzst'
|
||||
path.write_bytes(subprocess.run(['zstd', '-q', '-c'], input=stream.getvalue(), capture_output=True, check=True).stdout)
|
||||
|
||||
def test_an_apk_still_carrying_proot_is_rejected(self):
|
||||
apk = self.current_apk(self.root / 'bundled.apk', {'lib/arm64-v8a/libproot.so': b'prepared runtime'})
|
||||
with self.assertRaisesRegex(ValueError, 'proot pack provides'):
|
||||
runtime.check_apk(apk, self.root)
|
||||
|
||||
def test_missing_proot_cannot_be_attested(self):
|
||||
(self.root / 'app/src/main/jniLibs/arm64-v8a/libproot.so').unlink()
|
||||
with self.assertRaisesRegex(ValueError, 'libproot.so'):
|
||||
@@ -82,6 +113,8 @@ class RuntimeInputsTest(unittest.TestCase):
|
||||
apk = self.root / 'old.apk'
|
||||
with ZipFile(apk, 'w') as package:
|
||||
for name, output in data['outputs'].items():
|
||||
if not self.in_apk(name):
|
||||
continue
|
||||
content = b'stale' if name == 'assets/linuxfs/libssbs.so' else (self.root / output['path']).read_bytes()
|
||||
package.writestr(name, content)
|
||||
with self.assertRaisesRegex(ValueError, 'stale runtime input'):
|
||||
@@ -93,9 +126,43 @@ class RuntimeInputsTest(unittest.TestCase):
|
||||
apk = self.root / 'current.apk'
|
||||
with ZipFile(apk, 'w') as package:
|
||||
for name, output in data['outputs'].items():
|
||||
package.writestr(name, (self.root / output['path']).read_bytes())
|
||||
if self.in_apk(name):
|
||||
package.writestr(name, (self.root / output['path']).read_bytes())
|
||||
runtime.check_apk(apk, self.root)
|
||||
|
||||
def current_apk(self, path, extra=None):
|
||||
runtime.record(self.root)
|
||||
data = runtime.verify(self.root)
|
||||
with ZipFile(path, 'w') as package:
|
||||
for name, output in data['outputs'].items():
|
||||
if self.in_apk(name):
|
||||
package.writestr(name, (self.root / output['path']).read_bytes())
|
||||
for name, content in (extra or {}).items():
|
||||
package.writestr(name, content)
|
||||
return path
|
||||
|
||||
def test_an_apk_still_carrying_a_packed_tree_is_rejected(self):
|
||||
apk = self.current_apk(self.root / 'bundled.apk', {'assets/linuxfs/usr/local/lib/droiddeck-xbox/xodus-cli': b'prepared runtime'})
|
||||
with self.assertRaisesRegex(ValueError, 'xbox pack provides'):
|
||||
runtime.check_apk(apk, self.root)
|
||||
|
||||
def test_an_apk_still_carrying_tracking_libraries_is_rejected(self):
|
||||
apk = self.current_apk(self.root / 'bundled.apk', {runtime.PACKED_LIBRARIES[0]: b'library'})
|
||||
with self.assertRaisesRegex(ValueError, 'tracking pack provides'):
|
||||
runtime.check_apk(apk, self.root)
|
||||
|
||||
def test_a_stale_pack_is_rejected(self):
|
||||
apk = self.current_apk(self.root / 'current.apk')
|
||||
self.pack('comet', {'comet': b'old build', 'version': b'old'})
|
||||
with self.assertRaisesRegex(ValueError, 'comet is missing or has a stale'):
|
||||
runtime.check_apk(apk, self.root)
|
||||
|
||||
def test_a_missing_pack_is_rejected(self):
|
||||
apk = self.current_apk(self.root / 'current.apk')
|
||||
(self.root / runtime.PACKS / 'xbox.tar.zst').unlink()
|
||||
with self.assertRaisesRegex(ValueError, 'Missing add-on pack xbox'):
|
||||
runtime.check_apk(apk, self.root)
|
||||
|
||||
def test_windows_manifest_matches_portable_apk_paths(self):
|
||||
path_type = type(self.root)
|
||||
original_relative_to = path_type.relative_to
|
||||
@@ -114,6 +181,8 @@ class RuntimeInputsTest(unittest.TestCase):
|
||||
apk = self.root / 'portable.apk'
|
||||
with ZipFile(apk, 'w') as package:
|
||||
for name, output in data['outputs'].items():
|
||||
if not self.in_apk(name):
|
||||
continue
|
||||
self.assertNotIn('\\', name)
|
||||
self.assertNotIn('\\', output['path'])
|
||||
package.writestr(name, (self.root / output['path']).read_bytes())
|
||||
@@ -125,6 +194,8 @@ class RuntimeInputsTest(unittest.TestCase):
|
||||
apk = self.root / 'expanded.apk'
|
||||
with ZipFile(apk, 'w') as package:
|
||||
for name, output in data['outputs'].items():
|
||||
if not self.in_apk(name):
|
||||
continue
|
||||
content = (self.root / output['path']).read_bytes()
|
||||
if name.endswith('.gzip'):
|
||||
name = name.removesuffix('.gzip')
|
||||
|
||||
Reference in new issue
Block a user