Compare commits

..
Author SHA1 Message Date
The412Banner a034d1f0b6 Stores: keep a sealed sign-in through a transient Keystore failure
Only a file that can never open is deleted: bad GCM tag, a permanently
invalidated or missing key, or no envelope. Any other Keystore or I/O
failure keeps the file, leaves the store signed in but unavailable (its
actions say the sign-in could not be read), logs once and retries on the
next access.
2026-10-09 14:23:59 -04:00
The412Banner c248d3e1c4 Stores: seal sign-in files with an Android Keystore key
credentials.json for GOG, Epic and Amazon is an AES-256-GCM envelope
({"v":1,"alg":"AES/GCM","iv","ct"}) under a non-exportable AndroidKeyStore
key (StrongBox if present, else TEE, no user authentication). StoreAccounts
stays the one layer every reader and writer uses.

A plain file from an earlier build is sealed at start, verified, then
replaced. Without a Keystore the file stays plain (logged once, retried next
start); a file that no longer opens is deleted and the store reads as signed
out.
2026-10-09 14:14:46 -04:00
The412Banner 38e3fa2a33 Logs: every log in app-private storage, shared as one scrubbed zip (#484)
Session folders, tool and installer logs and the stores' log now all live under the
app's private files/logs instead of Download/DroidDeck, and every existing "Share
logs" action bundles them into one zip that goes through a final scrub.

- Where: LinuxRuntime.logDir() = files/logs; sessions keep their dated folders and
  30-session pruning, tools/ and stores/ beside them. The "Logs" setting keeps its
  meaning. Game save backups stay in Download/DroidDeck/Saves.
- Migration: at first start the old session folders, tools/ and loose logs move from
  Download/DroidDeck into files/logs (Saves untouched), and every moved folder is
  scrubbed under the current rules.
- Scrubbing: one rule set (SecretScrub) for the stores' log and the zip. The scrub
  marker carries the rules version, so a rules change re-scrubs every folder at the
  next start (in the background, a few at a time). Steam login account names and
  emails, account-name fields, OAuth codes, tokens in URLs and private LAN
  addresses are removed; Windows exception codes and server addresses are kept.
- Share: one zip of the current session folder plus the last 7 days of stores/ and
  tools/, written to cache/share and handed to the share sheet.
2026-10-09 13:28:03 -04:00
The412Banner 8e1a676f19 Windows components: lay out installer .exe wrappers without running them (#480)
* Windows components: lay out installer .exe wrappers without running them

The components page could only take .msi packages apart; most catalog entries ship an
installer .exe, so VC++ runtimes, .NET Framework 4.0-4.8 and the .NET Core/5+ runtimes sat
under 'Need a Windows installer'. droiddeck-msi-install now opens those wrappers and lays
out the packages inside the same way:

- WiX bundles (Visual C++ 2012-2022, .NET Core/5+ desktop runtimes): the .wixburn section
  names the containers, each a cabinet found by its header (signing moves them); payloads
  get the names the bundle manifest lists, so each package finds its cab1.cab beside it.
  ARM64 packages are skipped, x86 and x64 both laid out.
- Self-extracting cabinets (Visual C++ 2005-2010): cabextract, external cabinet beside the
  package (vc_red.cab).
- Self-extracting 7-Zip archives (.NET Framework 4.0-4.8): 7-Zip, now bundled with the
  msitools (Arch Linux ARM 7zip 26.04: 7z + its 7z.so plugin, licences beside the others).
  The complete product (netfx_Full_*) wins over the 4.0 parts and the per-Windows copies.
- An .exe that is its own setup program (NSIS, InnoSetup) reports that it holds no package.
- --unpack opens an archive for the app: DirectX's redistributable for XACT's cabinet picks.

The app executes the remaining catalog steps offline: set_windows (HKCU\Software\Wine
Version), set_register_key, get_from_cab (through --unpack) and 'uninstall Wine Mono' (the
mscoree override beside it is what matters), and reads url/file_name the catalog nests under
'environment' on a few .NET entries. Setup-program installers stay in the waiting section
with a note that says what they are.

Verified on this branch's engine with msitools, cabextract and 7z: VC++ 2010 x64 (19 files,
61 values), VC++ 2022 x64 bundle (26 files, 66 values), .NET 4.0 (1053 files, 6056 values,
Framework64\v4.0.30319 with clr.dll and mscorlib.dll, NDP\v4 keys) and .NET 4.8 (1633
files, 522 GAC assemblies, 6495 values). Not yet run on a device.

* Windows components: the pressed row greys out and shows its own two-step progress bar

Pressing a switch now greys that row at once and runs a thin bar across it: the download
0..100, then the install 0..100, with a caption naming the file or the stage (a dependency's
name in front while that installs first). Turning a component off greys the row the same way
until the pick is saved. The page-wide bar at the bottom is gone; Done waits on the busy row.

droiddeck-msi-install reports how far along it is ('progress 37% placing files'): reading,
each cabinet, every 5% of files placed, the registry, done - and a wrapper maps each package
into its share, so a bundle's two packages run 10..55 and 55..100. The app parses the percent
and passes a typed Progress (component, stage, phase, percent) up to the editor.

* Windows components: the ones turned on sort to the top of the list

In 'All components' the picks for this game come first, in their usual alphabetical order
among themselves; turning one off returns it to its place. The row moves once the install has
finished and the pick is saved, not while its progress bar is running.

* Windows components: an 'Installed for this game' section under the recommendations

What is turned on for this game gets its own section between Recommended and All components,
alphabetical; the recommendations stay where they are (a recommended pick stays there). A
component in the section leaves All components, and goes back to its place when turned off.
LB/RB jump through the new section too.
2026-10-09 12:36:05 -04:00
The412Banner 7c946db440 Stores: GOG, Epic Games and Amazon Games libraries, installs and cloud saves (#476)
A Stores section (rail, under Games; Setup › Stores gate) with each store's sign-in,
library, storefront shelves and a download queue. Each store has two tabs, Store and
Library, and Library filters to All or Installed; libraries open from a saved copy
and refresh in the background, with install sizes on every card. Games install to internal storage,
or a card chosen at Install time, and are registered in the Steam client as non-Steam
games, so they launch through Steam and droiddeck-proton from either the front end or
the client.

- Downloads: GOG, Epic and Amazon engines in Rust (app/src/main/rust/stores, built by
  cargo-ndk, nothing compiled in the tree). One adaptive fetch core with a latency
  brake, stalled-host handoff and every CDN a store offers. Per-stage progress,
  pause/resume, two-step cancel that deletes, failed downloads kept for retry, a
  foreground service with Wi-Fi and wake locks and notification controls.
- Games tab: store source chips (Steam, GOG, Epic, Amazon, Custom) and store art.
- Epic: per-launch exchange code from the app and from Steam's Play button,
  "Epic sign-in (EOS)", "Launch offline", and a game's web links opened in Android's
  browser for EOS consent. The EOS overlay crashed games and is left out.
- Cloud saves (GOG, Epic): pulled before launch, pushed after the game or the session
  ends, no upload before a first download, conflicts never overwritten, backups both
  ways.
- Logs: every store line redacted; the engine log goes to daily files.
2026-10-09 11:08:17 -04:00
Kurt Himebauch eaf26c8a20 feat: replace the LXQt desktop with SteamOS-style KDE Plasma (#473)
* feat: replace the LXQt desktop with SteamOS-style KDE Plasma

* feat: leaving the KDE desktop logs out through Plasma and returns to gaming mode

* feat: DroidDeck logo wallpaper as the KDE desktop default

* feat: build the KDE wallpaper from the DroidDeck mark artwork

* ci: keep the built desktop package as a short-lived artifact for device testing

* fix: the desktop loading screen no longer promises Steam on the desktop

* docs: the output resize comments name the desktop's KWin

* fix: the desktop package verifies every package's Arch Linux ARM signature and never replaces a published tag

* fix: programs sent to the GPU from the desktop drop its software rendering overrides

* fix: an interrupted desktop install no longer counts as installed

* feat: pin the desktop package to its DroidDeck-Components release instead of the catalog
2026-10-09 10:39:50 -04:00
Magarto 0a96767657 Desktop: keep the session when the big cores cannot be pinned (#394) 2026-10-09 07:13:57 -04:00
SG3xHERO 32054e156e Add a Follow screen resolution for foldables (#403) 2026-10-09 07:13:06 -04:00
Kurt Himebauch fd6d6b7c46 fix: proot fast path hands opendir of a directory symlink to proot (#454) 2026-10-09 07:11:09 -04:00
Kurt Himebauch c101a451e3 perf: fast path answers Steam's pre-2.33 stat calls and stays off without the patched proot (#466) 2026-10-09 03:14:29 +00:00
Kurt Himebauch a76ba69217 fix: runtime removal never strands an undeletable leftover (#463) 2026-10-08 21:39:00 -04:00
The412BannerandThe412Banner d06caf9838 Desktop: Firefox skips shared-memory seals again (Android 16 tab crash) (#460)
Desktop: Firefox skips shared-memory seals again (Android 16 tab crash, #280 line lost in #252)

Co-authored-by: The412Banner <the412banner@users.noreply.github.com>
2026-10-08 19:45:44 -04:00
142 changed files with 4195 additions and 1445 deletions

No files matched your search

+80
View File
@@ -0,0 +1,80 @@
name: Build desktop package (KDE Plasma)
# The desktop the app installs into its Linux runtime on first use: KDE Plasma as SteamOS's desktop
# mode has it, the closure of tools/desktop-kde/seeds.txt over Arch Linux ARM minus what the runtime
# already carries, plus tools/desktop-kde/overlay (tools/desktop-kde/build.sh), every package
# signature-checked. Published as a release in Droid-Deck/DroidDeck-Components with DroidDeck's
# other components; the apk pins it in tools/desktop-kde/release.env (tag, sha256, size). A
# published tag is never rebuilt: the packages are Arch Linux ARM's current ones, so a rebuild
# would not match the pinned sha256. A changed package gets a new tag (desktop-kde-r2, ...) and a
# release.env update.
on:
push:
paths:
- 'tools/desktop-kde/**'
- '.github/workflows/build-desktop-kde.yml'
workflow_dispatch:
inputs:
tag:
description: 'Release tag to publish as (e.g. desktop-kde-r1); empty = artifact only'
required: false
default: ''
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- uses: actions/create-github-app-token@v2
id: components-token
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
with:
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
owner: Droid-Deck
repositories: DroidDeck-Components
- name: Refuse a published tag
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
env:
GH_TOKEN: ${{ steps.components-token.outputs.token }}
run: |
if gh release view '${{ inputs.tag }}' -R Droid-Deck/DroidDeck-Components >/dev/null 2>&1; then
echo "::error::${{ inputs.tag }} is already published, and published tags are never replaced: use a new tag"
exit 1
fi
- name: Build
run: |
set -euo pipefail
sudo apt-get update -qq && sudo apt-get install -y -qq zstd xz-utils gpgv >/dev/null
tools/desktop-kde/build.sh out
echo "size $(stat -c %s out/desktop-kde.tar.zst) sha256 $(cat out/desktop-kde.sha256)"
# The package itself too, briefly: enough to try a build on a device before publishing it.
- uses: actions/upload-artifact@v4
with:
name: desktop-kde
retention-days: 7
compression-level: 0
path: |
out/desktop-kde.tar.zst
out/desktop-kde.packages.txt
out/desktop-kde.sha256
- name: Publish
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
env:
GH_TOKEN: ${{ steps.components-token.outputs.token }}
GH_REPO: Droid-Deck/DroidDeck-Components
run: |
set -euo pipefail
TAG='${{ inputs.tag }}'
if gh release view "$TAG" >/dev/null 2>&1; then
echo "::error::$TAG is already published in DroidDeck-Components, and published tags are never replaced: use a new tag"
exit 1
fi
gh release create "$TAG" --latest=false --prerelease=false --title "$TAG" \
--notes "KDE Plasma desktop package for DroidDeck's Linux runtime ($GITHUB_REPOSITORY tools/desktop-kde, $GITHUB_SHA). size $(stat -c %s out/desktop-kde.tar.zst), sha256 $(cat out/desktop-kde.sha256). desktop-kde.packages.txt lists the signature-checked Arch Linux ARM packages it was built from." \
out/desktop-kde.tar.zst out/desktop-kde.sha256 out/desktop-kde.packages.txt
gh release edit "$TAG" --latest=false --prerelease=false
-49
View File
@@ -1,49 +0,0 @@
name: Build wlroots (patched)
# The desktop's wlroots (Arch Linux ARM's wlroots0.20, what the desktop package's labwc links)
# rebuilt with tools/wlroots/patches: a Vulkan DMA-BUF allocator for the Adreno node, which is not
# a DRM device, so labwc's vulkan and gles2 renderers can start. Built in an Arch Linux ARM
# container on an arm64 runner and published as a release asset the apk build fetches
# (tools/wlroots/release.env names the tag and sha). The hosted desktop package is never changed.
on:
push:
paths:
- 'tools/wlroots/**'
- '.github/workflows/build-wlroots.yml'
workflow_dispatch:
inputs:
tag:
description: 'Release tag to publish as (e.g. wlroots-0.20.2-p1); empty = artifact only'
required: false
default: ''
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-24.04-arm
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Build in Arch Linux ARM
run: |
set -euo pipefail
docker run --rm -v "$PWD:/work" -w /work menci/archlinuxarm:base-devel bash tools/wlroots/build-in-arch.sh
sudo chown -R "$(id -u):$(id -g)" .
- uses: actions/upload-artifact@v4
with:
name: wlroots-patched
path: |
wlroots.tzst
wlroots.tzst.sha256
- name: Publish
if: github.event_name == 'workflow_dispatch' && inputs.tag != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh release create "${{ inputs.tag }}" --latest=false --prerelease=false --title "${{ inputs.tag }}" --notes "wlroots 0.20.2 with tools/wlroots/patches (Vulkan DMA-BUF allocator for non-DRM GPU nodes); staged by the apk at /usr/local/lib/droiddeck-wlroots for the desktop's GPU renderers. sha256 $(cut -d' ' -f1 wlroots.tzst.sha256)" wlroots.tzst wlroots.tzst.sha256 || gh release upload "${{ inputs.tag }}" wlroots.tzst wlroots.tzst.sha256 --clobber
# A component the apk fetches by tag, never something users install: it must not
# become the repo's Latest release or appear as a pre-release, also when re-uploaded.
gh release edit "${{ inputs.tag }}" --latest=false --prerelease=false
+6 -13
View File
@@ -216,14 +216,6 @@ jobs:
test -f "$D/usr/local/bin/gamescope"
rm gamescope.tzst
fi
if [ -f tools/wlroots/release.env ]; then
. tools/wlroots/release.env
gh release download "${WLROOTS_TAG}" -R "${GITHUB_REPOSITORY}" -p wlroots.tzst -O wlroots.tzst
echo "${WLROOTS_SHA256} wlroots.tzst" | sha256sum -c -
tar --use-compress-program=unzstd -xf wlroots.tzst -C "$D"
test -f "$D/usr/local/lib/droiddeck-wlroots/libwlroots-0.20.so"
rm wlroots.tzst
fi
. tools/linuxfs/uruntime.env
curl -fsSL --retry 3 -o uruntime "https://github.com/VHSgunzo/uruntime/releases/download/${URUNTIME_VERSION}/${URUNTIME_ASSET}"
echo "${URUNTIME_SHA256} uruntime" | sha256sum -c -
@@ -262,10 +254,13 @@ jobs:
done
install -m644 msi-pkgs/usr/bin/msiinfo "$T/msiinfo"
install -m644 msi-pkgs/usr/bin/cabextract "$T/cabextract"
# 7-Zip (the full build with its format plugin) opens installer .exe wrappers.
install -m644 msi-pkgs/usr/lib/7zip/7z "$T/7z"
install -m644 msi-pkgs/usr/lib/7zip/7z.so "$T/7z.so"
for so in libmsi-1.0.so.0 libgsf-1.so.114 libgcab-1.0.so.0; do
cp -L "msi-pkgs/usr/lib/$so" "$T/$so"
done
for f in NOTICE GPL-2 GPL-3 LGPL-2.1; do
for f in NOTICE GPL-2 GPL-3 LGPL-2.1 7zip-License 7zip-unRarLicense; do
install -Dm644 "tools/msitools/licenses/$f" "$D/usr/local/share/licenses/droiddeck-msitools/$f"
done
rm -rf msi-pkgs
@@ -273,9 +268,7 @@ jobs:
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop "$D/usr/local/bin/droiddeck-desktop"
install -Dm644 tools/linuxfs/desktop/droiddeck-gpu "$D/usr/local/bin/droiddeck-gpu"
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop-gpu "$D/usr/local/bin/droiddeck-desktop-gpu"
install -Dm644 tools/linuxfs/desktop/autostart "$D/etc/xdg/labwc/autostart"
install -Dm644 tools/linuxfs/desktop/rc.xml "$D/etc/xdg/labwc/rc.xml"
install -Dm644 tools/linuxfs/desktop/panel.conf "$D/etc/xdg/lxqt/panel.conf"
install -Dm644 tools/linuxfs/desktop/kwin_wayland_wrapper "$D/usr/local/bin/kwin_wayland_wrapper"
install -Dm644 tools/linuxfs/desktop/firefox-droiddeck.js "$D/usr/lib/firefox/defaults/pref/droiddeck.js"
ls -lR "$D"
@@ -401,7 +394,7 @@ jobs:
test -f "$D/usr/local/bin/droiddeck-session"
test -f "$D/usr/local/bin/droiddeck-proton-extra"
test -f "$D/usr/local/bin/droiddeck-msi-install"
for f in msiinfo cabextract libmsi-1.0.so.0 libgsf-1.so.114 libgcab-1.0.so.0; do
for f in msiinfo cabextract 7z 7z.so libmsi-1.0.so.0 libgsf-1.so.114 libgcab-1.0.so.0; do
test -f "$D/usr/local/lib/droiddeck-msitools/$f" || { echo "::error::droiddeck-msitools/$f missing"; exit 1; }
done
+2 -2
View File
@@ -21,7 +21,7 @@ Before Steam launches, you must turn off **Restrict child processes** in Develop
## Community
Join the [DroidDeck Discord](https://discord.gg/JRGAvawjsm) for help, Preview builds, and device reports. Bug reports go in its **#bug-reports** forum; attach the session folder from `Download/DroidDeck/` so the logs come with it.
Join the [DroidDeck Discord](https://discord.gg/JRGAvawjsm) for help, Preview builds, and device reports. Bug reports go in its **#bug-reports** forum; attach the zip from **Share logs** (Setup, or the session drawer) so the logs come with it.
## Build
@@ -29,7 +29,7 @@ Run `tools/build_local.sh` with Docker, Java 17, the Android SDK/NDK, and `zstd`
## Limits
Compatibility and performance vary by device; hardware validation is limited. Desktop compositing uses software rendering. Firefox sandboxing is reduced under proot. See the session logs in `Download/DroidDeck/` when diagnosing problems.
Compatibility and performance vary by device; hardware validation is limited. Desktop compositing uses software rendering. Firefox sandboxing is reduced under proot. Logs are kept app-private (`files/logs/`, the last 30 sessions); **Share logs** packs the newest session, with the stores and tool logs, into one scrubbed zip.
## Credits and licence
+10
View File
@@ -59,6 +59,12 @@ def ciBuild = providers.environmentVariable('GITHUB_ACTIONS').getOrNull() == 'tr
def releaseSigner = rootProject.file('keystore/release-signer.sha256').text.trim()
// When the source was committed, for "built 3 hours ago": fixed per commit, so it costs no rebuilds.
def commitTime = (gitValue(['show', '-s', '--format=%ct', 'HEAD']) ?: '0').with { it.isLong() ? it : '0' }
// The desktop package this apk installs (tools/desktop-kde/release.env): published once per tag in
// DroidDeck-Components, pinned here with its checksum like gamescope and the esync packs, so the
// desktop scripts in the apk always get the package they were made for.
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()] }
// tools/release/variants.txt as "package=suffix;...", so the updater picks the apk of the package it runs as.
def variantSuffixes = rootProject.file('tools/release/variants.txt').readLines()
.findAll { it.trim() && !it.startsWith('#') }
@@ -88,6 +94,10 @@ android {
buildConfigField "String", "RELEASE_SIGNER", "\"${releaseSigner}\""
buildConfigField "long", "COMMIT_TIME", "${commitTime}L * 1000L"
buildConfigField "String", "VARIANT_SUFFIXES", "\"${variantSuffixes}\""
buildConfigField "String", "DESKTOP_KDE_TAG", "\"${desktopKde.DESKTOP_KDE_TAG}\""
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"
ndk {
abiFilters 'arm64-v8a'
@@ -17,6 +17,7 @@ add_library(droiddeckwayland SHARED
src/wl_clipboard.c
src/wl_text_input.c
src/wl_toplevel_icon.c
src/wl_single_pixel.c
src/wl_color_mgmt.c
src/hdr_compose.c
src/blend_pass.c
@@ -31,6 +32,7 @@ add_library(droiddeckwayland SHARED
generated/wlr-data-control-unstable-v1-protocol.c
generated/text-input-unstable-v3-protocol.c
generated/xdg-toplevel-icon-v1-protocol.c
generated/single-pixel-buffer-v1-protocol.c
generated/banner-ahb-v1-protocol.c
src/framegen_bridge.c
src/framegen_jni.c
@@ -0,0 +1,61 @@
/* Generated by wayland-scanner 1.26.0 */
/*
* Copyright © 2022 Simon Ser
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
#ifndef __has_attribute
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
#endif
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
#else
#define WL_PRIVATE
#endif
extern const struct wl_interface wl_buffer_interface;
static const struct wl_interface *single_pixel_buffer_v1_types[] = {
&wl_buffer_interface,
NULL,
NULL,
NULL,
NULL,
};
static const struct wl_message wp_single_pixel_buffer_manager_v1_requests[] = {
{ "destroy", "", single_pixel_buffer_v1_types + 0 },
{ "create_u32_rgba_buffer", "nuuuu", single_pixel_buffer_v1_types + 0 },
};
WL_PRIVATE const struct wl_interface wp_single_pixel_buffer_manager_v1_interface = {
"wp_single_pixel_buffer_manager_v1", 1,
2, wp_single_pixel_buffer_manager_v1_requests,
0, NULL,
};
@@ -0,0 +1,142 @@
/* Generated by wayland-scanner 1.26.0 */
#ifndef SINGLE_PIXEL_BUFFER_V1_SERVER_PROTOCOL_H
#define SINGLE_PIXEL_BUFFER_V1_SERVER_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-server.h"
#ifdef __cplusplus
extern "C" {
#endif
struct wl_client;
struct wl_resource;
/**
* @page page_single_pixel_buffer_v1 The single_pixel_buffer_v1 protocol
* single pixel buffer factory
*
* @section page_desc_single_pixel_buffer_v1 Description
*
* This protocol extension allows clients to create single-pixel buffers.
*
* Compositors supporting this protocol extension should also support the
* viewporter protocol extension. Clients may use viewporter to scale a
* single-pixel buffer to a desired size.
*
* Warning! The protocol described in this file is currently in the testing
* phase. Backward compatible changes may be added together with the
* corresponding interface version bump. Backward incompatible changes can
* only be done by creating a new major version of the extension.
*
* @section page_ifaces_single_pixel_buffer_v1 Interfaces
* - @subpage page_iface_wp_single_pixel_buffer_manager_v1 - global factory for single-pixel buffers
* @section page_copyright_single_pixel_buffer_v1 Copyright
* <pre>
*
* Copyright © 2022 Simon Ser
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
* </pre>
*/
struct wl_buffer;
struct wp_single_pixel_buffer_manager_v1;
#ifndef WP_SINGLE_PIXEL_BUFFER_MANAGER_V1_INTERFACE
#define WP_SINGLE_PIXEL_BUFFER_MANAGER_V1_INTERFACE
/**
* @page page_iface_wp_single_pixel_buffer_manager_v1 wp_single_pixel_buffer_manager_v1
* @section page_iface_wp_single_pixel_buffer_manager_v1_desc Description
*
* The wp_single_pixel_buffer_manager_v1 interface is a factory for
* single-pixel buffers.
* @section page_iface_wp_single_pixel_buffer_manager_v1_api API
* See @ref iface_wp_single_pixel_buffer_manager_v1.
*/
/**
* @defgroup iface_wp_single_pixel_buffer_manager_v1 The wp_single_pixel_buffer_manager_v1 interface
*
* The wp_single_pixel_buffer_manager_v1 interface is a factory for
* single-pixel buffers.
*/
extern const struct wl_interface wp_single_pixel_buffer_manager_v1_interface;
#endif
/**
* @ingroup iface_wp_single_pixel_buffer_manager_v1
* @struct wp_single_pixel_buffer_manager_v1_interface
*/
struct wp_single_pixel_buffer_manager_v1_interface {
/**
* destroy the manager
*
* Destroy the wp_single_pixel_buffer_manager_v1 object.
*
* The child objects created via this interface are unaffected.
*/
void (*destroy)(struct wl_client *client,
struct wl_resource *resource);
/**
* create a 1×1 buffer from 32-bit RGBA values
*
* Create a single-pixel buffer from four 32-bit RGBA values.
*
* Unless specified in another protocol extension, the RGBA values
* use pre-multiplied alpha.
*
* The width and height of the buffer are 1.
*
* The r, g, b and a arguments valid range is from UINT32_MIN (0)
* to UINT32_MAX (0xffffffff).
*
* These arguments should be interpreted as a percentage, i.e. -
* UINT32_MIN = 0% of the given color component - UINT32_MAX = 100%
* of the given color component
* @param r value of the buffer's red channel
* @param g value of the buffer's green channel
* @param b value of the buffer's blue channel
* @param a value of the buffer's alpha channel
*/
void (*create_u32_rgba_buffer)(struct wl_client *client,
struct wl_resource *resource,
uint32_t id,
uint32_t r,
uint32_t g,
uint32_t b,
uint32_t a);
};
/**
* @ingroup iface_wp_single_pixel_buffer_manager_v1
*/
#define WP_SINGLE_PIXEL_BUFFER_MANAGER_V1_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_wp_single_pixel_buffer_manager_v1
*/
#define WP_SINGLE_PIXEL_BUFFER_MANAGER_V1_CREATE_U32_RGBA_BUFFER_SINCE_VERSION 1
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="single_pixel_buffer_v1">
<copyright>
Copyright © 2022 Simon Ser
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<description summary="single pixel buffer factory">
This protocol extension allows clients to create single-pixel buffers.
Compositors supporting this protocol extension should also support the
viewporter protocol extension. Clients may use viewporter to scale a
single-pixel buffer to a desired size.
Warning! The protocol described in this file is currently in the testing
phase. Backward compatible changes may be added together with the
corresponding interface version bump. Backward incompatible changes can
only be done by creating a new major version of the extension.
</description>
<interface name="wp_single_pixel_buffer_manager_v1" version="1">
<description summary="global factory for single-pixel buffers">
The wp_single_pixel_buffer_manager_v1 interface is a factory for
single-pixel buffers.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the manager">
Destroy the wp_single_pixel_buffer_manager_v1 object.
The child objects created via this interface are unaffected.
</description>
</request>
<request name="create_u32_rgba_buffer">
<description summary="create a 1×1 buffer from 32-bit RGBA values">
Create a single-pixel buffer from four 32-bit RGBA values.
Unless specified in another protocol extension, the RGBA values use
pre-multiplied alpha.
The width and height of the buffer are 1.
The r, g, b and a arguments valid range is from UINT32_MIN (0)
to UINT32_MAX (0xffffffff).
These arguments should be interpreted as a percentage, i.e.
- UINT32_MIN = 0% of the given color component
- UINT32_MAX = 100% of the given color component
</description>
<arg name="id" type="new_id" interface="wl_buffer"/>
<arg name="r" type="uint" summary="value of the buffer's red channel"/>
<arg name="g" type="uint" summary="value of the buffer's green channel"/>
<arg name="b" type="uint" summary="value of the buffer's blue channel"/>
<arg name="a" type="uint" summary="value of the buffer's alpha channel"/>
</request>
</interface>
</protocol>
+61 -6
View File
@@ -745,6 +745,21 @@ static void take_shm(struct surface *s, struct wl_shm_buffer *shm, struct wl_res
if (ci && ci->asked_feedback) ci->shm_frames++; /* since it asked for GPU buffers */
}
/* A single-pixel buffer (wl_single_pixel.c) as a 1x1 image, which the surface's viewport stretches. */
static void take_pixel(struct surface *s, const uint8_t bgra[4], struct wl_resource *buffer) {
if (s->shm_img && (vkp_image_width(s->shm_img) != 1 || vkp_image_height(s->shm_img) != 1)) {
vkp_image_destroy(s->shm_img);
s->shm_img = NULL;
}
if (!s->shm_img) s->shm_img = vkp_image_create_shm(1, 1);
if (s->shm_img) vkp_image_upload_shm(s->shm_img, bgra, 4);
wl_buffer_send_release(buffer);
s->buf_w = 1;
s->buf_h = 1;
s->buf_alpha = bgra[3] != 0xff;
s->has_content = s->shm_img != NULL;
}
/* The window the app's performance HUD follows: the latest one at least as big as the last to
* start presenting GPU frames (take_dmabuf) (X11 binds the HUD to the _MESA_DRV window and counts X presents instead). JNI upcalls. */
static struct surface *g_hud_surface;
@@ -1084,6 +1099,7 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) {
struct wl_resource *buffer = s->pending_buffer;
struct dmabuf_buffer *db = get_dmabuf(buffer);
struct wl_shm_buffer *shm = buffer && !db ? wl_shm_buffer_get(buffer) : NULL;
uint8_t pixel[4];
/* The previous content is replaced before reaching the screen. */
feedback_discard_all(&s->feedback);
@@ -1113,6 +1129,9 @@ static void surface_commit(struct wl_client *c, struct wl_resource *r) {
} else if (shm) {
drop_dmabuf(s, 1);
take_shm(s, shm, buffer);
} else if (single_pixel_buffer_get(buffer, pixel)) {
drop_dmabuf(s, 1);
take_pixel(s, pixel, buffer);
} else {
drop_dmabuf(s, 1);
s->has_content = 0;
@@ -1661,15 +1680,24 @@ static void bind_desktop(struct wl_client *c, void *data, uint32_t ver, uint32_t
static void output_release(struct wl_client *c, struct wl_resource *r) { wl_resource_destroy(r); }
static const struct wl_output_interface output_impl = { .release = output_release };
static void bind_output(struct wl_client *c, void *data, uint32_t ver, uint32_t id) {
struct wl_resource *r = wl_resource_create(c, &wl_output_interface, ver, id);
if (!r) { wl_client_post_no_memory(c); return; }
wl_resource_set_implementation(r, &output_impl, NULL, NULL);
wl_output_send_geometry(r, 0, 0, 340, 190, WL_OUTPUT_SUBPIXEL_UNKNOWN,
"DroidDeck", "Wayland", WL_OUTPUT_TRANSFORM_NORMAL);
/* Every bound wl_output, so a resized output (a foldable opening) can send its new mode. */
static struct wl_list g_outputs;
static void output_resource_destroy(struct wl_resource *r) { wl_list_remove(wl_resource_get_link(r)); }
static void output_send_mode(struct wl_resource *r) {
wl_output_send_mode(r, WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED,
g_output_w > 0 ? g_output_w : 1920, g_output_h > 0 ? g_output_h : 1080,
g_output_refresh_mhz > 0 ? g_output_refresh_mhz : 60000);
}
static void bind_output(struct wl_client *c, void *data, uint32_t ver, uint32_t id) {
struct wl_resource *r = wl_resource_create(c, &wl_output_interface, ver, id);
if (!r) { wl_client_post_no_memory(c); return; }
wl_resource_set_implementation(r, &output_impl, NULL, output_resource_destroy);
wl_list_insert(&g_outputs, wl_resource_get_link(r));
wl_output_send_geometry(r, 0, 0, 340, 190, WL_OUTPUT_SUBPIXEL_UNKNOWN,
"DroidDeck", "Wayland", WL_OUTPUT_TRANSFORM_NORMAL);
output_send_mode(r);
if (ver >= WL_OUTPUT_NAME_SINCE_VERSION) {
wl_output_send_name(r, "DroidDeck-1");
wl_output_send_description(r, "DroidDeck display");
@@ -3200,6 +3228,23 @@ static void key_event(uint32_t evdev, int pressed) {
wl_display_flush_clients(g_display);
}
/* The output changed size under a running session (a foldable opened or closed, with the
* session following the screen). Every client that has had its first configure is told the new
* size: gamescope's Wayland backend and the desktop's KWin both resize their output to it, and
* the next buffers they commit fill the new panel instead of being letterboxed onto it. */
static void output_resized(void) {
struct surface *s;
struct wl_resource *r;
wl_resource_for_each(r, &g_outputs) {
output_send_mode(r);
if (wl_resource_get_version(r) >= 2) wl_output_send_done(r);
}
wl_list_for_each(s, &g_surfaces, link)
if (s->xdg_toplevel && s->toplevel_committed) send_toplevel_configure(s);
droiddeck_log("display", "output resized to %dx%d", g_output_w, g_output_h);
wl_display_flush_clients(g_display);
}
/* wl event-loop callback: drain queued input events written by the Android UI thread. */
static int on_input_readable(int fd, uint32_t mask, void *data) {
struct input_msg m;
@@ -3212,6 +3257,7 @@ static int on_input_readable(int fd, uint32_t mask, void *data) {
case 5: on_vsync(((int64_t)m.p1 << 32) | (uint32_t)m.p2); break;
case 6: pointer_delta(m.p1 / 256.0, m.p2 / 256.0); break; /* relative motion, 1/256 px */
case 7: deliver_touch(&m); break;
case 8: output_resized(); break;
default: deliver_pointer(&m); break;
}
}
@@ -3242,6 +3288,14 @@ void droiddeck_wayland_send_key(int evdev, int state) {
(void)n;
}
/* Called from JNI after g_output_w/h changed: the compositor thread re-sends the size. */
void droiddeck_wayland_output_resized(void) {
if (g_input_pipe[1] < 0) return;
struct input_msg m = { 8, 0, 0, 0, 0 };
ssize_t n = write(g_input_pipe[1], &m, sizeof(m));
(void)n;
}
/* Called from JNI on every screen refresh (Choreographer). */
void droiddeck_wayland_vsync(int64_t frame_time_ns) {
if (g_input_pipe[1] < 0) return;
@@ -3439,6 +3493,7 @@ static struct wl_listener g_client_created = { .notify = on_client_created };
int droiddeck_wayland_run(void) {
wl_list_init(&g_surfaces);
wl_list_init(&g_toplevels);
wl_list_init(&g_outputs);
wl_list_init(&g_constraints);
wl_list_init(&g_relative_pointers);
open_session_log();
@@ -122,4 +122,5 @@ void droiddeck_ext_init(struct wl_display *display) {
clipboard_init(display);
text_input_init(display);
toplevel_icon_init(display);
single_pixel_init(display);
}
@@ -48,3 +48,6 @@ void text_input_host_commit(const char *utf8, size_t len);
void text_input_host_preedit(const char *utf8, size_t len, int cursor_begin, int cursor_end);
void text_input_host_delete(int before, int after);
void toplevel_icon_init(struct wl_display *display);
void single_pixel_init(struct wl_display *display);
/* A wp_single_pixel_buffer_manager_v1 buffer: 1 and its pixel (B, G, R, A, premultiplied), else 0. */
int single_pixel_buffer_get(struct wl_resource *buffer, uint8_t bgra[4]);
+16 -1
View File
@@ -160,6 +160,11 @@ static const char *vk_result_name(VkResult r);
static pthread_mutex_t g_req_lock = PTHREAD_MUTEX_INITIALIZER;
static ANativeWindow *g_req_window;
static int g_req_pending;
/* A detach was asked for since the compositor thread last looked. A rebind (null, then the same
* window) to rebuild the swapchain at a new size can land in full before the thread gets to it,
* and would otherwise read as the same window handed over again - nothing rebuilt, and the old
* size's buffers scaled onto the rotated or refolded panel. */
static int g_req_detached;
/* Scale mode + alignment (app values, see vk_present.h); written from any thread, read per frame. */
static volatile int g_mode = VKP_MODE_STRETCH, g_align = VKP_ALIGN_CENTER;
@@ -252,6 +257,7 @@ void vk_present_set_window(ANativeWindow *window) {
if (g_req_pending && g_req_window && g_req_window != window) superseded = g_req_window;
g_req_window = window;
g_req_pending = 1;
if (!window) g_req_detached = 1;
pthread_mutex_unlock(&g_req_lock);
if (superseded) ANativeWindow_release(superseded);
}
@@ -261,13 +267,20 @@ int vkp_apply_window_request(void) {
pthread_mutex_lock(&g_req_lock);
if (!g_req_pending) { pthread_mutex_unlock(&g_req_lock); return 0; }
w = g_req_window;
const int detached = g_req_detached;
g_req_window = NULL;
g_req_pending = 0;
g_req_detached = 0;
pthread_mutex_unlock(&g_req_lock);
if (w == g_window) {
/* The same window handed over again (ANativeWindow_fromSurface adds a reference each time). */
if (w) ANativeWindow_release(w);
return 0;
if (!w || !detached) return 0;
/* ... after a detach: a rebind for a resized surface. Rebuilt at its size on the next frame. */
sc_layer_window_gone();
destroy_swapchain();
droiddeck_log("gpu", "screen surface rebound: rebuilding the swapchain at its new size");
return 1;
}
sc_layer_window_gone(); /* the layer (if any) belongs to the old window */
destroy_swapchain(); /* recreated against the new window on the next frame */
@@ -1516,6 +1529,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
const struct vkp_hdr_frame *hf, int *how) {
if (how) *how = 0;
vkp_apply_window_request();
check_surface_changed(); /* a rotation or a fold the rebind did not cover: rebuild at the new size */
if (g_dev_state == -2) return -1;
if (dev_init() != 0 || !g_window || scene_w <= 0 || scene_h <= 0) return -1;
@@ -2099,6 +2113,7 @@ static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draw
const struct vkp_hdr_frame *hf, int *rw, int *rh) {
if (g_pass.active) vkp_pass_abort();
if (g_dev_state == -2 || dev_init() != 0 || !g_window || scene_w <= 0 || scene_h <= 0) return -1;
check_surface_changed(); /* as in render_impl: the effects pass maps onto the output's size */
if (!g_swapchain && swap_init() != 0) return -1; /* the mapping is in output pixels */
update_map(scene_w, scene_h);
if (!g_map.valid) return -1;
@@ -30,6 +30,7 @@ extern int droiddeck_cursor_serial(void);
extern void droiddeck_wayland_send_key(int evdev, int state);
extern void droiddeck_wayland_send_scene_input(int type, int a, int b);
extern void droiddeck_wayland_vsync(int64_t frame_time_ns);
extern void droiddeck_wayland_output_resized(void);
extern volatile int g_fps_limit;
extern volatile int g_hide_shell;
extern volatile int g_zero_copy;
@@ -401,6 +402,17 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetOutputSize(JNIEnv
g_output_h = h > 0 ? h : 0;
}
/* The output's size changed while the compositor runs (a foldable opening or closing with the
* session following the screen): store it and have the compositor thread tell the clients. */
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeResizeOutput(JNIEnv *env, jclass clazz, jint w, jint h) {
(void)env; (void)clazz;
if (w <= 0 || h <= 0) return;
g_output_w = w;
g_output_h = h;
droiddeck_wayland_output_resized();
}
/* Fullscreen mode + screen alignment (Container.FULLSCREEN_* / ALIGN_* values): how the scene is
* fitted onto the output. Any thread, any time; the next frame uses it. */
JNIEXPORT void JNICALL
@@ -0,0 +1,51 @@
/*
* wp_single_pixel_buffer_manager_v1 (version 1): a wl_buffer of one pixel of one colour, which a
* client stretches over a surface with wp_viewporter. KWin's Wayland backend - the desktop's KWin
* nested in this compositor - refuses to start without it. The surface takes the pixel as a 1x1
* image, the way it takes a wl_shm buffer (compositor.c, take_pixel).
*/
#include <stdlib.h>
#include "droiddeck_ext.h"
#include "single-pixel-buffer-v1-server-protocol.h"
struct single_pixel {
uint8_t bgra[4]; /* premultiplied, as wl_shm's ARGB8888 lies in memory */
};
static void buffer_destroy(struct wl_client *c, struct wl_resource *r) { wl_resource_destroy(r); }
static const struct wl_buffer_interface buffer_impl = { .destroy = buffer_destroy };
static void buffer_free(struct wl_resource *r) { free(wl_resource_get_user_data(r)); }
int single_pixel_buffer_get(struct wl_resource *buffer, uint8_t bgra[4]) {
if (!buffer || !wl_resource_instance_of(buffer, &wl_buffer_interface, &buffer_impl)) return 0;
struct single_pixel *p = wl_resource_get_user_data(buffer);
for (int i = 0; i < 4; i++) bgra[i] = p->bgra[i];
return 1;
}
static void mgr_destroy(struct wl_client *c, struct wl_resource *r) { wl_resource_destroy(r); }
static void mgr_create_buffer(struct wl_client *c, struct wl_resource *r, uint32_t id,
uint32_t red, uint32_t green, uint32_t blue, uint32_t alpha) {
struct single_pixel *p = calloc(1, sizeof(*p));
struct wl_resource *buffer = p ? wl_resource_create(c, &wl_buffer_interface, 1, id) : NULL;
if (!buffer) { free(p); wl_client_post_no_memory(c); return; }
/* The protocol's values span the whole u32 range; the top byte is the 8-bit channel. */
p->bgra[0] = blue >> 24;
p->bgra[1] = green >> 24;
p->bgra[2] = red >> 24;
p->bgra[3] = alpha >> 24;
wl_resource_set_implementation(buffer, &buffer_impl, p, buffer_free);
}
static const struct wp_single_pixel_buffer_manager_v1_interface mgr_impl = {
.destroy = mgr_destroy, .create_u32_rgba_buffer = mgr_create_buffer,
};
static void bind_manager(struct wl_client *c, void *data, uint32_t ver, uint32_t id) {
struct wl_resource *r = wl_resource_create(c, &wp_single_pixel_buffer_manager_v1_interface, ver, id);
if (!r) { wl_client_post_no_memory(c); return; }
wl_resource_set_implementation(r, &mgr_impl, NULL, NULL);
}
void single_pixel_init(struct wl_display *display) {
wl_global_create(display, &wp_single_pixel_buffer_manager_v1_interface, 1, NULL, bind_manager);
}
@@ -349,7 +349,6 @@ class MainActivity : ComponentActivity() {
private var steamDownloadsInBackground by mutableStateOf(false)
private var oscMode by mutableStateOf(SessionPrefs.OSC_AUTO)
private var backActionsInverted by mutableStateOf(false)
private var renderer by mutableStateOf("vulkan")
private var gameStorage by mutableStateOf("")
private var storageDiagnostics by mutableStateOf(false)
private var storageOptions by mutableStateOf<List<GameStorage.Option>>(emptyList())
@@ -867,8 +866,12 @@ class MainActivity : ComponentActivity() {
SessionPrefs.setMicAsked(this)
}
if (wanted.isNotEmpty()) requestPermissions(wanted.toTypedArray(), 1)
// A store sign-in an earlier build left in plain text is sealed with the Keystore key.
Thread({ com.droiddeck.launcher.stores.StoreAccounts.encryptAll(this) }, "store-credentials").start()
// A session folder left without its ending - the process was killed - gets it now.
if (!SessionState.running) Thread({
com.droiddeck.launcher.session.LogMigration.run(this)
SessionLogShare.clear(this)
SessionArtifacts.finishAbandoned(this)
SessionArtifacts.scrubOlder(this)
SessionArtifacts.prune(this)
@@ -1224,7 +1227,6 @@ class MainActivity : ComponentActivity() {
directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null,
stretch16x9 = if (mode == SessionService.MODE_STEAM) stretch16x9 else null,
mic = if (mode == SessionService.MODE_STEAM) mic else null,
renderer = if (mode == SessionService.MODE_DESKTOP) renderer else null,
gameStorage = if (mode == SessionService.MODE_STEAM) gameStorage else null,
storageOptions = storageOptions,
storageDiagnostics = mode == SessionService.MODE_STEAM && storageDiagnostics,
@@ -1296,7 +1298,6 @@ class MainActivity : ComponentActivity() {
requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), 2)
}
},
onRenderer = { r -> SessionPrefs.setDesktopRenderer(this, r); renderer = r },
onGameStorage = { path, label -> setGameStorage(path, label) },
onPickGameStorageFolder = {
pickGameStorage.launch(InAppFilePicker.buildDirIntent(this, getString(R.string.main_pick_game_storage), gameStorage.ifEmpty { null }))
@@ -1453,7 +1454,6 @@ class MainActivity : ComponentActivity() {
stretch16x9 = SessionPrefs.stretch16x9(this)
mic = SessionPrefs.micEnabled(this)
refreshWifiDiscovery()
renderer = SessionPrefs.desktopRenderer(this)
gameStorage = SessionPrefs.gameStorage(this)
storageDiagnostics = SessionPrefs.storageDiagnosticsEnabled(this)
settingsMode = mode
@@ -336,6 +336,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
)
}
Log.i(TAG, "perf: " + PerfMode.apply(this, SessionState.fpsLimit))
if (!SessionState.running) SessionState.followScreen = followChoice()
applyFollowOrientation(resources.configuration)
goFullscreen()
// The device's volume keys change the stream the session plays on (the relay and
// PulseAudio are media playback); they are never forwarded to the guest.
@@ -743,9 +745,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
}
private fun loadingTitle(): String = when (loadingMode()) {
SessionService.MODE_DESKTOP ->
if (!SessionState.running && intent.getStringExtra(SessionService.EXTRA_STEAM_UI) != null) getString(R.string.session_starting_steam_desktop)
else getString(R.string.session_starting_desktop)
// Also when the desktop was asked for with Steam (Big Picture's Switch to Desktop): the client
// does not open on it.
SessionService.MODE_DESKTOP -> getString(R.string.session_starting_desktop)
SessionService.MODE_RUN -> {
val program = if (SessionState.running) SessionState.program else intent.getStringExtra(SessionService.EXTRA_PROGRAM)
com.droiddeck.launcher.frontend.Library.nameForProgram(program)?.let { getString(R.string.session_starting_named, it) }
@@ -927,8 +929,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
/** Null when the desktop package is in, else the loading screen's closing line. */
private fun installDesktop(): String? {
uiHandler.post { loading.percent = -1; loading.say(getString(DESKTOP_LINES.downloading), DESKTOP_LINES.topic, readable = true) }
val entry = com.droiddeck.launcher.runtime.DesktopCatalog.fetch()?.firstOrNull { it.id == "desktop" }
?: return getString(R.string.session_desktop_catalog_unreachable)
val entry = com.droiddeck.launcher.runtime.DesktopCatalog.desktopEntry(this)
val problem = com.droiddeck.launcher.runtime.DesktopCatalog.install(this, entry,
progressFor(DESKTOP_LINES, entry.size / 1_000_000))
return problem?.let { getString(R.string.session_desktop_install_failed, it) }
@@ -962,7 +963,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
// sized once when the session starts and cannot change. A foldable recreates the Surface
// on the other panel, and recomputing the size there told the compositor a 21:9 buffer
// was 16:9 - the picture came back squashed sideways. While a session runs, keep its size.
val size = if (SessionState.running) SessionState.outputSize else outputSize()
// Follow screen is the exception: there the compositor tells gamescope the new size, so the
// session takes the shape of the Surface it now has.
val previous = SessionState.outputSize
val live = if (SessionState.followScreen && !isInPictureInPictureMode)
com.droiddeck.launcher.session.SessionDisplay.followSize(holder.surfaceFrame.width(), holder.surfaceFrame.height())
else null
val size = live ?: if (SessionState.running) previous else outputSize()
SessionState.outputSize = size
if (!SessionState.running) SessionState.refreshHz = refreshHz()
// How far the panel enlarges the session, for texture sharpness "Auto" (TextureFiltering):
@@ -1021,6 +1028,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
driverId?.let { turnip.driverPath(it) }, driverId?.let { turnip.libraryName(it) },
applicationInfo.nativeLibraryDir, size.first, size.second, refreshHz(), SessionState.fpsLimit,
)
if (SessionState.running && size != previous) {
Log.i(TAG, "follow screen: ${previous.first}x${previous.second} -> ${size.first}x${size.second} on a new surface")
WaylandCompositor.nativeResizeOutput(size.first, size.second)
}
if (!SessionState.running) SessionEvents.record("compositor.started")
// The service owns everything below the compositor. It is started whenever no session is
// running - NOT only when the compositor was just started: the compositor lives for the
@@ -1049,9 +1060,51 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
if (resized) {
Log.i(TAG, "surface resized to ${width}x$height - rebinding the compositor")
CompositorHost.resize(holder.surface) { applyFrameGen() }
followWindow(width, height)
}
}
/**
* Follow screen: the session's display takes the window's new size (a Fold opening onto its
* inner panel, or closing onto the cover), so the picture fills the panel instead of being
* letterboxed onto it. Not in picture-in-picture: that window is a preview of the session,
* and resizing the guest to it would leave Steam laid out for a thumbnail.
*/
private fun followWindow(width: Int, height: Int) {
if (!SessionState.followScreen || isInPictureInPictureMode || !CompositorHost.isStarted) return
val size = com.droiddeck.launcher.session.SessionDisplay.followSize(width, height) ?: return
if (size == SessionState.outputSize) return
Log.i(TAG, "follow screen: ${SessionState.outputSize.first}x${SessionState.outputSize.second} -> ${size.first}x${size.second}")
SessionState.outputSize = size
val panel = panelBounds()
SessionState.upscaleRatio = maxOf(panel.width(), panel.height()).toFloat() / maxOf(size.first, size.second).coerceAtLeast(1)
WaylandCompositor.nativeResizeOutput(size.first, size.second)
}
/** Whether this session's resolution is Follow screen; decided once, when it starts. */
private fun followChoice(): Boolean {
val mode = SessionPrefs.prefMode(intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM)
return SessionPrefs.resolutionChoice(this, mode, com.droiddeck.launcher.session.SessionDisplay.panelSize(this)) ==
com.droiddeck.launcher.session.SessionDisplay.FOLLOW_SCREEN
}
/**
* Follow screen on a large panel (a Fold's inner screen) may turn with the device: a window
* locked to landscape on a squarer panel is letterboxed by the system itself, which no output
* size can undo. A phone-sized panel (the cover screen) stays landscape as before.
*/
private fun applyFollowOrientation(config: android.content.res.Configuration) {
if (!SessionState.followScreen) return
val wanted = if (config.smallestScreenWidthDp >= 600) android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER
else android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
if (requestedOrientation != wanted) requestedOrientation = wanted
}
override fun onConfigurationChanged(newConfig: android.content.res.Configuration) {
super.onConfigurationChanged(newConfig)
applyFollowOrientation(newConfig)
}
override fun surfaceDestroyed(holder: SurfaceHolder) {
surfaceW = 0
surfaceH = 0
@@ -1891,6 +1944,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
override fun onPictureInPictureModeChanged(inPip: Boolean, newConfig: android.content.res.Configuration) {
super.onPictureInPictureModeChanged(inPip, newConfig)
if (::pip.isInitialized) pip.changed(inPip)
// The panel may have changed while the session was a thumbnail (folded or unfolded in PiP).
if (!inPip && surfaceW > 0) followWindow(surfaceW, surfaceH)
}
override fun startActivityForResult(intent: Intent, requestCode: Int, options: Bundle?) {
@@ -2018,10 +2073,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
// ALWAYS from Android 11: SHORT_EDGES left a black strip along a camera on the long edge,
// which is where a Fold's inner-screen camera sits with the device held in landscape.
if (Build.VERSION.SDK_INT >= 28) {
window.attributes = window.attributes.apply {
layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
layoutInDisplayCutoutMode = if (Build.VERSION.SDK_INT >= 30)
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
else WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
}
}
}
@@ -1,5 +1,6 @@
package com.droiddeck.launcher.agent
import com.droiddeck.launcher.session.SessionPaths
import android.Manifest
import android.content.ContentProvider
import android.content.ContentValues
@@ -107,7 +108,7 @@ class AgentBridgeProvider : ContentProvider() {
private fun state(context: Context): JSONObject {
val runtimeVersion = LinuxRuntimeInstaller.installedVersion(context)
val dir = SessionState.logDirectory ?: SessionState.logFile?.parentFile ?: latestSessionDirectory()
val dir = SessionState.logDirectory ?: SessionState.logFile?.parentFile ?: SessionPaths.sessionFolders(context).lastOrNull()
val session = JSONObject()
.put("id", SessionState.sessionId ?: dir?.name ?: JSONObject.NULL)
.put("phase", SessionState.phase.name)
@@ -163,12 +164,6 @@ class AgentBridgeProvider : ContentProvider() {
.put("session", session)
}
private fun latestSessionDirectory(): File? {
val parent = LinuxRuntime.debugLogDir()
return parent.listFiles { file -> file.isDirectory && file.name.startsWith("session-") }
?.maxWithOrNull(compareBy<File> { it.lastModified() }.thenBy { it.name })
}
private fun stop(context: Context): JSONObject {
if (SessionState.running) {
SessionService.stop(context)
@@ -53,7 +53,7 @@ object DeviceReport {
b.append("DroidDeck session report\n")
b.append("========================\n")
k("Written", SimpleDateFormat("yyyy-MM-dd HH:mm:ss zzz", Locale.US).format(Date()))
k("Session mode", when (mode) { SessionService.MODE_DESKTOP -> "desktop (labwc/LXQt)"; SessionService.MODE_RUN -> "a program under gamescope"; else -> "Steam client (gamescope)" })
k("Session mode", when (mode) { SessionService.MODE_DESKTOP -> "desktop (KDE Plasma)"; SessionService.MODE_RUN -> "a program under gamescope"; else -> "Steam client (gamescope)" })
h("App")
runCatching {
@@ -189,7 +189,7 @@ object DeviceReport {
}
for (name in listOf("droiddeck-tu-debug", "droiddeck-driver",
"droiddeck-osc", "droiddeck-no-pad",
"droiddeck-no-hud", "droiddeck-wlr-renderer")) {
"droiddeck-no-hud")) {
val f = File(Environment.getExternalStorageDirectory(), "Download/$name")
if (f.isFile) k(name, FileUtils.readString(f)?.trim()?.replace('\n', ' ')?.ifEmpty { "(present, empty)" } ?: "(present)")
}
@@ -75,9 +75,24 @@ object LogRedactor {
* user who signs in with a plain account name, not an email, had it in every log. The single
* space then a non-space keeps "OnLoginStateChange 0 1 0 0" (no account yet) as it is.
*/
private val LOGIN_STATE = Regex("(OnLoginStateChange )(\\S+)")
private val LOGIN_STATE = Regex("(?i)(OnLoginStateChange:? )([^\\s<]\\S*)")
private val LOGIN_USERS = Regex("(OnLoginUsersChanged )(\\S.*)$")
/**
* An account name as a field: `AccountName`, `account_name`, `username` (`"AccountName"
* "someone"` in a VDF, `account_name=...`, `"username": "..."`) and `login` - the last only
* as `login=`, a quoted key or a VDF pair, so "Login: OnLoginStateChange ..." keeps its label.
* A quoted value is blanked whole; one already blanked is left as it is.
*/
private const val ACCOUNT_VALUE = "(\"[^\"<\\r\\n]+\"|'[^'<\\r\\n]+'|[^\\s\"'<>&;,}]+)"
private val ACCOUNT_KV = Regex(
"(?i)(?<![A-Za-z0-9_])(account[_-]?name|user[_-]?name|epicusername)" +
"([\"']?\\s*[=:]\\s*|[\"']\\s+)" + ACCOUNT_VALUE
)
private val LOGIN_KV = Regex(
"(?i)(?<![A-Za-z0-9_])(login)(\\s*=\\s*|[\"']\\s*[=:]\\s*|[\"']\\s+)" + ACCOUNT_VALUE
)
/** The device's Steam accounts and persona names as patterns (see [learnAccounts]). */
@Volatile
private var accounts: List<Regex> = emptyList()
@@ -205,13 +220,49 @@ object LogRedactor {
* only when that matches, so a folder scrubbed under older rules is scrubbed again on the way
* out.
*/
const val RULES_VERSION = 2
const val RULES_VERSION = 3
/**
* A private IPv4 address (10/8, 172.16/12, 192.168/16, link-local 169.254/16): the home
* network's layout, e.g. its router as the resolver. Blanked in a shared zip only; public
* server addresses stay. Not part of a longer dotted number (a version like 10.0.19041.1).
*/
private val LAN_IPV4 = Regex(
"(?<![\\d.])(?:10\\.\\d{1,3}|192\\.168|172\\.(?:1[6-9]|2\\d|3[01])|169\\.254)\\.\\d{1,3}\\.\\d{1,3}(?!\\.?\\d)"
)
/** [src]'s lines, scrubbed, to [out]. */
fun scrubTo(src: java.io.File, out: java.io.Writer) {
src.forEachLine { line -> out.write(redact(line)); out.write("\n") }
}
/**
* The last pass for a file going into a shared zip: [redact], then the rules the stores' log
* uses too ([SecretScrub]) - URLs without query, fragment and user:password and with any
* token-bearing path segment blanked, token values and Authorization / Cookie headers blanked
* - and private IPv4 addresses as `<lan-address>`. A line already clean comes out unchanged.
*/
fun redactForShare(line: String): String {
if (line.isEmpty()) return line
return try {
val out = SecretScrub.scrub(redact(line), SecretScrub.Urls.KEEP_PATH, "<redacted:token>")
LAN_IPV4.replace(out, "<lan-address>")
} catch (t: Throwable) {
"<redaction failed; line withheld>"
}
}
/** [src]'s lines through [redactForShare], to [out]: the pass every text file in a shared zip gets. */
fun scrubForShare(src: java.io.File, out: java.io.Writer) {
src.forEachLine { line -> out.write(redactForShare(line)); out.write("\n") }
}
/** `<redacted:account>`, inside [value]'s quotes when it had them. */
private fun quoted(value: String): String {
val q = value.first().takeIf { it == '"' || it == '\'' }?.toString().orEmpty()
return "$q<redacted:account>$q"
}
/** [line] with every credential shape replaced. Null- and exception-safe by construction. */
fun redact(line: String): String {
if (line.isEmpty()) return line
@@ -240,6 +291,8 @@ object LogRedactor {
for (r in own) out = r.replace(out, "<redacted:ip>")
out = LOGIN_STATE.replace(out) { "${it.groupValues[1]}<redacted:account>" }
out = LOGIN_USERS.replace(out) { "${it.groupValues[1]}<redacted:account>" }
out = ACCOUNT_KV.replace(out) { "${it.groupValues[1]}${it.groupValues[2]}${quoted(it.groupValues[3])}" }
out = LOGIN_KV.replace(out) { "${it.groupValues[1]}${it.groupValues[2]}${quoted(it.groupValues[3])}" }
for (r in accounts) out = r.replace(out, "<redacted:account>")
out = EMAIL.replace(out, "<redacted:email>")
out = RESIDUAL.replace(out) { "${it.groupValues[1]}=<redacted:token>" }
@@ -0,0 +1,72 @@
package com.droiddeck.launcher.core
/**
* The one set of rules that keeps URLs and tokens out of anything the app writes or shares: the
* stores' log ([com.droiddeck.launcher.stores.StoreLog.redactLine]) and the last pass over every
* text file in a shared log zip ([LogRedactor.redactForShare]).
*
* - Every URL loses its query, fragment and `user:password@`. [Urls.SHORT] then keeps only the host
* and a plain first path segment (the stores' lines, where a GOG secure link carries its token in
* the path); [Urls.KEEP_PATH] keeps the path but blanks any segment that carries a token.
* - Outside URLs, the values of token-like keys (`token`, `__token__`, `f_token`, `hdnts`, access /
* refresh / id tokens; exchange and authorization codes of four characters or more, and a bare
* `code=` where it is one: in a query string or on a line with OAuth keys such as `client_id`,
* `redirect_uri` or `state`, never an 8-hex exception code like Proton's `code=c0000005`) and of
* Authorization / Cookie headers are blanked with [mark].
*
* A line already scrubbed comes out unchanged.
*/
object SecretScrub {
enum class Urls { SHORT, KEEP_PATH }
private val URL = Regex("""[A-Za-z][A-Za-z0-9+.\-]*://[^\s"'<>]+""")
private val SAFE_SEGMENT = Regex("""[A-Za-z0-9._\-]{1,40}""")
private val TOKEN_SEGMENT = Regex("""(?i)(token|hdnts|hmac|signature|sig|exp)=""")
private val TOKEN = Regex("""(?i)(?<![A-Za-z0-9_])(__token__|f_token|hdnts|access_token|refresh_token|id_token|token)(["']?\s*[=:]\s*["']?)[^\s&;,"'<>}]+""")
/** Codes that are only ever OAuth grants. */
private val GRANT_CODE = Regex("""(?i)(?<![A-Za-z0-9_])(exchange_code|authorization_?code)(["']?\s*=\s*["']?)[^\s&;,"'<>}]{4,}""")
/** A bare `code=`: a grant only right after `?` / `&` (a query string) or beside OAuth keys ([OAUTH_CONTEXT]). */
private val CODE = Regex("""(?i)(?<![A-Za-z0-9_])(code)(["']?\s*=\s*["']?)([^\s&;,"'<>}]{4,})""")
private val OAUTH_CONTEXT = Regex("""(?i)(?<![A-Za-z0-9_])(client_id|client_secret|redirect_uri|state|grant_type|response_type|access_token|refresh_token|id_token)["']?\s*[=:]""")
/** A Windows exception or status code (`code=c0000005`, `code=0x80000003`): never a grant. */
private val STATUS_CODE = Regex("""(?i)(0x)?[0-9a-f]{8}""")
private val HEADER = Regex("""(?i)\b(authorization|cookie|set-cookie)(\s*[:=]\s*).+""")
fun scrub(text: String, urls: Urls, mark: String): String {
var out = URL.replace(text) { m -> if (urls == Urls.SHORT) short(m.value) else keepPath(m.value, mark) }
out = TOKEN.replace(out) { m -> m.groupValues[1] + m.groupValues[2] + mark }
out = GRANT_CODE.replace(out) { m -> m.groupValues[1] + m.groupValues[2] + mark }
val oauth = OAUTH_CONTEXT.containsMatchIn(text)
val src = out
out = CODE.replace(src) { m ->
val inQuery = m.range.first > 0 && src[m.range.first - 1] in "?&"
val grant = !STATUS_CODE.matches(m.groupValues[3]) && (oauth || inQuery)
if (grant) m.groupValues[1] + m.groupValues[2] + mark else m.value
}
out = HEADER.replace(out) { m -> m.groupValues[1] + m.groupValues[2] + mark }
return out
}
private fun split(url: String): Triple<String, String, String?> {
val schemeEnd = url.indexOf("://")
val rest = url.substring(schemeEnd + 3).substringBefore('#').substringBefore('?')
val slash = rest.indexOf('/')
val authority = (if (slash >= 0) rest.substring(0, slash) else rest).substringAfterLast('@')
return Triple(url.substring(0, schemeEnd), authority, if (slash >= 0) rest.substring(slash + 1) else null)
}
private fun short(url: String): String {
val (scheme, authority, path) = split(url)
if (path == null) return "$scheme://$authority"
val first = path.substringBefore('/')
if (first.isEmpty()) return "$scheme://$authority/"
val shown = if (SAFE_SEGMENT.matches(first)) first else "…"
return "$scheme://$authority/$shown" + if (path.length > first.length && shown != "…") "/…" else ""
}
private fun keepPath(url: String, mark: String): String {
val (scheme, authority, path) = split(url)
val clean = path?.split('/')?.joinToString("/") { seg -> if (TOKEN_SEGMENT.containsMatchIn(seg)) mark else seg }
return "$scheme://$authority" + (clean?.let { "/$it" } ?: "")
}
}
@@ -1020,7 +1020,8 @@ fun FileManagerScreen(
// The ROMs folder chosen on the main screen: what the session shows as /root/ROMs.
SessionPrefs.romsDir(context).takeIf { it.isNotEmpty() }?.let(::File)?.takeIf { it.isDirectory }
?.let { add(locItem(stringResource(R.string.fm_rail_roms), Icons.Filled.SportsEsports, it)) }
File("/storage/emulated/0/Download/DroidDeck").takeIf { it.isDirectory }?.let { add(locItem(stringResource(R.string.fm_rail_session_logs), Icons.Filled.Description, it)) }
// The app's own logs folder: private, which this file manager (the app itself) can read.
com.droiddeck.launcher.runtime.LinuxRuntime.logDir(context).takeIf { it.isDirectory }?.let { add(locItem(stringResource(R.string.fm_rail_session_logs), Icons.Filled.Description, it)) }
File("/storage/emulated/0/Pictures").takeIf { it.isDirectory }?.let { add(locItem(stringResource(R.string.fm_rail_pictures), Icons.Filled.Image, it)) }
}
val favItems = remember(favTick) { FavoritesStore.list(context).map(::File).filter { it.exists() } }
@@ -25,7 +25,7 @@ import java.util.zip.ZipInputStream;
/**
* Imported LINUX Vulkan drivers: glibc Turnip ICDs ({@code Turnip-<tag>[-variant]-Linux.zip} from
* Banners-Turnip) for the runtime - the gamescope session that runs Valve's native ARM64 Steam
* client, and the labwc desktop beside it. This is the driver that DRAWS there: the client's own UI
* client, and the KDE Plasma desktop beside it. This is the driver that DRAWS there: the client's own UI
* (OpenGL through the runtime's Zink), every game the client launches (D3D through Proton's
* DXVK/VKD3D) and everything on the desktop. Putting the frame on the screen stays the Android
* driver's job, in the app's compositor ({@link TurnipDriver}).
@@ -242,7 +242,7 @@ object AppImageManager {
private fun menuEntry(context: Context, id: String) =
// A system directory, not ~/.local/share/applications: the desktop copies game entries from
// here into the user's with a GPU launcher (droiddeck-desktop-gpu) while it runs on pixman.
// here into the user's with a GPU launcher (droiddeck-desktop-gpu), since it composites in software.
File(LinuxRuntime.rootDir(context), "usr/local/share/applications/droiddeck-appimage-$id.desktop")
/** The Linux desktop's menu entry: the desktop's own Exec rules (and droiddeck-gpu) apply to it. */
@@ -232,10 +232,10 @@ object BwrapSpawner {
val driver = File(lib, "libvulkan_freedreno.so")
if (!driver.isFile || !File("/dev/kgsl-3d0").exists()) return null
if (env.containsKey("VK_ICD_FILENAMES") || env.containsKey("VK_DRIVER_FILES")) return null
// A window on the desktop while labwc composites with pixman gets shared-memory buffers
// only; Zink cannot present there, so such an app keeps Flathub's own Mesa (llvmpipe).
// From the desktop, games go through droiddeck-gpu's gamescope and do get the GPU.
if (env["WLR_RENDERER"] == "pixman" && env["GAMESCOPE_WAYLAND_DISPLAY"] == null) return null
// A window on the desktop gets shared-memory buffers only (KWin composites in software);
// Zink cannot present there, so such an app keeps Flathub's own Mesa (llvmpipe). From the
// desktop, games go through droiddeck-gpu's gamescope and do get the GPU.
if (env["BL_DESKTOP"] == "1" && env["GAMESCOPE_WAYLAND_DISPLAY"] == null) return null
val binds = ArrayList<Bind>()
for (name in listOf("libvulkan_freedreno.so", "libdisplay-info.so.3", "libSPIRV-Tools.so", "libSPIRV-Tools-opt.so")) {
val f = File(lib, name)
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.runtime
import com.droiddeck.launcher.core.Hashes
import android.content.Context
import android.util.Log
import com.droiddeck.launcher.BuildConfig
import com.droiddeck.launcher.R
import com.droiddeck.launcher.core.Downloader
import com.droiddeck.launcher.core.FileUtils
@@ -74,10 +75,32 @@ object DesktopCatalog {
installed(context, PROTON_SEED_ID) == null &&
!File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/appmanifest_4427310.acf").isFile
// labwc comes with the hosted desktop package itself (its launcher is staged by the app at
// every session, so it cannot tell whether the package is there); SessionFiles uses the same test.
fun desktopInstalled(context: Context): Boolean =
File(LinuxRuntime.rootDir(context), "usr/bin/labwc").isFile
/**
* The desktop: KDE Plasma (tools/desktop-kde). It replaced an LXQt/labwc package of id
* "desktop", which a runtime may still carry; that one does not count, so the first desktop
* after the update installs this one over it.
*/
const val DESKTOP_ID = "desktop-kde"
/**
* The desktop package this apk installs: pinned in tools/desktop-kde/release.env and published
* in DroidDeck-Components, not read from the catalog, so the desktop scripts staged by this
* apk always get the package they were made for.
*/
fun desktopEntry(context: Context) = Entry(
DESKTOP_ID, context.getString(R.string.content_linux_desktop), 1, BuildConfig.DESKTOP_KDE_TAG, "tar",
BuildConfig.DESKTOP_KDE_URL, BuildConfig.DESKTOP_KDE_SHA256, BuildConfig.DESKTOP_KDE_SIZE, "",
"", "",
)
// The desktop package installed to the end: KWin is there and the marker install() writes once
// the whole package is extracted. An install cut short (the app killed, storage full) leaves
// KWin without the marker, and the next desktop installs it again. The launcher is staged by
// the app at every session, so it cannot tell. SessionFiles uses the same test.
fun desktopInstalled(context: Context): Boolean = desktopInstalled(LinuxRuntime.rootDir(context))
fun desktopInstalled(root: File): Boolean =
File(root, "usr/bin/kwin_wayland").isFile && File(root, ".droiddeck-pkg-$DESKTOP_ID").isFile
/** Downloads, verifies and installs one package. Returns null on success, else a message. */
fun install(context: Context, entry: Entry, listener: LinuxRuntimeInstaller.ProgressListener?): String? {
@@ -111,7 +134,12 @@ object DesktopCatalog {
"Exec=env APPIMAGE_EXTRACT_AND_RUN=1 /opt/appimages/${entry.id}.AppImage\n" +
"Icon=${entry.icon}\nTerminal=false\nCategories=${entry.category};\n")
}
else -> if (!LinuxRuntimeInstaller.extract(context, download, root, listener)) return context.getString(R.string.deskpkg_extract_failed)
else -> {
// Not complete until written again at the end: a reinstall cut short must not
// leave the last install's marker saying it is.
marker(context, entry.id).delete()
if (!LinuxRuntimeInstaller.extract(context, download, root, listener)) return context.getString(R.string.deskpkg_extract_failed)
}
}
FileUtils.writeString(marker(context, entry.id), entry.version)
return null
@@ -87,7 +87,7 @@ object FlatpakManager {
?.maxByOrNull { it.first }?.second
}
/** Runs [argv] in the runtime, its output also in Download/DroidDeck/flatpak-<verb>.log. */
/** Runs [argv] in the runtime, its output also in files/logs/tools/flatpak-<verb>.log. */
private fun runGuest(context: Context, argv: List<String>, fakeRoot: Boolean, onLine: (String) -> Unit): Int {
val name = "flatpak-" + (argv.getOrNull(2)?.takeIf { argv.getOrNull(1) == HELPER } ?: "setup")
return GuestCommand.run(context, argv, fakeRoot, name, onLine = onLine)
@@ -17,7 +17,7 @@ object GuestCommand {
/**
* Runs [argv] and hands each output line to [onLine]; returns the exit status. [fakeRoot] is
* for the package tools, which refuse any uid but 0. With [logName], everything the command
* says also goes to Download/DroidDeck/tools/<logName>.log beside the session logs, so a problem can
* says also goes to files/logs/tools/<logName>.log beside the session logs, so a problem can
* be handed over like a session's. With [linkDir], hard links (which Android denies apps)
* become symlinks to files proot keeps there (its link2symlink).
*/
@@ -25,7 +25,7 @@ object GuestCommand {
linkDir: File? = null, onLine: (String) -> Unit): Int {
val log = logName?.let {
try {
File(File(LinuxRuntime.debugLogDir(), SessionPaths.TOOLS_DIR).apply { mkdirs() }, "$it.log").printWriter()
File(File(LinuxRuntime.logDir(context), SessionPaths.TOOLS_DIR).apply { mkdirs() }, "$it.log").printWriter()
} catch (e: Exception) { null }
}
log?.println("== ${java.util.Date()} ${argv.joinToString(" ")}")
@@ -44,10 +44,20 @@ public final class LinuxRuntime {
public static final String GUEST_RUNTIME_DIR = "/run/droiddeck";
private static final String SYSTEM_FONTS = "/system/fonts";
private static final String GUEST_SYSTEM_FONTS = "/usr/local/share/fonts/android";
/** Where every Linux session's debug log lands: public, so a user can just hand the folder over. */
/** The folder under Downloads where builds before private logs wrote them; read only to move them. */
public static final String DEBUG_LOG_DIR = "DroidDeck";
public static File debugLogDir() {
/**
* Where every log lands: app-private, {@code files/logs}. Session folders, tools/ (one-off
* commands) and stores/ sit under it; the files directory is bound into every session at the
* same path, so the guest writes there too. Share logs is how a folder leaves the device.
*/
public static File logDir(Context context) {
return new File(context.getFilesDir(), "logs");
}
/** {@code Download/DroidDeck}, where earlier builds wrote logs. Only LogMigration reads it. */
public static File legacyLogDir() {
return new File(android.os.Environment.getExternalStoragePublicDirectory(
android.os.Environment.DIRECTORY_DOWNLOADS), DEBUG_LOG_DIR);
}
@@ -227,7 +227,8 @@ public final class LinuxRuntimeInstaller {
// Its quarantined home is not user data to carry into an update.
File pendingRemoval = removalDirectory(LinuxRuntime.rootDir(context));
if (pendingRemoval.exists() && listener != null) listener.onProgress(context.getString(R.string.rtinst_removing_leftovers), -1);
RuntimeFileTree.delete(pendingRemoval, null);
if (!discard(pendingRemoval, null)) throw new IOException("Cannot clear the previous runtime: " + pendingRemoval);
emptyTrash(LinuxRuntime.rootDir(context).getParentFile());
String downloading = context.getString(R.string.rtinst_downloading);
if (listener != null) listener.onProgress(Step.DOWNLOADING, downloading, 0);
// Downloader reports a 0..1 fraction, or -1 while the total size is unknown.
@@ -255,8 +256,7 @@ public final class LinuxRuntimeInstaller {
File staging = new File(root.getParentFile(), LinuxRuntime.DIR + ".new");
File old = new File(root.getParentFile(), LinuxRuntime.DIR + ".old");
recoverInterruptedSwap(root, staging, old);
RuntimeFileTree.delete(staging, null);
if (!staging.mkdirs()) return false;
if (!discard(staging, null) || !staging.mkdirs()) return false;
if (listener != null) listener.onProgress(context.getString(R.string.rtinst_extracting), -1);
if (!extract(context, archive, staging, listener)) {
RuntimeFileTree.delete(staging, null);
@@ -264,7 +264,10 @@ public final class LinuxRuntimeInstaller {
}
FileUtils.writeString(new File(staging, VERSION_FILE), release.version);
RuntimeFileTree.delete(old, null);
if (!discard(old, null)) {
discard(staging, null);
return false;
}
if (root.isDirectory() && !root.renameTo(old)) {
RuntimeFileTree.delete(staging, null);
return false;
@@ -292,7 +295,7 @@ public final class LinuxRuntimeInstaller {
if (old.isDirectory()) old.renameTo(root);
return false;
}
RuntimeFileTree.delete(old, null);
discard(old, null);
return LinuxRuntime.isInstalled(context);
} catch (Exception e) {
Log.e(TAG, "install", e);
@@ -315,6 +318,35 @@ public final class LinuxRuntimeInstaller {
}
}
/** Where entries the app cannot unlink are set aside, out of the way of the runtime's names. */
static final String TRASH = ".runtime-trash";
/**
* Gets {@code tree} out from under its name. What can be deleted is; if something inside
* cannot be (a file made by root or {@code su} carries another SELinux category, and the app
* may not unlink it), the remainder is moved aside into {@link #TRASH} instead of blocking
* every later install and removal on it. False only when even that move is refused.
*/
static boolean discard(File tree, java.util.function.LongConsumer progress) {
if (RuntimeFileTree.deleteWhatCan(tree, progress)) return true;
File trash = new File(tree.getParentFile(), TRASH);
trash.mkdirs();
File aside = new File(trash, tree.getName() + "-" + System.currentTimeMillis());
if (tree.renameTo(aside)) {
Log.w(TAG, "could not delete all of " + tree + "; set the rest aside in " + aside);
return true;
}
Log.w(TAG, "could not delete or set aside " + tree);
return !tree.exists();
}
/** Another try at what {@link #discard} set aside. Whatever still cannot go stays there. */
static void emptyTrash(File parent) {
File trash = new File(parent, TRASH);
if (trash.exists() && !RuntimeFileTree.deleteWhatCan(trash, null))
Log.i(TAG, "some runtime leftovers still cannot be deleted: " + trash);
}
private static boolean isEmptyDir(File dir) {
String[] names = dir.list();
return dir.isDirectory() && names != null && names.length == 0;
@@ -369,15 +401,21 @@ public final class LinuxRuntimeInstaller {
// Invalidate the installation before traversing it. A process killed halfway
// through leaves a named removal to resume, never a launchable partial runtime.
if (root.exists()) {
RuntimeFileTree.delete(pending, progress);
if (!root.renameTo(pending)) throw new IOException("Cannot prepare the runtime for removal");
if (!discard(pending, progress) || !root.renameTo(pending))
throw new IOException("Cannot prepare the runtime for removal");
} else if (!pending.isDirectory() && !pending.mkdirs()) {
throw new IOException("Cannot prepare the runtime for removal");
}
// Keep the quarantine until all leftovers are gone, so a failure stays retryable.
RuntimeFileTree.delete(new File(root.getParentFile(), root.getName() + ".new"), progress);
RuntimeFileTree.delete(new File(root.getParentFile(), root.getName() + ".old"), progress);
RuntimeFileTree.delete(pending, progress);
// An entry the app may not delete is set aside rather than failing the removal:
// a quarantine that can never clear would block reinstalling for good.
for (File leftover : new File[]{
new File(root.getParentFile(), root.getName() + ".new"),
new File(root.getParentFile(), root.getName() + ".old"),
pending}) {
if (!discard(leftover, progress)) throw new IOException("Cannot remove " + leftover);
}
emptyTrash(root.getParentFile());
job.ok = true;
report(text(app, R.string.rtinst_removed), 100);
return true;
@@ -24,8 +24,15 @@ object ProotFastPath {
/** MAX_BINDS in fastpath.c: past it the library turns itself off, so the session keeps it off. */
const val MAX_BINDS = 256
/**
* Only the app's own proot (libproot.so, built with patches/0014) lets the trampoline through.
* The runtime's fallback copy (LinuxRuntime.prootBinary) is Termux's, which traps those calls
* too and translates their host paths a second time: every lookup then fails inside the
* process and goes to proot anyway, paying for both.
*/
fun enabled(context: Context): Boolean =
SessionPrefs.prootFastPath(context) && !SessionPrefs.prootNoSeccomp(context)
SessionPrefs.prootFastPath(context) && !SessionPrefs.prootNoSeccomp(context) &&
LinuxRuntime.prootBinary(context).parent == context.applicationInfo.nativeLibraryDir
/** The key for this rootfs and these binds, or null when the library cannot be told them. */
fun key(root: File, binds: List<String>): String? {
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.runtime;
import java.io.File;
import java.io.IOException;
import java.nio.file.AccessDeniedException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.LinkOption;
@@ -9,11 +10,15 @@ import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.function.LongConsumer;
import java.util.function.Predicate;
/** Checked removal of an app-owned runtime tree, including read-only directories. */
final class RuntimeFileTree {
private RuntimeFileTree() {}
/** Unit tests stand in for an entry the app cannot unlink (a file another SELinux user made). */
static volatile Predicate<Path> refuseForTest;
static void delete(File root, LongConsumer progress) throws IOException {
delete(root.toPath(), progress, new long[]{0});
}
@@ -30,10 +35,48 @@ final class RuntimeFileTree {
for (Path child : children) delete(child, progress, removed);
}
}
Files.delete(path);
unlink(path);
if (progress != null) progress.accept(++removed[0]);
}
/**
* Removes what it can of {@code root} and carries on past entries it cannot, rather than
* stopping at the first. Returns true when nothing is left.
*/
static boolean deleteWhatCan(File root, LongConsumer progress) {
return deleteWhatCan(root.toPath(), progress, new long[]{0});
}
private static boolean deleteWhatCan(Path path, LongConsumer progress, long[] removed) {
BasicFileAttributes attrs;
try { attrs = Files.readAttributes(path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS); }
catch (NoSuchFileException e) { return true; }
catch (IOException e) { return false; }
boolean emptied = true;
if (attrs.isDirectory()) {
try {
makeWritable(path.toFile());
try (DirectoryStream<Path> children = Files.newDirectoryStream(path)) {
for (Path child : children) emptied &= deleteWhatCan(child, progress, removed);
}
} catch (IOException | RuntimeException e) {
emptied = false;
}
}
if (!emptied) return false;
try { unlink(path); }
catch (NoSuchFileException e) { return true; }
catch (IOException e) { return false; }
if (progress != null) progress.accept(++removed[0]);
return true;
}
private static void unlink(Path path) throws IOException {
Predicate<Path> refuse = refuseForTest;
if (refuse != null && refuse.test(path)) throw new AccessDeniedException(path.toString());
Files.delete(path);
}
private static void makeWritable(File dir) throws IOException {
if (!dir.setReadable(true, true) || !dir.setWritable(true, true) || !dir.setExecutable(true, true))
throw new IOException("Cannot make directory removable: " + dir);
@@ -0,0 +1,73 @@
package com.droiddeck.launcher.session
import android.content.Context
import android.util.Log
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
/**
* Once, on the first start of a build with private logs: the session folders, tools/ and the loose
* tool logs that earlier builds left in `Download/DroidDeck/` move into `files/logs/`. Best effort:
* an item that cannot be moved stays where it is. Moved session folders lose their old scrub markers
* ([SessionArtifacts.unmarkMoved]), so [SessionArtifacts.scrubOlder] scrubs them under the current rules. Nothing else in that folder is touched - game
* save backups (Saves/) stay public - and after this pass the app never reads it again.
*/
object LogMigration {
private const val TAG = "LogMigration"
private const val MARKER = ".moved-from-downloads"
@Synchronized
fun run(context: Context) {
val target = LinuxRuntime.logDir(context).apply { mkdirs() }
val marker = File(target, MARKER)
if (marker.exists()) return
val legacy = LinuxRuntime.legacyLogDir()
val items = if (legacy.isDirectory) legacy.listFiles() else emptyArray()
// Unreadable (no storage access yet): try again next start rather than give up on them.
if (items == null) { Log.w(TAG, "$legacy cannot be listed; logs there stay until it can"); return }
var moved = 0
val movedFolders = ArrayList<File>()
for (f in items) {
val isLog = SessionPaths.isSessionFolder(f) ||
(f.isDirectory && f.name == SessionPaths.TOOLS_DIR) ||
(f.isFile && f.name.endsWith(".log"))
if (!isLog) continue
val dest = File(if (f.isFile) File(target, SessionPaths.TOOLS_DIR).apply { mkdirs() } else target, f.name)
if (dest.exists() && f.name != SessionPaths.TOOLS_DIR) continue
if (move(f, dest)) {
moved++
if (SessionPaths.isSessionFolder(dest)) movedFolders.add(dest)
} else Log.w(TAG, "could not move ${f.name}; left in place")
}
// Earlier builds scrubbed these under older rules (or not at all) and marked them done:
// without their markers, the pass over older folders that follows at the same start puts
// them through the current redactor.
SessionArtifacts.unmarkMoved(movedFolders)
try { marker.writeText("moved $moved item(s)\n") } catch (e: Exception) { Log.w(TAG, "could not mark the move: ${e.message}") }
if (moved > 0) Log.i(TAG, "moved $moved log item(s) from $legacy into $target")
}
/** A rename where it works (same volume), else a copy then the source's removal; false = left as it was. */
private fun move(src: File, dest: File): Boolean {
if (src.renameTo(dest)) return true
return try {
copy(src, dest)
FileUtils.delete(src)
true
} catch (e: Exception) {
Log.w(TAG, "copy of ${src.name} failed: ${e.message}")
false
}
}
private fun copy(src: File, dest: File) {
if (src.isDirectory) {
dest.mkdirs()
src.listFiles()?.forEach { copy(it, File(dest, it.name)) }
} else {
dest.parentFile?.mkdirs()
src.inputStream().use { input -> dest.outputStream().use { input.copyTo(it) } }
}
}
}
@@ -31,16 +31,20 @@ object SessionArtifacts {
/** Written last; a folder without it did not get its ending. */
const val COMPLETE_MARKER = ".complete"
/** Every file in the folder has been through the redactor, own addresses and accounts included (-2: accounts added). */
private const val SCRUBBED_MARKER = ".scrubbed-2"
/**
* Every file in the folder has been through the redactor under its current rules. Named after
* [LogRedactor.RULES_VERSION], so a folder scrubbed under older rules is scrubbed again.
*/
private val SCRUBBED_MARKER = ".scrubbed-r${LogRedactor.RULES_VERSION}"
private val OLD_SCRUBBED_MARKER = Regex("""\.scrubbed-(r?\d+)""")
/**
* Written by a session's own ending, and only when every file in the folder, subfolders
* included (whatever the session script copied into steam/ and droiddeck-esync/ as well as what
* the app wrote), went through the redactor without a failure. It lists each of those files
* with its size and modification time, under the redactor's rules version: a share copies a
* file as it is only when all three still match ([scrubbedFiles]), and scrubs anything else -
* a file added or changed since, a hidden one, or every file of a folder without it.
* with its size and modification time, under the redactor's rules version ([scrubbedFiles]).
* A share no longer relies on it: every text file goes through the share pass on the way into
* the zip regardless.
*/
const val SCRUBBED_TREE_MARKER = ".scrubbed-tree"
@@ -67,24 +71,48 @@ object SessionArtifacts {
}
/**
* Once, for session folders written before every file was scrubbed and before the device's own
* addresses were (network.txt listed them; the client's IPv6 check logs "external address"
* into steam/connection_log.txt): the whole folder, steam/ included, through the redactor.
* A marker records it. Runs at app start with [finishAbandoned].
* Every session folder not yet scrubbed under the redactor's current rules - written before
* every file was scrubbed, before the device's own addresses or the Steam account were, or
* moved in from Download/ ([LogMigration] strips their markers first, [unmarkMoved]): the
* whole folder, steam/ and every other subfolder included, through the redactor, and the
* current marker written in place of the old ones. Runs at app start with [finishAbandoned].
*
* A folder holds some 30 MB of Steam logs, about half a minute's work, so folders go through
* a few at a time; one the process does not get to keeps its old marker and is taken up at
* the next start.
*/
@Synchronized
fun scrubOlder(context: Context) {
val current = SessionPaths.current()
val dirs = LinuxRuntime.debugLogDir().listFiles { f ->
val dirs = LinuxRuntime.logDir(context).listFiles { f ->
SessionPaths.isSessionFolder(f) && f != current && !File(f, SCRUBBED_MARKER).exists()
} ?: return
}?.toList() ?: return
if (dirs.isEmpty()) return
LogRedactor.learnFromRuntime(LinuxRuntime.rootDir(context))
dirs.forEach { dir ->
Record(dir).let { r -> scrubFolder(dir, r); File(dir, "steam").takeIf { it.isDirectory }?.let { scrubFolder(it, r) } }
try { File(dir, SCRUBBED_MARKER).writeText("scrubbed ${now()}\n") } catch (e: Exception) {}
val workers = (Runtime.getRuntime().availableProcessors() / 2).coerceIn(1, 4)
val pool = java.util.concurrent.Executors.newFixedThreadPool(workers) { r ->
Thread({ android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND); r.run() }, "scrub-logs")
}
val done = try {
pool.invokeAll(dirs.map { dir -> java.util.concurrent.Callable { scrubAndMark(dir) } })
.count { f -> try { f.get() } catch (e: Exception) { false } }
} finally {
pool.shutdown()
}
val failed = dirs.size - done
Log.i(TAG, "logs: scrubbed $done folders under r${LogRedactor.RULES_VERSION}" +
if (failed > 0) ", $failed not fully (again at the next start)" else "")
}
/**
* Folders [LogMigration] just moved in lose every scrub marker an earlier build left, so
* [scrubOlder], which runs right after it, puts them through the current rules whatever those
* markers claimed.
*/
fun unmarkMoved(dirs: List<File>) {
dirs.filter { SessionPaths.isSessionFolder(it) }.forEach { dir ->
dir.listFiles { f -> OLD_SCRUBBED_MARKER.matches(f.name) || f.name == SCRUBBED_TREE_MARKER }?.forEach { it.delete() }
}
Log.i(TAG, "scrubbed ${dirs.size} older session folder(s)")
}
/**
@@ -143,15 +171,17 @@ object SessionArtifacts {
* Records [record]'s folder as scrubbed - every file went through without a failure - or
* leaves it unmarked, so the next share and the pass over older folders scrub it again.
*/
private fun markScrubbed(record: Record) {
private fun markScrubbed(record: Record): Boolean {
val dir = record.dir
val tree = File(dir, SCRUBBED_TREE_MARKER)
// A marker from older rules vouches for nothing now, whether or not this pass succeeded.
dir.listFiles { f -> OLD_SCRUBBED_MARKER.matches(f.name) }?.forEach { it.delete() }
if (record.failed) {
tree.delete()
Log.w(TAG, "$dir is not fully scrubbed; it is scrubbed again when shared")
return
return false
}
try {
return try {
File(dir, SCRUBBED_MARKER).writeText("scrubbed ${now()}\n")
val lines = StringBuilder("rules ${LogRedactor.RULES_VERSION}\n")
record.files.forEach { (f, s) ->
@@ -159,8 +189,11 @@ object SessionArtifacts {
.append(f.relativeTo(dir).path).append('\n')
}
tree.writeText(lines.toString())
true
} catch (e: Exception) {
tree.delete()
File(dir, SCRUBBED_MARKER).delete()
false
}
}
@@ -181,9 +214,8 @@ object SessionArtifacts {
}.toSet()
}
/** The end-of-session scrub of [dir] on its own (steam/ already in place), for tests. */
@androidx.annotation.VisibleForTesting
internal fun scrubAndMark(dir: File) = markScrubbed(scrubTree(Record(dir)))
/** The end-of-session scrub of [dir] on its own (steam/ already in place); also the pass over older and moved folders. */
internal fun scrubAndMark(dir: File): Boolean = markScrubbed(scrubTree(Record(dir)))
/**
* [record]'s folder and every folder under it (steam/, droiddeck-esync/): the session script
@@ -223,7 +255,7 @@ object SessionArtifacts {
*/
@Synchronized
fun finishAbandoned(context: Context) {
val parent = LinuxRuntime.debugLogDir()
val parent = LinuxRuntime.logDir(context)
val abandoned = parent.listFiles { f ->
SessionPaths.isSessionFolder(f) && !File(f, COMPLETE_MARKER).exists()
}?.sortedWith(SessionPaths.chronological) ?: return
@@ -282,9 +314,7 @@ object SessionArtifacts {
val current = SessionPaths.current()
val gone = SessionPaths.sessionFolders(context).filter { it != current }
gone.forEach { com.droiddeck.launcher.core.FileUtils.delete(it) }
com.droiddeck.launcher.core.FileUtils.delete(File(LinuxRuntime.debugLogDir(), SessionPaths.TOOLS_DIR))
// Before tools/, those logs sat loose beside the session folders.
LinuxRuntime.debugLogDir().listFiles { f -> f.isFile && f.name.endsWith(".log") }?.forEach { it.delete() }
com.droiddeck.launcher.core.FileUtils.delete(File(LinuxRuntime.logDir(context), SessionPaths.TOOLS_DIR))
Log.i(TAG, "cleared ${gone.size} session folder(s)")
return gone.size
}
@@ -6,6 +6,11 @@ import android.view.WindowManager
/** The virtual display advertised to the guest, before it is fitted onto the Android panel. */
object SessionDisplay {
const val MATCH_SCREEN = "screen"
/** The window's size, kept in step while the session runs: a foldable opening or closing, a
* split screen or a freeform window resizes the guest's display instead of letterboxing it. */
const val FOLLOW_SCREEN = "follow"
/** Below this a side is a picture-in-picture or a sliver of split screen: not worth a resize. */
const val FOLLOW_MIN_SIDE = 480
/**
* Presets are heights, not sizes: "720p" is the panel's own shape at 720 lines, never narrower
@@ -25,7 +30,7 @@ object SessionDisplay {
(maxOf(panel.first, panel.second) and 1.inv()) to (minOf(panel.first, panel.second) and 1.inv())
fun resolveChoice(panel: Pair<Int, Int>, choice: String): Pair<Int, Int> {
if (choice == MATCH_SCREEN) return screenSize(panel)
if (choice == MATCH_SCREEN || choice == FOLLOW_SCREEN) return screenSize(panel)
presetHeight(choice)?.let { return resolve(panel, it, SessionPrefs.SHAPE_AUTO) }
// Fixed sizes (custom, or a preset saved before presets were heights) keep their exact size,
// including legacy ones past the custom dialog's limit.
@@ -34,13 +39,19 @@ object SessionDisplay {
else resolve(panel, 720, SessionPrefs.SHAPE_AUTO)
}
/** The height presets the panel is tall enough for, then the panel itself, with no duplicate sizes. */
/** The height presets the panel is tall enough for, then the panel itself, with no duplicate
* sizes, then Follow screen. */
fun resolutionOptions(panel: Pair<Int, Int>): List<String> {
val panelHeight = minOf(panel.first, panel.second)
return PRESET_HEIGHTS.filter { it <= panelHeight }.map { "${it}p" }
.filter { resolveChoice(panel, it) != screenSize(panel) } + MATCH_SCREEN
.filter { resolveChoice(panel, it) != screenSize(panel) } + MATCH_SCREEN + FOLLOW_SCREEN
}
/** A Follow screen session's display for a window of this size: its own shape, square or
* portrait included, with even sides; null when it is too small to follow (PiP). */
fun followSize(width: Int, height: Int): Pair<Int, Int>? =
if (minOf(width, height) < FOLLOW_MIN_SIDE) null else (width and 1.inv()) to (height and 1.inv())
fun panelSize(context: Context): Pair<Int, Int> {
val manager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
@Suppress("DEPRECATION")
@@ -5,6 +5,7 @@ import android.os.Environment
import android.util.Log
import com.droiddeck.launcher.R
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.runtime.DesktopCatalog
import com.droiddeck.launcher.runtime.LegacyNames
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.ProotFastPath
@@ -90,16 +91,15 @@ object SessionFiles {
"usr/bin/steamos-polkit-helpers/jupiter-biosupdate" to "usr/bin/steamos-polkit-helpers/jupiter-biosupdate",
"usr/bin/steamos-polkit-helpers/jupiter-dock-updater" to "usr/bin/steamos-polkit-helpers/jupiter-dock-updater",
)
// The desktop's launcher and labwc defaults, only where the desktop package is installed:
// The desktop's launchers, only where the desktop package is installed:
// staging them into a runtime without it would make the desktop look present when it is not.
val desktop = arrayOf(
"usr/local/bin/droiddeck-desktop" to "usr/local/bin/droiddeck-desktop",
// Games and emulators from the menu, full screen in a gamescope of their own.
"usr/local/bin/droiddeck-gpu" to "usr/local/bin/droiddeck-gpu",
"usr/local/bin/droiddeck-desktop-gpu" to "usr/local/bin/droiddeck-desktop-gpu",
"etc/xdg/labwc/autostart" to "etc/xdg/labwc/autostart",
"etc/xdg/labwc/rc.xml" to "etc/xdg/labwc/rc.xml",
"etc/xdg/lxqt/panel.conf" to "etc/xdg/lxqt/panel.conf",
// KWin at the app's surface size, for Plasma's session (it starts KWin through this name).
"usr/local/bin/kwin_wayland_wrapper" to "usr/local/bin/kwin_wayland_wrapper",
"usr/lib/firefox/defaults/pref/droiddeck.js" to "usr/lib/firefox/defaults/pref/droiddeck.js",
)
// The patched gamescope (tools/gamescope): the runtime's own version rebuilt with the ARM64
@@ -117,13 +117,9 @@ object SessionFiles {
"usr/local/lib/mangoapp/libtracefs.so.1",
).map { it to it }
// What the Windows components installer reads .msi packages with (tools/msitools).
val msitools = listOf("msiinfo", "cabextract", "libmsi-1.0.so.0", "libgsf-1.so.114", "libgcab-1.0.so.0")
val msitools = listOf("msiinfo", "cabextract", "7z", "7z.so", "libmsi-1.0.so.0", "libgsf-1.so.114", "libgcab-1.0.so.0")
.map { "usr/local/lib/droiddeck-msitools/$it" } +
listOf("NOTICE", "GPL-2", "GPL-3", "LGPL-2.1").map { "usr/local/share/licenses/droiddeck-msitools/$it" }
// The patched wlroots (tools/wlroots) the desktop loads for its vulkan / gles2 renderers.
val wlroots = if (File(root, "usr/bin/labwc").isFile) {
arrayOf("usr/local/lib/droiddeck-wlroots/libwlroots-0.20.so" to "usr/local/lib/droiddeck-wlroots/libwlroots-0.20.so")
} else emptyArray()
listOf("NOTICE", "GPL-2", "GPL-3", "LGPL-2.1", "7zip-License", "7zip-unRarLicense").map { "usr/local/share/licenses/droiddeck-msitools/$it" }
val fexPreloads = listOf("x86_64", "i386").flatMap { arch ->
listOf("libblsession.so", "libfakeinput.so").map { "$arch/$it" to "usr/local/lib/droiddeck-fex/$arch/$it" }
} + listOf("libfaultreport.so", "libthunkaudit.so", "libvulkan-thunk.so").map { "x86_64/$it" to "usr/local/lib/droiddeck-fex/x86_64/$it" }
@@ -131,11 +127,11 @@ 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",
) + wlroots + mangoapp + msitools.map { it to it } + fexPreloads).filter { (asset, _) ->
) + mangoapp + msitools.map { it to it } + fexPreloads).filter { (asset, _) ->
val dir = asset.substringBeforeLast('/')
runCatching { context.assets.list("linuxfs/$dir")?.contains(asset.substringAfterLast('/')) == true }.getOrDefault(false)
}
val all = (if (File(root, "usr/bin/labwc").isFile) files + desktop else files) + optional
val all = (if (DesktopCatalog.desktopInstalled(root)) files + desktop else files) + optional
for ((asset, relative) in all) {
val target = File(root, relative)
val staged = File(target.parentFile, target.name + ".staged")
@@ -365,25 +361,9 @@ object SessionFiles {
).joinToString(newline)
/**
* Where the session writes its log. Downloads is the point - a failed run is handed over as a
* folder rather than dug out of app-private storage - but the session script redirects its own
* output there with `exec`, and a redirection a non-interactive shell cannot open ends that
* shell. So a public directory is used only once it is proven writable; otherwise the app's
* own files directory, which is bound into the session anyway, stands in.
* Where the session writes its log: app-private `files/logs`, bound into the session at the same
* path, so the session script's own redirection always opens. A folder leaves the device only
* through Share logs, which scrubs every file again on the way into the zip.
*/
fun logDirectory(context: Context): File {
val public = LinuxRuntime.debugLogDir()
if (public.isDirectory || public.mkdirs()) {
val probe = File(public, ".writable")
try {
if (probe.createNewFile() || probe.isFile) {
probe.delete()
return public
}
} catch (ignored: Exception) {
}
}
Log.w(TAG, "$public is not writable (storage permission?); logging to files/logs")
return File(context.filesDir, "logs").apply { mkdirs() }
}
fun logDirectory(context: Context): File = LinuxRuntime.logDir(context).apply { mkdirs() }
}
@@ -18,9 +18,11 @@ import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
/**
* Zips the most recent session's log folder and hands it to Android's share sheet. Works where
* the folder could not be written to Downloads (no storage permission, or a device that refuses
* it) and landed in the app's private files instead, which a user cannot otherwise reach.
* Share logs: one zip, made when asked, of a session folder (the newest by default) with the last
* seven days of the stores' log and the one-off command logs beside it, handed to Android's share
* sheet. Logs live in app-private `files/logs`; this is how they leave the device. Every text file
* goes through [LogRedactor.redactForShare] on the way in, so even a file written before a rule
* existed is clean in the zip. The zip sits in `cache/share/` until the next share or app start.
*/
object SessionLogShare {
private val main = Handler(Looper.getMainLooper())
@@ -62,7 +64,7 @@ object SessionLogShare {
val files = folder.walkTopDown().filter { it.isFile }
.filterNot { it.parentFile?.name == "steam" && it.length() > STEAM_LOG_MAX_BYTES }.toList()
if (files.isEmpty()) return null
val out = File(context.cacheDir, "shared-logs").apply { deleteRecursively(); mkdirs() }
val out = shareDir(context).apply { deleteRecursively(); mkdirs() }
val zip = File(out, "DroidDeck-${folder.name}.zip")
// Scrubbed on the way into the zip: a session shared while it runs has not had its end-of-
// session pass yet, and the redactor changes nothing in a line that is already clean.
@@ -71,11 +73,11 @@ object SessionLogShare {
// since, goes in as it is; anything else (added or changed since, hidden, or any file of a
// session still running) is scrubbed again. Scrubbing tens of MB of the client's logs on
// every share kept the share sheet from appearing for ten seconds or more.
val scrubbed = SessionArtifacts.scrubbedFiles(folder)
val live = liveSteamLogs(context, folder)
// The stores' own log (last 7 days, app-private, already redacted), under stores/.
val storeLogs = com.droiddeck.launcher.stores.StoreLogFiles.files(context)
val total = (files + live + storeLogs).sumOf { it.length() }.coerceAtLeast(1L)
val logs = LinuxRuntime.logDir(context)
val stores = recent(File(logs, STORES_DIR))
val tools = recent(File(logs, SessionPaths.TOOLS_DIR))
val total = (files + live + stores + tools).sumOf { it.length() }.coerceAtLeast(1L)
var done = 0L
var shown = -1
fun advance(f: File) {
@@ -84,18 +86,20 @@ object SessionLogShare {
if (percent != shown) { shown = percent; onProgress?.invoke(percent / 100f) }
}
ZipOutputStream(zip.outputStream().buffered()).use { z ->
files.forEach { f -> addEntry(z, folder.name + "/" + f.relativeTo(folder).path, f, f.relativeTo(folder).path in scrubbed); advance(f) }
live.forEach { f -> addEntry(z, folder.name + "/steam/" + f.name, f, false); advance(f) }
storeLogs.forEach { f -> addEntry(z, folder.name + "/stores/" + f.name, f, false); advance(f) }
files.forEach { f -> addEntry(z, folder.name + "/" + f.relativeTo(folder).path, f); advance(f) }
live.forEach { f -> addEntry(z, folder.name + "/steam/" + f.name, f); advance(f) }
stores.forEach { f -> addEntry(z, "$STORES_DIR/" + f.name, f); advance(f) }
tools.forEach { f -> addEntry(z, SessionPaths.TOOLS_DIR + "/" + f.name, f); advance(f) }
}
return zip
}
private fun addEntry(z: ZipOutputStream, name: String, f: File, scrubbed: Boolean) {
private fun addEntry(z: ZipOutputStream, name: String, f: File) {
z.putNextEntry(ZipEntry(name))
if (!scrubbed && LogRedactor.isText(f)) {
// Every text file, every time: the folder's own scrub may predate a rule.
if (LogRedactor.isText(f)) {
val w = z.bufferedWriter()
LogRedactor.scrubTo(f, w)
LogRedactor.scrubForShare(f, w)
w.flush()
} else {
f.inputStream().use { it.copyTo(z) }
@@ -119,6 +123,25 @@ object SessionLogShare {
/** The client's content and bootstrap logs grow large over months and say nothing about a session. */
private const val STEAM_LOG_MAX_BYTES = 8L * 1024 * 1024
/** The stores' engine log, one file a day, under files/logs. */
const val STORES_DIR = "stores"
private const val RECENT_DAYS = 7
private fun shareDir(context: Context): File = File(context.cacheDir, "share")
/** The files in [dir] changed in the last [RECENT_DAYS] days. */
private fun recent(dir: File): List<File> {
val since = System.currentTimeMillis() - RECENT_DAYS * 86_400_000L
return dir.listFiles { f -> f.isFile && f.lastModified() >= since }?.sortedBy { it.name }.orEmpty()
}
/** Deletes the last share's zip; at app start, so a zip never outlives the share it was made for. */
fun clear(context: Context) {
shareDir(context).deleteRecursively()
// Where builds before this one put it.
File(context.cacheDir, "shared-logs").deleteRecursively()
}
fun shareIntent(context: Context, zip: File): Intent {
val uri = FileProvider.getUriForFile(context, context.packageName + ".logs", zip)
val send = Intent(Intent.ACTION_SEND)
@@ -8,19 +8,20 @@ import java.util.Date
import java.util.Locale
/**
* One folder per session under `Download/DroidDeck/`, holding everything that session recorded,
* One folder per session under app-private `files/logs/`, holding everything that session recorded,
* named for the day, that day's session number and what was run, so the one a report is about can
* be picked out without opening any:
*
* ```
* Download/DroidDeck/2026-09-30-03-steam/
* files/logs/2026-09-30-03-steam/
* device.txt what this device is, and every setting the session ran with
* session.log the guest session: proot, gamescope, the client's stdout
* wayland.log the app's compositor
* steam.log the Steam client's own log, scrubbed (Steam mode)
* steam/ the rest of the client's logs, scrubbed (Steam mode)
* desktop.log labwc, the panel and the programs on it (desktop mode)
* Download/DroidDeck/tools/ one-off commands: Flatpak installs, AppImage imports
* desktop.log KWin, Plasma and the programs on it (desktop mode)
* files/logs/tools/ one-off commands: Flatpak installs, AppImage imports
* files/logs/stores/ the stores' engine log, one file a day
* ```
*
* Folders from before this naming (`session-20260930-180642`) are still recognised, shared and
@@ -137,8 +138,7 @@ object SessionPaths {
/** Every session folder in the places logs are written, oldest first. */
fun sessionFolders(context: Context): List<File> =
listOf(com.droiddeck.launcher.runtime.LinuxRuntime.debugLogDir(), File(context.filesDir, "logs"))
.flatMap { parent -> parent.listFiles { f -> isSessionFolder(f) }?.toList() ?: emptyList() }
(com.droiddeck.launcher.runtime.LinuxRuntime.logDir(context).listFiles { f -> isSessionFolder(f) }?.toList() ?: emptyList())
.sortedWith(chronological)
internal fun slug(text: String): String =
@@ -493,7 +493,7 @@ object SessionPrefs {
}
/**
* Whether a session writes its folder under Download/DroidDeck. Off, the same logs are kept in
* Whether a session keeps its folder under files/logs. Off, the same logs are kept in
* the app's cache for the session's lifetime (the scripts need somewhere to write) and thrown
* away at the end, so nothing accumulates in Downloads.
*/
@@ -533,7 +533,8 @@ object SessionPrefs {
fun resolutionChoice(context: Context, mode: String, panel: Pair<Int, Int>): String {
val saved = prefs(context)
saved.getString("displayResolution.$mode", null)?.let { value ->
if (value == SessionDisplay.MATCH_SCREEN || SessionDisplay.presetHeight(value) != null) return value
if (value == SessionDisplay.MATCH_SCREEN || value == SessionDisplay.FOLLOW_SCREEN ||
SessionDisplay.presetHeight(value) != null) return value
parseResolution(value)?.let { return "${it.first}x${it.second}" }
}
if (!resolutionChosen(context, mode) && !saved.contains("shape")) return SessionDisplay.DEFAULT_RESOLUTION
@@ -543,7 +544,8 @@ object SessionPrefs {
}
fun setResolutionChoice(context: Context, mode: String, choice: String) {
val value = if (choice == SessionDisplay.MATCH_SCREEN || SessionDisplay.presetHeight(choice) != null) choice else {
val value = if (choice == SessionDisplay.MATCH_SCREEN || choice == SessionDisplay.FOLLOW_SCREEN ||
SessionDisplay.presetHeight(choice) != null) choice else {
val size = requireNotNull(parseResolution(choice)) { "Invalid resolution" }
"${size.first}x${size.second}"
}
@@ -678,21 +680,6 @@ object SessionPrefs {
return Pair(w and 1.inv(), h and 1.inv())
}
/**
* What the desktop shell composites with: vulkan (the default) or gles2 on the GPU, through the
* app's patched wlroots (tools/wlroots) - the Adreno stand-in is not a DRM device and stock
* wlroots cannot allocate on it - or pixman in software. A GPU renderer a device cannot start
* falls back to pixman by itself (droiddeck-desktop). `Download/droiddeck-wlr-renderer` still
* overrides it.
*/
fun desktopRenderer(context: Context): String = prefs(context).getString("desktopRenderer", "vulkan") ?: "vulkan"
fun setDesktopRenderer(context: Context, renderer: String) {
prefs(context).edit().putString("desktopRenderer", renderer).apply()
// A choice made again is a retry: forget that a renderer failed to start here before.
java.io.File(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context), "root/.droiddeck-renderer-failed").delete()
}
/**
* HDR10 output for MODE_STEAM / MODE_DESKTOP. Off by default. Honoured only when the panel
* lists HDR10 (HdrSupport), and decided when the compositor starts, which is once per app
@@ -354,6 +354,9 @@ class SessionService : Service() {
guest.add("BL_WIDTH=" + size.first)
guest.add("BL_HEIGHT=" + size.second)
// Follow screen: the output is resized under gamescope when a foldable opens or closes,
// and the session script asks gamescope to resize Steam's X screen along with it.
if (SessionState.followScreen) guest.add("BL_FOLLOW_OUTPUT=1")
if (SessionState.hdr) {
// The activity opened the compositor's HDR gate: gamescope offers HDR to its clients
// and DXVK takes the HDR10 swapchain when a game asks for one.
@@ -371,16 +374,6 @@ class SessionService : Service() {
SessionState.deckPad = false
deckBinds = emptyList()
if (controllersOn) addControllerEnvironment(guest, fakeInputDir, sessionDir)
// The desktop is wlroots (labwc). Stock wlroots allocates through gbm on a real DRM render
// node, and ours is a KGSL stand-in - labwc died at "unable to create allocator" - so the
// default is pixman (software, shm), where a Vulkan program cannot draw at all; those run
// through droiddeck-gpu instead. vulkan / gles2 use the app's patched wlroots and fall back
// to pixman by themselves. droiddeck-wlr-renderer in Downloads overrides the choice.
if (SessionState.mode == MODE_DESKTOP) {
val override = File(Environment.getExternalStorageDirectory(), "Download/droiddeck-wlr-renderer")
.takeIf { it.isFile }?.let { FileUtils.readString(it)?.trim() }
guest.add("BL_WLR_RENDERER=" + (override?.takeIf { it.isNotEmpty() } ?: SessionPrefs.desktopRenderer(this)))
}
// The user's own games, for the runtime's shortcuts writer to put in the client's library
// before the client starts (see frontend/AddedGames and droiddeck-steam-shortcuts).
if (steamHere) {
@@ -396,9 +389,6 @@ class SessionService : Service() {
// The second library's name, for droiddeck-steam-library; the bind itself is made below.
GameStorage.effective(this)?.let { guest.add("BL_LIBRARY_LABEL=" + it.label.replace('"', ' ')) }
if (SessionState.mode == MODE_STEAM && SessionState.steamUi == "desktop") guest.add("BL_STEAM_UI=desktop")
// The desktop asked for with Steam in it (the front end's "Steam Desktop UI", Big Picture's
// "Switch to Desktop"): the desktop's autostart opens the client's desktop UI there.
if (SessionState.mode == MODE_DESKTOP && SessionState.steamUi == "desktop") guest.add("BL_DESKTOP_STEAM=1")
val shellGuest = ArrayList(guest).apply {
add("SHELL=/bin/bash")
add("TERM=xterm-256color")
@@ -414,7 +404,7 @@ class SessionService : Service() {
}
// A program under gamescope: the script's run mode takes the path (an AppImage, a script
// or a binary inside the runtime). This is how an emulator gets the GPU - the desktop's
// labwc composites in software and offers no dma-buf, so a Vulkan swapchain cannot exist
// KWin composites in software and offers no dma-buf, so a Vulkan swapchain cannot exist
// there (RPCS3 died with VK_ERROR_SURFACE_LOST); gamescope's Xwayland is the path the
// Steam games already render through.
if (SessionState.mode == MODE_RUN) {
@@ -96,6 +96,10 @@ object SessionState {
@Volatile
var outputSize: Pair<Int, Int> = Pair(1920, 1080)
/** The session's resolution is "Follow screen": outputSize tracks the window while it runs. */
@Volatile
var followScreen = false
@Volatile
var refreshHz: Float = 60f
@@ -47,16 +47,35 @@ object WinComponents {
// at the same path, so the native file at that path is the one the registration loads.
private val FILE_STEPS = setOf("download_archive", "archive_extract", "copy_dll", "copy_file", "override_dll", "register_dll")
private val INSTALLER_STEPS = setOf("install_exe", "install_msi")
/**
* Steps done here without any installer running: a Windows version or registry value for the
* prefix (written by droiddeck-wincomponents with the rest), files picked out of a cabinet, and
* "uninstall Wine Mono", which the mscoree override beside it already does for the game.
*/
private val OFFLINE_STEPS = setOf("set_windows", "set_register_key", "get_from_cab", "uninstall")
/**
* Installers that are their own setup program (NSIS, InnoSetup, IExpress scripts): nothing
* inside them is a package to lay out, so they wait for a way to run them.
*/
private val RUNS_OWN_SETUP = setOf(
"K-Lite", "ffdshow", "lavfilters702", "lavfilters741", "quicktime72", "dirac", "webview2", "aairruntime",
"gfw", "ie8_kb2936068", "art2kmin", "art2k7min", "vcredist6sp6", "VulkanRT", "jet40", "mdac28", "oalinst",
"dotnet20", "dotnet20sp1", "dotnet35", "dotnet35sp1",
)
private const val MSI_INSTALL = "/usr/local/bin/droiddeck-msi-install"
/** Where a downloaded .msi waits for the installer, inside the runtime so it can read it. */
/** Where a downloaded package or installer waits for the installer, inside the runtime so it can read it. */
private const val MSI_CACHE = "$STORE/.packages"
/** Catalog entries Proton already provides newer copies of, which an install would only shadow. */
private val PROTON_PROVIDES = setOf("gecko")
private val PROTON_PROVIDES = setOf("gecko", "mono")
/** The keys the catalog nests under "environment" on a few .NET entries. */
private val NESTED_KEYS = setOf("url", "file_name", "file_checksum", "file_size")
fun validId(id: String): Boolean = ID.matches(id) && ".." !in id
class Step(val action: String, val json: JSONObject) {
fun str(key: String): String = json.optString(key, "")
fun str(key: String): String = json.optString(key, "").ifEmpty {
if (key in NESTED_KEYS) json.optJSONObject("environment")?.optString(key, "").orEmpty() else ""
}
}
class Component(
@@ -66,10 +85,27 @@ object WinComponents {
enum class Support { READY, NEEDS_INSTALLER, UNSUPPORTED }
/** A step that installs a Windows Installer package, which droiddeck-msi-install does here. */
private fun isMsi(step: Step): Boolean = step.action in INSTALLER_STEPS && step.str("url").startsWith("https://") &&
/** The two halves of an install the page shows one after the other, each 0..100. */
enum class Phase { DOWNLOAD, INSTALL }
/** Progress: the component being worked on, what it is doing, the phase, 0..100 or -1 when unknown. */
class Progress(val component: String, val stage: String, val phase: Phase, val percent: Int)
/** The percent a droiddeck-msi-install progress line carries ("progress 37% placing files"), or -1. */
private val PERCENT_LINE = Regex("""^(\d{1,3})% (.*)$""")
private fun engineLine(text: String): Pair<String, Int> =
PERCENT_LINE.find(text)?.let { it.groupValues[2] to it.groupValues[1].toInt().coerceIn(0, 100) } ?: (text to -1)
/**
* A step that installs a Windows Installer package, or an installer .exe that is a wrapper
* around packages (a WiX bundle, a self-extracting cabinet or 7-Zip archive), which
* droiddeck-msi-install lays out here without running it.
*/
private fun isPackage(step: Step): Boolean = step.action in INSTALLER_STEPS && step.str("url").startsWith("https://") &&
(step.action == "install_msi" || listOf(step.str("file_name"), step.str("url").substringBefore('?'))
.any { it.endsWith(".msi", ignoreCase = true) })
.any { it.endsWith(".msi", ignoreCase = true) || it.endsWith(".exe", ignoreCase = true) })
private fun protonProvides(name: String): Boolean = name in PROTON_PROVIDES || name.startsWith("mono-")
fun fetch(): List<Component>? {
val body = Downloader.downloadString(CATALOG_URL) ?: return null
@@ -94,13 +130,14 @@ object WinComponents {
/** Whether [c] can be installed here, its bundled components included. */
fun support(c: Component, all: Map<String, Component>, depth: Int = 0): Support {
if (c.status != "ready" || depth > 8 || c.name in PROTON_PROVIDES) return Support.UNSUPPORTED
if (c.status != "ready" || depth > 8 || protonProvides(c.name)) return Support.UNSUPPORTED
val installers = c.steps.filter { it.action in INSTALLER_STEPS }
fun offline(step: Step) = step.action == "delete_dlls" || step.action in OFFLINE_STEPS || step.action in FILE_STEPS && fileStepOk(step)
val own = when {
installers.isNotEmpty() && installers.all { isMsi(it) } &&
c.steps.all { it in installers || it.action == "delete_dlls" || it.action in FILE_STEPS && fileStepOk(it) } -> Support.READY
installers.isNotEmpty() && c.name !in RUNS_OWN_SETUP && installers.all { isPackage(it) } &&
c.steps.all { it in installers || offline(it) } -> Support.READY
installers.isNotEmpty() -> Support.NEEDS_INSTALLER
c.steps.all { it.action in FILE_STEPS && fileStepOk(it) } -> Support.READY
c.steps.all { offline(it) } -> Support.READY
else -> Support.UNSUPPORTED
}
if (own != Support.READY) return own
@@ -109,9 +146,10 @@ object WinComponents {
}
private fun fileStepOk(step: Step): Boolean = when (step.action) {
// An .exe or .cab archive (DirectX's redistributable) is opened by the runtime's tools.
"download_archive", "archive_extract" -> step.str("url").let { url ->
!url.startsWith("http") || url.startsWith("https://github.com/") &&
url.substringBefore('?').let { it.endsWith(".tar.xz") || it.endsWith(".zip") }
url.substringBefore('?').lowercase().let { it.endsWith(".tar.xz") || it.endsWith(".zip") || it.endsWith(".exe") || it.endsWith(".cab") }
}
"copy_dll", "copy_file" -> ".." !in step.str("dest")
else -> true
@@ -131,7 +169,7 @@ object WinComponents {
* Installs [c] and the components it bundles that are not installed yet. [onProgress] gets a
* line for the step and 0..100 (or -1). Returns null on success, else a message.
*/
fun install(context: Context, c: Component, all: Map<String, Component>, onProgress: (String, Int) -> Unit): String? {
fun install(context: Context, c: Component, all: Map<String, Component>, onProgress: (Progress) -> Unit): String? {
if (support(c, all) != Support.READY) return "${c.name} cannot be installed here yet"
val order = ArrayList<Component>()
fun visit(x: Component, depth: Int) {
@@ -146,7 +184,7 @@ object WinComponents {
val archives = HashMap<String, File>()
return try {
for (x in order) {
onProgress(x.name, -1)
onProgress(Progress(x.name, x.name, Phase.DOWNLOAD, -1))
installOne(context, x, work, archives, onProgress)?.let { return "${x.name}: $it" }
}
null
@@ -158,18 +196,27 @@ object WinComponents {
}
}
private fun installOne(context: Context, c: Component, work: File, archives: HashMap<String, File>, onProgress: (String, Int) -> Unit): String? {
private fun installOne(context: Context, c: Component, work: File, archives: HashMap<String, File>, onProgress: (Progress) -> Unit): String? {
val root = LinuxRuntime.rootDir(context)
if (!root.isDirectory) return "The Linux runtime is not installed"
val staging = File(root, "$STORE/.${c.name}.new").apply { FileUtils.delete(this); mkdirs() }
val overrides = ArrayList<String>()
var source: File? = null
var msi: JSONObject? = null
// The registry values the steps themselves set (a Windows version, a key), beside the packages'.
val registry = ArrayList<JSONObject>()
// Archives the runtime's tools opened (installer .exe, cabinets), by the name the catalog
// calls them, and the folders they were opened into; cleaned up at the end.
val runtimeArchives = HashMap<String, File>()
val runtimeDirs = ArrayList<File>()
val cabs = HashMap<String, File>()
val temp = File(root, "$MSI_CACHE/.t-${c.name}").apply { FileUtils.delete(this) }
try {
for (step in c.steps) when (step.action) {
// A component may have several packages (PowerShell's 32- and 64-bit): each adds to the
// same folder, the first one names the component.
"install_msi", "install_exe" -> {
val (result, problem) = installMsi(context, c, step, staging, onProgress)
val (result, problem) = installPackage(context, c, step, staging, onProgress)
if (result == null) return problem
msi = msi?.apply {
val notes = optJSONArray("notes") ?: JSONArray().also { put("notes", it) }
@@ -183,19 +230,84 @@ object WinComponents {
if (!url.startsWith("http")) continue
source = archives[url] ?: run {
val name = url.substringBefore('?').substringAfterLast('/')
val file = File(work, "${archives.size}-$name")
val ok = Downloader.downloadFile(url, file, false) { f -> onProgress("${c.name}: $name", if (f < 0) -1 else Math.round(f * 100f)) }
// A zip or tar.xz is opened here; an .exe or .cab by the runtime's tools, so it
// is downloaded where the runtime can read it and kept for get_from_cab steps.
val byRuntime = name.lowercase().let { it.endsWith(".exe") || it.endsWith(".cab") }
val file = if (byRuntime) File(root, "$MSI_CACHE/${archives.size}-$name").apply { parentFile?.mkdirs() }
else File(work, "${archives.size}-$name")
val ok = Downloader.downloadFile(url, file, false) { f -> onProgress(Progress(c.name, name, Phase.DOWNLOAD, if (f < 0) -1 else Math.round(f * 100f))) }
if (!ok) return "download failed: $name"
step.str("file_checksum").takeIf { it.length == 32 }?.let { md5 ->
if (!digest(file, "MD5").equals(md5, ignoreCase = true)) return "checksum mismatch: $name"
}
onProgress("${c.name}: unpacking $name", -1)
val dir = File(work, "${archives.size}-x").apply { mkdirs() }
if (!extract(file, dir)) return "could not unpack $name"
file.delete()
onProgress(Progress(c.name, "unpacking $name", Phase.INSTALL, -1))
val dir = if (byRuntime) {
runtimeArchives[step.str("file_name").ifEmpty { name }] = file
runtimeDirs += file
unpackInRuntime(context, c, file, "${archives.size}-x", onProgress)?.also { runtimeDirs += it }
?: return "could not unpack $name"
} else {
File(work, "${archives.size}-x").apply { mkdirs() }.also { if (!extract(file, it)) return "could not unpack $name" }
.also { file.delete() }
}
dir.also { archives[url] = it }
}
}
// Files picked out of a cabinet: one the catalog downloaded (DirectX's redistributable,
// a self-extracting cabinet), or cabinets an earlier pick put under temp/.
"get_from_cab" -> {
val pattern = step.str("source")
val containers = runtimeArchives[pattern]?.let { listOf(it) } ?: run {
val folder = File(temp, pattern.substringBeforeLast('/', "").replace('\\', '/'))
val rx = globRegex(pattern.substringAfterLast('/'))
folder.listFiles { f -> f.isFile && rx.matches(f.name) }?.sortedBy { it.name }.orEmpty()
}
if (containers.isEmpty()) return "nothing is called $pattern"
val dest = step.str("dest").replace('\\', '/')
for (container in containers) {
val unpacked = cabs.getOrPut(container.path) {
unpackInRuntime(context, c, container, "c${cabs.size}", onProgress)?.also { runtimeDirs += it }
?: return "could not open ${container.name}"
}
if (dest.startsWith("temp/", ignoreCase = true)) {
copyMatching(unpacked, step.str("file_name"), File(temp, dest.substring(5).trimEnd('/')), null)
} else {
val (arch, base) = when (dest.substringBefore('/').lowercase()) {
"win64", "system32" -> "win64" to "system32"
"win32", "syswow64" -> "win32" to "syswow64"
else -> null to "system32"
}
val sub = dest.substringAfter('/', "").trimEnd('/')
copyMatching(unpacked, step.str("file_name"), File(staging, if (sub.isEmpty()) base else "$base/$sub"), arch)
}
}
}
// The Windows version a game sees: HKCU\Software\Wine "Version", the last word wins.
"set_windows" -> step.str("version").takeIf { it.isNotEmpty() }?.let { version ->
registry.removeAll { it.optString("key") == "Software\\Wine" && it.optString("name") == "Version" }
registry += JSONObject().put("hive", "HKCU").put("key", "Software\\Wine").put("name", "Version").put("type", "sz").put("data", version)
}
"set_register_key" -> {
val full = step.str("key").replace("\\\\", "\\").trim('\\')
val hive = when (full.substringBefore('\\').uppercase()) {
"HKLM", "HKEY_LOCAL_MACHINE" -> "HKLM"
"HKCU", "HKEY_CURRENT_USER" -> "HKCU"
else -> return "a registry key outside HKLM and HKCU: $full"
}
val key = full.substringAfter('\\', "")
if (key.isEmpty()) return "a registry value without a key: $full"
val data = step.str("data")
val value = JSONObject().put("hive", hive).put("key", key).put("name", step.str("value"))
when (step.str("type").uppercase()) {
"REG_DWORD" -> value.put("type", "dword").put("data", data.trim().let { it.removePrefix("0x").toLongOrNull(if (it.startsWith("0x")) 16 else 10) ?: 0L })
"REG_EXPAND_SZ" -> value.put("type", "expand_sz").put("data", data)
else -> value.put("type", "sz").put("data", data)
}
registry += value
}
// "Uninstall Wine Mono" before a real .NET Framework: the mscoree override the catalog
// sets beside it is what takes Mono out of the game's way; nothing to remove here.
"uninstall" -> Unit
"copy_dll", "copy_file" -> {
val from = source ?: return "a copy step before any archive"
val dest = step.str("dest")
@@ -226,6 +338,17 @@ object WinComponents {
"register_dll" -> Unit
else -> return "unsupported step ${step.action}"
}
} finally {
runtimeDirs.forEach { FileUtils.delete(it) }
FileUtils.delete(temp)
}
if (registry.isNotEmpty()) {
// The packages' values are already in registry.json; the steps' own go after them.
val file = File(staging, "registry.json")
val values = runCatching { JSONObject(file.readText()).optJSONArray("values") }.getOrNull() ?: JSONArray()
registry.forEach { values.put(it) }
FileUtils.writeString(file, JSONObject().put("version", 1).put("values", values).toString(1))
}
val version = msi?.optString("version")?.takeIf { it.isNotEmpty() }
?: Regex("""\b(\d+\.\d+(\.\d+)*)\b""").find(c.description)?.value ?: "catalog"
val meta = JSONObject()
@@ -240,31 +363,64 @@ object WinComponents {
return null
}
/** The regex for a catalog file pattern: * matches anything, case does not matter. */
private fun globRegex(pattern: String) =
Regex("^" + pattern.split("*").joinToString(".*") { Regex.escape(it) } + "$", RegexOption.IGNORE_CASE)
/**
* Downloads the component's .msi into the runtime and has droiddeck-msi-install lay it out in
* [staging]. Returns the installer's result (product, version, counts, notes), or null and why.
* Everything the installer prints also goes to Download/DroidDeck/tools.
* Has the runtime's tools open [archive] (an installer .exe, a cabinet, a self-extracting
* one) into a folder of the package cache called [tag]; that folder, or null and a log line.
*/
private fun installMsi(context: Context, c: Component, step: Step, staging: File, onProgress: (String, Int) -> Unit): Pair<JSONObject?, String> {
private fun unpackInRuntime(context: Context, c: Component, archive: File, tag: String, onProgress: (Progress) -> Unit): File? {
val root = LinuxRuntime.rootDir(context)
val cache = File(root, MSI_CACHE)
val dir = File(cache, ".x-$tag").apply { FileUtils.delete(this); mkdirs() }
val inside = archive.relativeTo(root).path
var problem: String? = null
var ok = false
val status = GuestCommand.run(context, listOf(MSI_INSTALL, "--unpack", "/$inside", "/$MSI_CACHE/${dir.name}"),
logName = "wincomponents-${c.name}") { line ->
when {
line.startsWith("progress ") -> engineLine(line.removePrefix("progress ")).let { (text, _) -> onProgress(Progress(c.name, text, Phase.INSTALL, -1)) }
line.startsWith("result ") -> ok = true
line.startsWith("error ") -> problem = line.removePrefix("error ")
}
}
if (status != 0 || !ok) {
Log.w(TAG, "unpack ${archive.name}: ${problem ?: "status $status"}")
FileUtils.delete(dir)
return null
}
return dir
}
/**
* Downloads the component's package (.msi) or installer (.exe) into the runtime and has
* droiddeck-msi-install lay it out in [staging]. Returns the installer's result (product,
* version, counts, notes), or null and why. Everything the installer prints also goes to
* files/logs/tools.
*/
private fun installPackage(context: Context, c: Component, step: Step, staging: File, onProgress: (Progress) -> Unit): Pair<JSONObject?, String> {
val root = LinuxRuntime.rootDir(context)
val url = step.str("url")
val name = url.substringBefore('?').substringAfterLast('/')
val cache = File(root, MSI_CACHE).apply { mkdirs() }
val file = File(cache, "${c.name}.msi")
val ext = if (listOf(step.str("file_name"), name).any { it.endsWith(".exe", ignoreCase = true) }) "exe" else "msi"
val file = File(cache, "${c.name}-${c.steps.indexOf(step)}.$ext")
try {
if (!Downloader.downloadFile(url, file, false) { f -> onProgress("${c.name}: $name", if (f < 0) -1 else Math.round(f * 100f)) }) {
if (!Downloader.downloadFile(url, file, false) { f -> onProgress(Progress(c.name, name, Phase.DOWNLOAD, if (f < 0) -1 else Math.round(f * 100f))) }) {
return null to "download failed: $name"
}
step.str("file_checksum").takeIf { it.length == 32 }?.let { md5 ->
if (!digest(file, "MD5").equals(md5, ignoreCase = true)) return null to "checksum mismatch: $name"
}
onProgress("${c.name}: installing", -1)
onProgress(Progress(c.name, "installing", Phase.INSTALL, 0))
var result: JSONObject? = null
var problem: String? = null
val status = GuestCommand.run(context, listOf(MSI_INSTALL, "/$MSI_CACHE/${file.name}", "/$STORE/${staging.name}"),
logName = "wincomponents-${c.name}") { line ->
when {
line.startsWith("progress ") -> onProgress("${c.name}: ${line.removePrefix("progress ")}", -1)
line.startsWith("progress ") -> engineLine(line.removePrefix("progress ")).let { (text, pct) -> onProgress(Progress(c.name, text, Phase.INSTALL, pct)) }
line.startsWith("result ") -> result = runCatching { JSONObject(line.removePrefix("result ")) }.getOrNull()
line.startsWith("error ") -> problem = line.removePrefix("error ")
}
@@ -273,7 +429,7 @@ object WinComponents {
if (status != 0 || done == null) return null to (problem ?: "the installer stopped (status $status)")
return done to ""
} catch (e: Exception) {
Log.e(TAG, "msi ${c.name}", e)
Log.e(TAG, "package ${c.name}", e)
return null to (e.message ?: "the installer failed")
} finally {
file.delete()
@@ -0,0 +1,105 @@
package com.droiddeck.launcher.stores
import android.os.Build
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import android.util.Base64
import org.json.JSONObject
import java.security.KeyStore
import javax.crypto.Cipher
import javax.crypto.KeyGenerator
import javax.crypto.SecretKey
import javax.crypto.spec.GCMParameterSpec
/**
* The stores' sign-in files at rest: AES-256-GCM under a key that lives in the AndroidKeyStore and
* never leaves it, as a small versioned envelope `{"v":1,"alg":"AES/GCM","iv":...,"ct":...}`
* (base64). The session's Linux side shares the app's files directory but not its Keystore, so
* what it can see of a sign-in is the envelope only.
*/
object CredentialCipher {
const val VERSION = 1
const val ALG = "AES/GCM"
private const val TRANSFORMATION = "AES/GCM/NoPadding"
private const val TAG_BITS = 128
/** Where the key comes from: the AndroidKeyStore on a device, a plain key in tests. */
fun interface KeyProvider {
/** The key, created on first use. Throws when no key can be had (no Keystore on this ROM). */
fun key(): SecretKey
/** The key that sealed earlier files: never a new one. Throws [KeyMissing] when there is none. */
fun existing(): SecretKey = key()
}
/** The Keystore answered and holds no key: nothing sealed before can open again. */
class KeyMissing : java.security.GeneralSecurityException("no key")
/**
* Whether [e], from [open], means the file can never open: it does not authenticate (tampered,
* or sealed under another key), the key is permanently invalidated or gone, or the file is not
* an envelope. Anything else - the Keystore busy or erroring, an I/O error - may pass.
*/
fun isPermanent(e: Throwable): Boolean = e is javax.crypto.AEADBadTagException ||
e is android.security.keystore.KeyPermanentlyInvalidatedException ||
e is KeyMissing || e is org.json.JSONException || e is IllegalArgumentException
/**
* An AES-256 key in the AndroidKeyStore: not exportable, encrypt/decrypt with GCM only, no user
* authentication (background downloads and launch-time code fetches use it with the screen
* off). StrongBox where the device has it, the TEE otherwise.
*/
object Keystore : KeyProvider {
private const val ALIAS = "droiddeck-store-credentials"
private const val PROVIDER = "AndroidKeyStore"
@Synchronized
override fun existing(): SecretKey {
val ks = KeyStore.getInstance(PROVIDER).apply { load(null) }
return ks.getKey(ALIAS, null) as? SecretKey ?: throw KeyMissing()
}
@Synchronized
override fun key(): SecretKey {
val ks = KeyStore.getInstance(PROVIDER).apply { load(null) }
(ks.getKey(ALIAS, null) as? SecretKey)?.let { return it }
if (Build.VERSION.SDK_INT >= 28) {
try { return generate(strongBox = true) } catch (e: Exception) { /* no StrongBox: the TEE */ }
}
return generate(strongBox = false)
}
private fun generate(strongBox: Boolean): SecretKey {
val spec = KeyGenParameterSpec.Builder(ALIAS, KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT)
.setKeySize(256)
.setBlockModes(KeyProperties.BLOCK_MODE_GCM)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
.setUserAuthenticationRequired(false)
.apply { if (strongBox && Build.VERSION.SDK_INT >= 28) setIsStrongBoxBacked(true) }
.build()
return KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, PROVIDER).run { init(spec); generateKey() }
}
}
/** [plain] sealed into the envelope. The cipher picks the IV (the Keystore requires it). */
fun seal(plain: String, keys: KeyProvider): JSONObject {
val cipher = Cipher.getInstance(TRANSFORMATION).apply { init(Cipher.ENCRYPT_MODE, keys.key()) }
val ct = cipher.doFinal(plain.toByteArray(Charsets.UTF_8))
return JSONObject().put("v", VERSION).put("alg", ALG)
.put("iv", b64(cipher.iv)).put("ct", b64(ct))
}
/** The text inside [envelope]. Throws when it is not ours, of another version, or does not authenticate. */
fun open(envelope: JSONObject, keys: KeyProvider): String {
require(envelope.optInt("v", -1) == VERSION && envelope.optString("alg") == ALG) { "unknown envelope" }
val iv = Base64.decode(envelope.getString("iv"), Base64.NO_WRAP)
val ct = Base64.decode(envelope.getString("ct"), Base64.NO_WRAP)
val cipher = Cipher.getInstance(TRANSFORMATION).apply { init(Cipher.DECRYPT_MODE, keys.existing(), GCMParameterSpec(TAG_BITS, iv)) }
return String(cipher.doFinal(ct), Charsets.UTF_8)
}
/** Whether [json] is an envelope rather than plain credentials. */
fun isEnvelope(json: JSONObject): Boolean = json.has("v") && json.has("ct") && json.has("iv")
private fun b64(bytes: ByteArray) = Base64.encodeToString(bytes, Base64.NO_WRAP)
}
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.stores
import android.content.Context
import android.util.Log
import androidx.annotation.VisibleForTesting
import org.json.JSONObject
import java.io.File
@@ -9,40 +10,147 @@ import java.io.File
* Each store's sign-in, kept in the app's private files: `filesDir/stores/<store>/credentials.json`.
* Tokens never go to shared storage and never into a log; the file holds whatever the store's auth
* flow handed back (access and refresh tokens, expiry, the account's display name, and for Amazon
* the device registration), as one JSON object the store's own client reads and writes.
* the device registration), as one JSON object the store's own client reads and writes - sealed
* with [CredentialCipher] under a key in the AndroidKeyStore. Every read and write of a sign-in
* goes through here.
*
* - A plain file an earlier build wrote is sealed the first time it is read ([encryptAll] at app
* start), verified by opening it again, and the plain text is replaced.
* - Where the Keystore does not work (some ROMs), the file stays plain, the log says so once, and
* the next start tries again.
* - A sealed file that can never open again (the key is gone: data cleared, a backup restored on
* another device) is deleted and the store reads as signed out; one that fails for a reason that
* may pass is kept and tried again (see [read]).
*/
object StoreAccounts {
private const val TAG = "StoreAccounts"
private const val FILE = "credentials.json"
@VisibleForTesting
@Volatile
internal var keys: CredentialCipher.KeyProvider = CredentialCipher.Keystore
/** The Keystore failed once in this process: files stay plain until the next start tries again. */
@VisibleForTesting
@Volatile
internal var keystoreFailed = false
/** The store's private folder: credentials, caches, the engine's scratch. */
fun dir(context: Context, store: Store): File = File(File(context.filesDir, "stores"), store.id).apply { mkdirs() }
fun credentialsFile(context: Context, store: Store): File = File(dir(context, store), FILE)
/** The stored credentials, or null when signed out or unreadable (never logged: the text is the secret). */
/** Stores whose sealed sign-in could not be opened this time for a reason that may pass (see [read]). */
private val unavailable = java.util.concurrent.ConcurrentHashMap.newKeySet<Store>()
@Volatile
private var unavailableLogged = false
/**
* The stored credentials, or null when signed out or unreadable (never logged: the text is the
* secret).
*
* A sealed file is deleted - the store signs in again - only when it can never open: it does
* not authenticate (tampered, or another key: data cleared, restored on another device), the
* key is permanently invalidated or gone from the Keystore, or it is not an envelope at all. Any
* other failure (the Keystore busy or erroring, an I/O error) keeps the file, marks the store
* [isUnavailable] - signed in, its actions failing for now - and the next read tries again.
*/
@Synchronized
fun read(context: Context, store: Store): JSONObject? {
val f = credentialsFile(context, store)
if (!f.isFile) return null
return try { JSONObject(f.readText()) } catch (e: Exception) { Log.w(TAG, "${store.id}: credentials unreadable (${e.javaClass.simpleName})"); null }
if (!f.isFile) { unavailable.remove(store); return null }
val text = try { f.readText() } catch (e: Exception) { return markUnavailable(store, e) }
val json = try { JSONObject(text) } catch (e: Exception) { return unreadable(f, store, e) }
if (!CredentialCipher.isEnvelope(json)) {
unavailable.remove(store)
seal(f, json)?.let { Log.i(TAG, "stores: credentials encrypted ${store.id}") }
return json
}
return try {
JSONObject(CredentialCipher.open(json, keys)).also { unavailable.remove(store) }
} catch (e: Exception) {
if (CredentialCipher.isPermanent(e)) unreadable(f, store, e) else markUnavailable(store, e)
}
}
/** The store's sign-in is on disk but could not be opened this time (see [read]). */
fun isUnavailable(store: Store): Boolean = store in unavailable
private fun unreadable(f: File, store: Store, e: Exception): JSONObject? {
Log.w(TAG, "stores: credentials for ${store.id} cannot be opened (${e.javaClass.simpleName}); signed out")
f.delete()
unavailable.remove(store)
return null
}
private fun markUnavailable(store: Store, e: Exception): JSONObject? {
unavailable.add(store)
if (!unavailableLogged) {
unavailableLogged = true
Log.w(TAG, "stores: credentials unreadable this start (${e.javaClass.simpleName})")
}
return null
}
@Synchronized
fun write(context: Context, store: Store, json: JSONObject) {
unavailable.remove(store)
val f = credentialsFile(context, store)
val tmp = File(f.path + ".tmp")
tmp.writeText(json.toString())
tmp.setReadable(false, false); tmp.setReadable(true, true)
if (!tmp.renameTo(f)) { f.delete(); tmp.renameTo(f) }
if (seal(f, json) == null) put(f, json.toString())
}
@Synchronized
fun clear(context: Context, store: Store) {
unavailable.remove(store)
credentialsFile(context, store).delete()
File(credentialsFile(context, store).path + ".tmp").delete()
}
/** The account's display name when signed in (the store's own name for it, or a stand-in), else null. */
/** At app start: every plain sign-in an earlier build left is sealed now. */
fun encryptAll(context: Context) {
Store.entries.forEach { store ->
// An older build's temp file held the plain text too.
File(credentialsFile(context, store).path + ".tmp").delete()
read(context, store)
}
}
/**
* The account's display name when signed in (the store's own name for it, or a stand-in), else
* null. A sign-in that could not be opened this time ([isUnavailable]) still counts, under the
* store's name, so the sign-in card does not ask for what is still there.
*/
fun signedInAs(context: Context, store: Store): String? {
val json = read(context, store) ?: return null
val json = read(context, store) ?: return if (isUnavailable(store)) store.label else null
if (json.optString("access_token", "").isEmpty()) return null
return json.optString("display_name", "").ifEmpty { json.optString("username", "") }.ifEmpty { store.label }
}
/**
* [json] sealed into [f], checked by opening what was written. Null - and [f] as it was - when
* the Keystore cannot seal or the check fails.
*/
private fun seal(f: File, json: JSONObject): File? {
if (keystoreFailed) return null
val text = json.toString()
val envelope = try {
CredentialCipher.seal(text, keys).also { check(CredentialCipher.open(it, keys) == text) { "check failed" } }
} catch (e: Exception) {
keystoreFailed = true
Log.w(TAG, "stores: keystore unavailable, credentials stay plain (${e.javaClass.simpleName})")
return null
}
put(f, envelope.toString())
return f
}
/** [text] into [f] through a temp file and a rename, readable and writable by the app alone. */
private fun put(f: File, text: String) {
val tmp = File(f.path + ".tmp")
tmp.writeText(text)
tmp.setReadable(false, false); tmp.setReadable(true, true)
tmp.setWritable(false, false); tmp.setWritable(true, true)
if (!tmp.renameTo(f)) { f.delete(); tmp.renameTo(f) }
}
}
@@ -125,40 +125,12 @@ object StoreLog {
}
}
private val URL_PATTERN = Regex("""[A-Za-z][A-Za-z0-9+.\-]*://[^\s"'<>]+""")
private val SAFE_SEGMENT = Regex("""[A-Za-z0-9._\-]{1,40}""")
private val SECRET = Regex("""(?i)(?<![A-Za-z0-9_])(__token__|f_token|hdnts|access_token|refresh_token|id_token|token)(["']?\s*[=:]\s*["']?)[^\s&;,"'}]+""")
private val CODE = Regex("""(?i)(?<![A-Za-z0-9_])(code|exchange_code|authorizationCode)(["']?\s*=\s*["']?)[^\s&;,"'}]+""")
private val AUTH_HEADER = Regex("""(?i)(authorization|cookie)(\s*[:=]\s*).*""")
/**
* What any store line may say, for the Downloads log and logcat alike: every URL cut to
* `scheme://host/first-segment/…` (the segment kept only when it is a plain name - a GOG secure
* link carries its token in the path), no query, fragment or userinfo; and outside URLs, the
* values of token-like keys and of Authorization / Cookie headers blanked.
* What any store line may say, for the stores' log and logcat alike: URLs cut to their host and a
* plain first path segment, token values and Authorization / Cookie headers blanked - the shared
* rules of [com.droiddeck.launcher.core.SecretScrub], which a shared log zip applies too.
*/
@JvmStatic
fun redactLine(text: String): String {
var out = URL_PATTERN.replace(text) { m -> shortUrl(m.value) }
out = SECRET.replace(out) { m -> m.groupValues[1] + m.groupValues[2] + "…" }
out = CODE.replace(out) { m -> m.groupValues[1] + m.groupValues[2] + "…" }
out = AUTH_HEADER.replace(out) { m -> m.groupValues[1] + m.groupValues[2] + "…" }
return out
}
private fun shortUrl(url: String): String {
val schemeEnd = url.indexOf("://")
val scheme = url.substring(0, schemeEnd)
var rest = url.substring(schemeEnd + 3)
rest = rest.substringBefore('#').substringBefore('?')
val slash = rest.indexOf('/')
val authority = (if (slash >= 0) rest.substring(0, slash) else rest).substringAfterLast('@')
if (slash < 0) return "$scheme://$authority"
val path = rest.substring(slash + 1)
val first = path.substringBefore('/')
val more = path.length > first.length
if (first.isEmpty()) return "$scheme://$authority/"
val shown = if (SAFE_SEGMENT.matches(first)) first else "…"
return "$scheme://$authority/$shown" + if (more && shown != "…") "/…" else ""
}
fun redactLine(text: String): String =
com.droiddeck.launcher.core.SecretScrub.scrub(text, com.droiddeck.launcher.core.SecretScrub.Urls.SHORT, "…")
}
@@ -118,6 +118,11 @@ object StoresState {
fun isSignedIn(store: Store): Boolean = accounts.containsKey(store)
/** A store action's error line when it found no usable sign-in: gone, or on disk but unreadable for now. */
fun notSignedInLine(store: Store): String =
if (StoreAccounts.isUnavailable(store)) "${store.shortLabel} sign-in could not be read: try again."
else "${store.shortLabel} session expired: sign in again."
/** Stores whose sign-in has run out (a launch could not get a code): their chip dims until the user signs in again. */
val expired = mutableStateMapOf<Store, Boolean>()
@@ -55,7 +55,7 @@ object AmazonBackend : StoreBackend {
when (result) {
is AmazonLibrary.SyncResult.Ok -> { publish(app, result.games); StoresState.problems.remove(store) }
is AmazonLibrary.SyncResult.Failed -> StoresState.problems[store] = result.message
AmazonLibrary.SyncResult.NotLoggedIn -> StoresState.problems[store] = "Amazon session expired: sign in again."
AmazonLibrary.SyncResult.NotLoggedIn -> StoresState.problems[store] = StoresState.notSignedInLine(store)
AmazonLibrary.SyncResult.Throttled -> publish(app, AmazonLibrary.cached(app))
AmazonLibrary.SyncResult.Busy -> {}
}
@@ -6,6 +6,7 @@ import android.util.Log
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoreNet
import com.droiddeck.launcher.stores.StoresState
import org.json.JSONArray
import org.json.JSONObject
import java.util.concurrent.Callable
@@ -70,7 +71,7 @@ object AmazonLibrary {
}
onStatus("Checking sign-in…")
val creds = AmazonCredentialStore.load(app) ?: return SyncResult.NotLoggedIn
val token = AmazonCredentialStore.getValidAccessToken(app) ?: return SyncResult.Failed("Amazon session expired: sign in again.")
val token = AmazonCredentialStore.getValidAccessToken(app) ?: return SyncResult.Failed(StoresState.notSignedInLine(Store.AMAZON))
onStatus("Fetching game list…")
val all = AmazonApiClient.getEntitlements(token, creds.deviceSerial)
if (all.isNullOrEmpty()) return if (cachedList.isEmpty()) SyncResult.Failed("No games found in your Amazon library") else SyncResult.Ok(cachedList)
@@ -53,7 +53,7 @@ object EpicBackend : StoreBackend, EpicLaunchSupport {
StoresState.library[store] = com.droiddeck.launcher.stores.mergeItems(StoresState.library[store], result.games.map { EpicLibrary.toCatalogItem(app, it) }); StoresState.problems.remove(store)
}
is EpicLibrary.SyncResult.Failed -> StoresState.problems[store] = result.message
EpicLibrary.SyncResult.NotLoggedIn -> StoresState.problems[store] = "Epic session expired: sign in again."
EpicLibrary.SyncResult.NotLoggedIn -> StoresState.problems[store] = StoresState.notSignedInLine(store)
EpicLibrary.SyncResult.Throttled -> if (!StoresState.library.containsKey(store)) StoresState.library[store] = com.droiddeck.launcher.stores.mergeItems(StoresState.library[store], cached.map { EpicLibrary.toCatalogItem(app, it) })
EpicLibrary.SyncResult.Busy -> {}
}
@@ -42,7 +42,7 @@ object GogBackend : StoreBackend {
when (result) {
is GogLibrary.SyncResult.Ok -> { StoresState.library[store] = com.droiddeck.launcher.stores.mergeItems(StoresState.library[store], result.games.map { GogLibrary.toCatalogItem(app, it) }); StoresState.problems.remove(store) }
is GogLibrary.SyncResult.Failed -> StoresState.problems[store] = result.message
GogLibrary.SyncResult.NotLoggedIn -> StoresState.problems[store] = "GOG session expired: sign in again."
GogLibrary.SyncResult.NotLoggedIn -> StoresState.problems[store] = StoresState.notSignedInLine(store)
GogLibrary.SyncResult.Busy -> {}
}
}
@@ -76,7 +76,6 @@ class ModeSettings(
val backActionsInverted: Boolean = false,
val directAudio: Boolean?,
val mic: Boolean?,
val renderer: String?,
val gameStorage: String? = null,
val storageOptions: List<com.droiddeck.launcher.session.GameStorage.Option> = emptyList(),
/** Steam only: record allocation and sampled storage timings in the next session's Share logs. */
@@ -140,7 +139,6 @@ class ModeSettingsActions(
val onBackActionsInverted: (Boolean) -> Unit = {},
val onDirectAudio: (Boolean) -> Unit,
val onMic: (Boolean) -> Unit,
val onRenderer: (String) -> Unit,
val onGameStorage: (path: String, label: String) -> Unit = { _, _ -> },
val onPickGameStorageFolder: () -> Unit = {},
val onStorageDiagnostics: (Boolean) -> Unit = {},
@@ -528,14 +526,6 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
onChange = a.onStorageDiagnostics,
)
}
if (!steam && tab == ModeSettingsTab.DISPLAY && s.renderer != null) SettingsGroup(stringResource(R.string.mode_renderer)) {
ChoiceRow(
host, "renderer", stringResource(R.string.mode_desktop_renderer), stringResource(R.string.mode_renderer_hint),
listOf("vulkan" to stringResource(R.string.mode_renderer_vulkan), "gles2" to stringResource(R.string.mode_renderer_gles2), "pixman" to stringResource(R.string.mode_renderer_pixman)), s.renderer,
note = stringResource(R.string.mode_renderer_note),
onPick = a.onRenderer,
)
}
}
if (explainWifiDiscovery) AlertDialog(
onDismissRequest = { explainWifiDiscovery = false },
@@ -20,11 +20,13 @@ fun ResolutionRow(
val size = SessionDisplay.resolveChoice(panel, choice)
val screen = SessionDisplay.screenSize(panel)
val choices = SessionDisplay.resolutionOptions(panel)
val selected = if (size == screen) SessionDisplay.MATCH_SCREEN else choice
val selected = if (choice == SessionDisplay.FOLLOW_SCREEN) choice
else if (size == screen) SessionDisplay.MATCH_SCREEN else choice
var editCustom by remember { mutableStateOf(false) }
val options = choices.map { value ->
val dimensions = SessionDisplay.resolveChoice(panel, value)
value to if (value == SessionDisplay.MATCH_SCREEN) stringResource(R.string.display_match_screen, screen.first, screen.second)
else if (value == SessionDisplay.FOLLOW_SCREEN) stringResource(R.string.display_follow_screen)
else if (value == SessionDisplay.DEFAULT_RESOLUTION) stringResource(R.string.mode_res_default, "${dimensions.first}×${dimensions.second}")
else "${dimensions.first}×${dimensions.second}"
} + (custom to if (selected in choices) stringResource(R.string.mode_res_custom)
@@ -82,7 +82,12 @@ internal fun WinComponentsDialog(
// Detector names (oalinst, physx...) already in the prefix from elsewhere.
var present by remember { mutableStateOf(emptySet<String>()) }
var picks by remember { mutableStateOf(WinComponents.picks(context, appKey)) }
var progress by remember { mutableStateOf<Pair<String, Int>?>(null) }
// The row being worked on: its id, the latest progress (a dependency's while that installs
// first), and whether it is turning off rather than on. The row greys out and shows the bar
// the moment the switch is pressed, and only that row; the rest of the page stays as it is.
var busyId by remember { mutableStateOf<String?>(null) }
var progress by remember { mutableStateOf<WinComponents.Progress?>(null) }
var reverting by remember { mutableStateOf(false) }
var error by remember { mutableStateOf<String?>(null) }
// The component the error is about, so it shows on its own row and not only at the bottom.
var failed by remember { mutableStateOf<String?>(null) }
@@ -91,6 +96,7 @@ internal fun WinComponentsDialog(
// pad, so the d-pad always has somewhere to start; LB and RB jump between the sections, since
// the full list runs past sixty switches.
val recFocus = remember { FocusRequester() }
val activeFocus = remember { FocusRequester() }
val allFocus = remember { FocusRequester() }
val waitFocus = remember { FocusRequester() }
val doneFocus = remember { FocusRequester() }
@@ -116,22 +122,35 @@ internal fun WinComponentsDialog(
}
fun toggle(id: String, on: Boolean) {
// Switches stay enabled during a download - a disabled one drops the pad's focus - so a press
// then is ignored here.
if (progress != null) return
// then is ignored here; the busy row is greyed instead.
if (busyId != null) return
error = null
failed = null
if (!on) { setPicks(picks - id); return }
if (!on) {
// Turning off is a saved pick, quick, but the row greys out until it is written so the
// press is seen to land; the files leave the prefix at the game's next launch.
busyId = id; reverting = true; progress = null
val next = picks - id
picks = next
coroutine.launch {
withContext(Dispatchers.IO) { WinComponents.setPicks(context, appKey, next) }
busyId = null; reverting = false
}
return
}
val all = catalog.orEmpty()
val c = all[id]
if (id in installed || c == null) { setPicks(picks + id); return }
progress = id to -1
busyId = id; reverting = false
progress = WinComponents.Progress(id, "", WinComponents.Phase.DOWNLOAD, -1)
coroutine.launch {
val problem = withContext(Dispatchers.IO) {
WinComponents.install(context, c, all) { stage, percent -> progress = stage to percent }
WinComponents.install(context, c, all) { p -> progress = p }
}
progress = null
installed = withContext(Dispatchers.IO) { WinComponents.installedIds(context).toSet() }
if (problem != null) { error = problem; failed = id } else setPicks(picks + id)
busyId = null
}
}
@@ -142,12 +161,18 @@ internal fun WinComponentsDialog(
val recIds = if (all == null) emptyList() else recommended.distinctBy { installable(it.componentName, all) }
val ready = all.orEmpty().values.filter { WinComponents.support(it, all.orEmpty()) == Support.READY }.map { it.name }
val extra = (installed + picks).filter { all?.containsKey(it) != true }
val list = (ready + extra).distinct().sortedBy { WinComponentNames.of(it).lowercase() }
// What is turned on for this game gets its own section under the recommendations, which stay
// where they are; the rest of the list is everything else, so a component turned off goes back
// to its place in the alphabet.
val recSet = recIds.map { installable(it.componentName, all.orEmpty()) }.toSet()
val active = picks.filter { it !in recSet && (all?.containsKey(it) == true || it in installed) }.distinct()
.sortedBy { WinComponentNames.of(it).lowercase() }
val list = (ready + extra).distinct().filter { it !in active }.sortedBy { WinComponentNames.of(it).lowercase() }
val waiting = all.orEmpty().values.filter { WinComponents.support(it, all.orEmpty()) == Support.NEEDS_INSTALLER }
.map { it.name }.sortedBy { WinComponentNames.of(it).lowercase() }
val hasRec = all != null && recIds.any { supportOf(installable(it.componentName, all)) == Support.READY }
val sections = listOfNotNull(recFocus.takeIf { hasRec }, allFocus.takeIf { list.isNotEmpty() },
waitFocus.takeIf { waiting.isNotEmpty() }, doneFocus)
val sections = listOfNotNull(recFocus.takeIf { hasRec }, activeFocus.takeIf { active.isNotEmpty() },
allFocus.takeIf { list.isNotEmpty() }, waitFocus.takeIf { waiting.isNotEmpty() }, doneFocus)
var section by remember { mutableStateOf(0) }
fun jump(step: Int) {
section = (section + step + sections.size) % sections.size
@@ -164,7 +189,7 @@ internal fun WinComponentsDialog(
withFrameNanos { }
runCatching { target.requestFocus() }
withFrameNanos { }
if (switchFocused || (target !== recFocus && target !== allFocus)) return@LaunchedEffect
if (switchFocused || (target !== recFocus && target !== activeFocus && target !== allFocus)) return@LaunchedEffect
}
}
@@ -189,9 +214,24 @@ internal fun WinComponentsDialog(
// The catalog key stays in the detail: it is what a log or a bug report names.
val detail = listOfNotNull(reason, c?.description?.takeIf { it.isNotEmpty() }, status, id).joinToString(" · ")
val usable = support == Support.READY
val busy = id == busyId
val caption = when {
!busy -> null
reverting -> stringResource(R.string.wincomp_reverting)
else -> progress?.let { p ->
val stage = if (p.component != id && p.stage.isNotEmpty()) "${WinComponentNames.of(p.component)}: ${p.stage}" else p.stage
val text = when (p.phase) {
WinComponents.Phase.DOWNLOAD -> stringResource(R.string.wincomp_downloading, stage)
WinComponents.Phase.INSTALL -> stringResource(R.string.wincomp_installing, stage)
}
if (p.percent >= 0) "$text · ${p.percent}%" else text
}
}
ComponentRow(
WinComponentNames.of(id), detail, checked = id in picks, enabled = usable || id in picks,
dim = !usable, modifier = (if (usable && focus != null) Modifier.focusRequester(focus) else Modifier)
dim = !usable || busy, busy = busy, caption = caption,
percent = if (busy && !reverting) progress?.percent ?: -1 else -1,
modifier = (if (usable && focus != null) Modifier.focusRequester(focus) else Modifier)
.onFocusChanged { if (it.isFocused) switchFocused = true },
) { on -> toggle(id, on) }
}
@@ -220,6 +260,11 @@ internal fun WinComponentsDialog(
}
} else if (all != null && gameDir != null) Small(stringResource(R.string.wincomp_no_recommendation))
if (active.isNotEmpty()) {
Section(stringResource(R.string.wincomp_active, active.size))
val focusOf = firstUsable(active, activeFocus)
Panel { active.forEachIndexed { i, id -> if (i > 0) Divider(); Item(id, null, focusOf(id)) } }
}
if (list.isNotEmpty()) {
Section(stringResource(R.string.wincomp_all, list.size))
val focusOf = firstUsable(list, allFocus)
@@ -238,16 +283,11 @@ internal fun WinComponentsDialog(
if (showWaiting) Panel { waiting.forEachIndexed { i, id -> if (i > 0) Divider(); Item(id, null, null) } }
}
progress?.let { (stage, percent) ->
Small(if (percent >= 0) "$stage · $percent%" else stage)
if (percent >= 0) LinearProgressIndicator(progress = { percent / 100f }, modifier = Modifier.fillMaxWidth())
else LinearProgressIndicator(Modifier.fillMaxWidth())
}
error?.let { Small(it, error = true) }
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(top = 4.dp)) {
Small(stringResource(R.string.wincomp_next_launch))
Spacer(Modifier.weight(1f))
PrimaryButton(stringResource(R.string.game_env_done), enabled = progress == null, modifier = Modifier.focusRequester(doneFocus), onClick = close)
PrimaryButton(stringResource(R.string.game_env_done), enabled = busyId == null, modifier = Modifier.focusRequester(doneFocus), onClick = close)
}
}
}
@@ -264,17 +304,34 @@ private fun Panel(content: @Composable androidx.compose.foundation.layout.Column
private fun Divider() =
Box(Modifier.fillMaxWidth().padding(horizontal = 14.dp).heightIn(min = 1.dp, max = 1.dp).background(LocalPalette.current.line))
/**
* One component: name, detail and its switch; while [busy] the row is greyed and a thin bar runs
* across it with [caption] above (the download, then the install, each 0..100 as [percent], or
* indeterminate at -1). The switch stays enabled while busy so a pad's focus does not drop; the
* press is ignored by the caller instead.
*/
@Composable
private fun ComponentRow(name: String, detail: String, checked: Boolean, enabled: Boolean, dim: Boolean, modifier: Modifier, onChange: (Boolean) -> Unit) {
private fun ComponentRow(
name: String, detail: String, checked: Boolean, enabled: Boolean, dim: Boolean, busy: Boolean = false,
caption: String? = null, percent: Int = -1, modifier: Modifier, onChange: (Boolean) -> Unit,
) {
val colors = MaterialTheme.colorScheme
Row(
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 10.dp).alpha(if (dim) 0.55f else 1f),
) {
Column(Modifier.weight(1f)) {
Text(name, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground)
if (detail.isNotEmpty()) Text(detail, fontSize = 12.sp, lineHeight = 16.sp, color = colors.onSurfaceVariant)
Column(Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 10.dp)) {
Row(
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier.fillMaxWidth().alpha(if (dim) 0.55f else 1f),
) {
Column(Modifier.weight(1f)) {
Text(name, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground)
if (detail.isNotEmpty()) Text(detail, fontSize = 12.sp, lineHeight = 16.sp, color = colors.onSurfaceVariant)
}
ToggleSwitch(checked, enabled, name, modifier.alpha(if (busy) 0.5f else 1f), onChange)
}
if (busy) {
if (!caption.isNullOrEmpty()) Text(caption, fontSize = 12.sp, lineHeight = 16.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp))
val bar = Modifier.fillMaxWidth().padding(top = 6.dp).heightIn(min = 4.dp, max = 4.dp)
if (percent >= 0) LinearProgressIndicator(progress = { percent / 100f }, modifier = bar)
else LinearProgressIndicator(modifier = bar)
}
ToggleSwitch(checked, enabled, name, modifier, onChange)
}
}
@@ -312,6 +312,11 @@ public final class WaylandCompositor {
* list stops at the desktop size, as the X server's does on X11. Set before the compositor starts. */
public static native void nativeSetOutputSize(int width, int height);
/** A new output size for a running compositor ("Follow screen": a foldable opening or closing).
* The compositor thread re-sends the wl_output mode and an xdg_toplevel configure to every
* client, and gamescope / the desktop's KWin resize their output to it. Any thread. */
public static native void nativeResizeOutput(int width, int height);
/** Re-arms the one-shot first-frame notice, for a new session under a compositor that has
* already presented a previous one. */
public static native void nativeResetFirstFrame();
+1 -10
View File
@@ -358,13 +358,6 @@
<string name="mode_storage_diagnostics">Diagnóstico de almacenamiento</string>
<string name="mode_storage_diagnostics_hint">Registra los resultados de asignación y muestras de tiempos de almacenamiento en Compartir registros. Puede ralentizar las instalaciones mientras esté activado. Se aplica en la próxima sesión.</string>
<string name="mode_choose_folder">Elegir una carpeta…</string>
<string name="mode_renderer">Renderizador</string>
<string name="mode_desktop_renderer">Renderizador del escritorio</string>
<string name="mode_renderer_hint">Dibuja el escritorio.</string>
<string name="mode_renderer_vulkan">vulkan - GPU</string>
<string name="mode_renderer_gles2">gles2 - GPU (experimental)</string>
<string name="mode_renderer_pixman">pixman - software</string>
<string name="mode_renderer_note">Vulkan ejecuta los programas del escritorio en la GPU y recurre a pixman si falla. Con pixman, los juegos se abren a pantalla completa en la GPU.</string>
<string name="mode_custom_res_title">Resolución personalizada</string>
<string name="mode_custom_res_text">Sustituye el límite y la relación de aspecto. Un tamaño que no coincide con la pantalla muestra barras.</string>
<string name="mode_width">Ancho</string>
@@ -894,7 +887,7 @@
<string name="content_open_desktop">Abrir escritorio</string>
<string name="content_install_open_desktop">Instalar y abrir escritorio</string>
<string name="content_linux_desktop">Escritorio de Linux</string>
<string name="content_linux_desktop_hint">LXQt, Firefox y tus emuladores</string>
<string name="content_linux_desktop_hint">KDE Plasma, Firefox y tus emuladores</string>
<string name="games_empty">Los juegos que instales en Steam aparecen aquí después de la sesión.</string>
<string name="games_play_steam">Jugar en Steam</string>
<string name="games_launch_settings">Ajustes de inicio</string>
@@ -1256,7 +1249,6 @@
<!-- %1$s is the program's name -->
<string name="session_named_paused">%1$s está en pausa</string>
<string name="session_program_paused">El programa está en pausa</string>
<string name="session_starting_steam_desktop">Iniciando Steam en el escritorio</string>
<string name="session_starting_desktop">Iniciando el escritorio</string>
<!-- %1$s is the program's name -->
@@ -1282,7 +1274,6 @@
<string name="session_proton_unpacking">descomprimiendo Proton Experimental (ARM64)</string>
<string name="session_runtime_catalog_unreachable">No se pudo acceder al catálogo del runtime. Revisa la conexión y vuelve a pulsar Jugar.</string>
<string name="session_runtime_install_failed">El runtime de Linux no se instaló. Revisa el runtime en Configuración y vuelve a pulsar Jugar.</string>
<string name="session_desktop_catalog_unreachable">No se pudo acceder al catálogo del escritorio. Revisa la conexión y pulsa Escritorio de nuevo.</string>
<!-- %1$s says what went wrong -->
<string name="session_desktop_install_failed">El escritorio no se instaló (%1$s). Revisa la conexión y pulsa Escritorio de nuevo.</string>
+1 -8
View File
@@ -303,13 +303,6 @@
<string name="mode_second_library">Bibliothèque secondaire</string>
<string name="mode_storage_note">Les jeux lisant des ressources depuis une carte SD ou un stockage partagé peuvent saccader.</string>
<string name="mode_choose_folder">Choisir un dossier…</string>
<string name="mode_renderer">Rendu</string>
<string name="mode_desktop_renderer">Moteur de rendu du bureau</string>
<string name="mode_renderer_hint">Responsable du dessin du bureau.</string>
<string name="mode_renderer_vulkan">vulkan - GPU</string>
<string name="mode_renderer_gles2">gles2 - GPU (expérimental)</string>
<string name="mode_renderer_pixman">pixman - Logiciel</string>
<string name="mode_renderer_note">Vulkan utilise le GPU pour exécuter les programmes de bureau, et bascule vers pixman en cas d\'échec. Avec pixman, les jeux s\'exécutent toujours en plein écran sur le GPU.</string>
<string name="mode_custom_res_title">Résolution personnalisée</string>
<string name="mode_custom_res_text">Remplace la limite de résolution et le format d\'écran. Les dimensions ne correspondant pas à l\'écran afficheront des bandes noires.</string>
<string name="mode_width">Largeur</string>
@@ -785,7 +778,7 @@
<string name="content_open_desktop">Ouvrir le bureau</string>
<string name="content_install_open_desktop">Installer et ouvrir le bureau</string>
<string name="content_linux_desktop">Bureau Linux</string>
<string name="content_linux_desktop_hint">LXQt, Firefox et vos émulateurs</string>
<string name="content_linux_desktop_hint">KDE Plasma, Firefox et vos émulateurs</string>
<string name="games_empty">Les jeux installés sur Steam apparaîtront ici après la fin de la session.</string>
<string name="games_play_steam">Lancer Steam</string>
<string name="games_launch_settings">Paramètres de lancement</string>
+1 -10
View File
@@ -358,13 +358,6 @@
<string name="mode_storage_diagnostics">ストレージ診断</string>
<string name="mode_storage_diagnostics_hint">割り当て結果とサンプリングしたストレージの処理時間を「ログを共有」に記録します。有効中はインストールが遅くなる場合があります。次回のセッションで有効になります。</string>
<string name="mode_choose_folder">フォルダを選択…</string>
<string name="mode_renderer">レンダラー</string>
<string name="mode_desktop_renderer">デスクトップレンダラー</string>
<string name="mode_renderer_hint">デスクトップの描画を担当します。</string>
<string name="mode_renderer_vulkan">vulkan - GPU</string>
<string name="mode_renderer_gles2">gles2 - GPU(実験的)</string>
<string name="mode_renderer_pixman">pixman - ソフトウェア</string>
<string name="mode_renderer_note">VulkanはGPUを使用してデスクトッププログラムを実行し、失敗した場合はpixmanにフォールバックします。pixmanを使用する場合でも、ゲームはGPU上で全画面実行されます。</string>
<string name="mode_custom_res_title">カスタム解像度</string>
<string name="mode_custom_res_text">解像度の上限と画面比率を置き換えます。画面に合わないサイズは黒帯で表示されます。</string>
<string name="mode_width">幅</string>
@@ -886,7 +879,7 @@
<string name="content_open_desktop">デスクトップを開く</string>
<string name="content_install_open_desktop">インストールしてデスクトップを開く</string>
<string name="content_linux_desktop">Linuxデスクトップ</string>
<string name="content_linux_desktop_hint">LXQt、Firefox、エミュレーター</string>
<string name="content_linux_desktop_hint">KDE Plasma、Firefox、エミュレーター</string>
<string name="games_empty">Steamでインストールされたゲームは、セッション終了後にここに表示されます。</string>
<string name="games_play_steam">Steamを実行</string>
<string name="games_launch_settings">起動設定</string>
@@ -1234,7 +1227,6 @@
<!-- %1$s is the program's name -->
<string name="session_named_paused">%1$sは一時停止中です</string>
<string name="session_program_paused">プログラムは一時停止中です</string>
<string name="session_starting_steam_desktop">デスクトップでSteamを起動中</string>
<string name="session_starting_desktop">デスクトップを起動中</string>
<!-- %1$s is the program's name -->
@@ -1260,7 +1252,6 @@
<string name="session_proton_unpacking">Proton Experimental(ARM64)を展開中</string>
<string name="session_runtime_catalog_unreachable">実行環境のカタログに接続できませんでした。接続を確認して、もう一度Playをタップしてください。</string>
<string name="session_runtime_install_failed">Linux実行環境をインストールできませんでした。「設定」で実行環境を確認して、もう一度Playをタップしてください。</string>
<string name="session_desktop_catalog_unreachable">デスクトップのカタログに接続できませんでした。接続を確認して、もう一度「デスクトップ」をタップしてください。</string>
<!-- %1$s says what went wrong -->
<string name="session_desktop_install_failed">デスクトップをインストールできませんでした(%1$s)。接続を確認して、もう一度「デスクトップ」をタップしてください。</string>
+1 -10
View File
@@ -358,13 +358,6 @@
<string name="mode_storage_diagnostics">저장 공간 진단</string>
<string name="mode_storage_diagnostics_hint">할당 결과와 샘플링한 저장 공간 응답 시간을 \"로그 공유\"에 기록합니다. 켜져 있는 동안 설치가 느려질 수 있습니다. 다음 세션에 적용됩니다.</string>
<string name="mode_choose_folder">폴더 선택…</string>
<string name="mode_renderer">렌더러</string>
<string name="mode_desktop_renderer">데스크톱 렌더러</string>
<string name="mode_renderer_hint">데스크톱을 그리는 역할을 합니다.</string>
<string name="mode_renderer_vulkan">vulkan - GPU</string>
<string name="mode_renderer_gles2">gles2 - GPU(실험적)</string>
<string name="mode_renderer_pixman">pixman - 소프트웨어</string>
<string name="mode_renderer_note">Vulkan은 GPU를 사용하여 데스크톱 프로그램을 실행하고, 실패하면 pixman으로 대체합니다. pixman을 사용할 때도 게임은 GPU에서 전체 화면으로 실행됩니다.</string>
<string name="mode_custom_res_title">사용자 정의 해상도</string>
<string name="mode_custom_res_text">해상도 상한과 화면 비율을 대체합니다. 화면과 일치하지 않는 크기는 검은색 여백으로 표시됩니다.</string>
<string name="mode_width">너비</string>
@@ -886,7 +879,7 @@
<string name="content_open_desktop">데스크톱 열기</string>
<string name="content_install_open_desktop">설치 및 데스크톱 열기</string>
<string name="content_linux_desktop">Linux 데스크톱</string>
<string name="content_linux_desktop_hint">LXQt, Firefox 및 에뮬레이터</string>
<string name="content_linux_desktop_hint">KDE Plasma, Firefox 및 에뮬레이터</string>
<string name="games_empty">Steam에서 설치한 게임은 세션 종료 후 여기에 표시됩니다.</string>
<string name="games_play_steam">Steam 실행</string>
<string name="games_launch_settings">실행 설정</string>
@@ -1234,7 +1227,6 @@
<!-- %1$s is the program's name -->
<string name="session_named_paused">%1$s 일시 중지됨</string>
<string name="session_program_paused">프로그램이 일시 중지됨</string>
<string name="session_starting_steam_desktop">데스크톱에서 Steam 시작 중</string>
<string name="session_starting_desktop">데스크톱 시작 중</string>
<!-- %1$s is the program's name -->
@@ -1260,7 +1252,6 @@
<string name="session_proton_unpacking">Proton Experimental(ARM64) 압축 해제 중</string>
<string name="session_runtime_catalog_unreachable">런타임 카탈로그에 연결할 수 없습니다. 연결을 확인한 후 \"Steam 실행\"을 다시 누르세요.</string>
<string name="session_runtime_install_failed">Linux 런타임이 설치되지 않았습니다. \"설정\"에서 런타임을 확인한 후 \"Steam 실행\"을 다시 누르세요.</string>
<string name="session_desktop_catalog_unreachable">데스크톱 카탈로그에 연결할 수 없습니다. 연결을 확인한 후 \"데스크톱\"을 다시 누르세요.</string>
<!-- %1$s says what went wrong -->
<string name="session_desktop_install_failed">데스크톱이 설치되지 않았습니다(%1$s). 연결을 확인한 후 \"데스크톱\"을 다시 누르세요.</string>
+1 -8
View File
@@ -333,13 +333,6 @@
<string name="mode_storage_diagnostics">Диагностика хранилища</string>
<string name="mode_storage_diagnostics_hint">Записывает результаты выделения места и выборочные замеры скорости хранилища в журналы. Пока включено, установка может идти медленнее. Вступит в силу в следующей сессии.</string>
<string name="mode_choose_folder">Выбрать папку…</string>
<string name="mode_renderer">Рендерер</string>
<string name="mode_desktop_renderer">Рендерер рабочего стола</string>
<string name="mode_renderer_hint">Отвечает за отрисовку рабочего стола.</string>
<string name="mode_renderer_vulkan">vulkan — GPU</string>
<string name="mode_renderer_gles2">gles2 — GPU (экспериментально)</string>
<string name="mode_renderer_pixman">pixman — программный</string>
<string name="mode_renderer_note">Vulkan использует GPU для запуска программ рабочего стола, при сбое переключается на pixman. При использовании pixman игры по-прежнему запускаются в полноэкранном режиме на GPU.</string>
<string name="mode_custom_res_title">Пользовательское разрешение</string>
<string name="mode_custom_res_text">Заменяет предел разрешения и соотношение сторон. Размеры, не соответствующие экрану, будут отображаться с черными полосами.</string>
<string name="mode_width">Ширина</string>
@@ -869,7 +862,7 @@
<string name="content_open_desktop">Открыть рабочий стол</string>
<string name="content_install_open_desktop">Установить и открыть рабочий стол</string>
<string name="content_linux_desktop">Рабочий стол Linux</string>
<string name="content_linux_desktop_hint">LXQt, Firefox и ваши эмуляторы</string>
<string name="content_linux_desktop_hint">KDE Plasma, Firefox и ваши эмуляторы</string>
<string name="games_empty">Игры, установленные в Steam, появятся здесь после завершения сессии.</string>
<string name="games_play_steam">Запустить Steam</string>
<string name="games_launch_settings">Настройки запуска</string>
+1 -10
View File
@@ -358,13 +358,6 @@
<string name="mode_storage_diagnostics">存储诊断</string>
<string name="mode_storage_diagnostics_hint">在分享日志中记录分配结果和存储采样耗时。启用期间可能减慢安装。将在下次会话生效。</string>
<string name="mode_choose_folder">选择文件夹…</string>
<string name="mode_renderer">渲染器</string>
<string name="mode_desktop_renderer">桌面渲染器</string>
<string name="mode_renderer_hint">绘制桌面。</string>
<string name="mode_renderer_vulkan">vulkan - GPU</string>
<string name="mode_renderer_gles2">gles2 - GPU(实验性)</string>
<string name="mode_renderer_pixman">pixman - 软件</string>
<string name="mode_renderer_note">Vulkan 让桌面程序运行在 GPU 上,失败时回退到 pixman。桌面改用 pixman 时,游戏仍会全屏运行在 GPU 上。</string>
<string name="mode_custom_res_title">自定义分辨率</string>
<string name="mode_custom_res_text">取代上限与比例。与屏幕不匹配的尺寸会出现黑边。</string>
<string name="mode_width">宽度</string>
@@ -886,7 +879,7 @@
<string name="content_open_desktop">打开桌面</string>
<string name="content_install_open_desktop">安装并打开桌面</string>
<string name="content_linux_desktop">Linux 桌面</string>
<string name="content_linux_desktop_hint">LXQt、Firefox 和你的模拟器</string>
<string name="content_linux_desktop_hint">KDE Plasma、Firefox 和你的模拟器</string>
<string name="games_empty">你在 Steam 安装的游戏会在会话结束后显示在这里。</string>
<string name="games_play_steam">游玩 Steam</string>
<string name="games_launch_settings">启动设置</string>
@@ -1234,7 +1227,6 @@
<!-- %1$s is the program's name -->
<string name="session_named_paused">%1$s 已暂停</string>
<string name="session_program_paused">程序已暂停</string>
<string name="session_starting_steam_desktop">正在桌面上启动 Steam</string>
<string name="session_starting_desktop">正在启动桌面</string>
<!-- %1$s is the program's name -->
@@ -1260,7 +1252,6 @@
<string name="session_proton_unpacking">正在解包 Proton Experimental(ARM64)</string>
<string name="session_runtime_catalog_unreachable">无法连接运行时目录。请检查网络连接,然后再次点“游玩”。</string>
<string name="session_runtime_install_failed">Linux 运行时未能安装。请在“配置”中检查运行时,然后再次点“游玩”。</string>
<string name="session_desktop_catalog_unreachable">无法连接桌面目录。请检查网络连接,然后再次点“桌面”。</string>
<!-- %1$s says what went wrong -->
<string name="session_desktop_install_failed">桌面未能安装(%1$s)。请检查网络连接,然后再次点“桌面”。</string>
+1 -10
View File
@@ -358,13 +358,6 @@
<string name="mode_storage_diagnostics">儲存空間診斷</string>
<string name="mode_storage_diagnostics_hint">在分享的記錄中加入空間分配結果和抽樣的儲存時間數據。啟用時可能會減慢安裝速度。下次會話生效。</string>
<string name="mode_choose_folder">選擇資料夾…</string>
<string name="mode_renderer">渲染器</string>
<string name="mode_desktop_renderer">桌面渲染器</string>
<string name="mode_renderer_hint">負責繪製桌面。</string>
<string name="mode_renderer_vulkan">vulkan - GPU</string>
<string name="mode_renderer_gles2">gles2 - GPU(實驗性)</string>
<string name="mode_renderer_pixman">pixman - 軟件</string>
<string name="mode_renderer_note">Vulkan 會用 GPU 執行桌面程式,失敗時改用 pixman。使用 pixman 時,遊戲仍會以全螢幕在 GPU 上執行。</string>
<string name="mode_custom_res_title">自訂解像度</string>
<string name="mode_custom_res_text">取代解像度上限和螢幕比例。尺寸與螢幕不符時會顯示黑邊。</string>
<string name="mode_width">寬度</string>
@@ -886,7 +879,7 @@
<string name="content_open_desktop">開啟桌面</string>
<string name="content_install_open_desktop">安裝並開啟桌面</string>
<string name="content_linux_desktop">Linux 桌面</string>
<string name="content_linux_desktop_hint">LXQt、Firefox 和你的模擬器</string>
<string name="content_linux_desktop_hint">KDE Plasma、Firefox 和你的模擬器</string>
<string name="games_empty">你在 Steam 安裝的遊戲會在會話結束後顯示在這裡。</string>
<string name="games_play_steam">開啟 Steam</string>
<string name="games_launch_settings">啟動設定</string>
@@ -1234,7 +1227,6 @@
<!-- %1$s is the program's name -->
<string name="session_named_paused">%1$s 已暫停</string>
<string name="session_program_paused">程式已暫停</string>
<string name="session_starting_steam_desktop">正在桌面上啟動 Steam</string>
<string name="session_starting_desktop">正在啟動桌面</string>
<!-- %1$s is the program's name -->
@@ -1260,7 +1252,6 @@
<string name="session_proton_unpacking">正在解壓 Proton Experimental (ARM64)</string>
<string name="session_runtime_catalog_unreachable">無法連接運行環境目錄。請檢查網絡連線,然後再按「開啟 Steam」。</string>
<string name="session_runtime_install_failed">Linux 運行環境未能安裝。請在「設定」中檢查運行環境,然後再按「開啟 Steam」。</string>
<string name="session_desktop_catalog_unreachable">無法連接桌面目錄。請檢查網絡連線,然後再按「桌面」。</string>
<!-- %1$s says what went wrong -->
<string name="session_desktop_install_failed">桌面未能安裝(%1$s)。請檢查網絡連線,然後再按「桌面」。</string>
+1 -10
View File
@@ -358,13 +358,6 @@
<string name="mode_storage_diagnostics">儲存空間診斷</string>
<string name="mode_storage_diagnostics_hint">在「分享日誌」中記錄空間配置結果和取樣的儲存存取時間。啟用期間可能會減慢安裝速度。下次工作階段生效。</string>
<string name="mode_choose_folder">選擇資料夾…</string>
<string name="mode_renderer">渲染器</string>
<string name="mode_desktop_renderer">桌面渲染器</string>
<string name="mode_renderer_hint">負責繪製桌面。</string>
<string name="mode_renderer_vulkan">vulkan - GPU</string>
<string name="mode_renderer_gles2">gles2 - GPU(實驗性)</string>
<string name="mode_renderer_pixman">pixman - 軟體</string>
<string name="mode_renderer_note">Vulkan 使用 GPU 執行桌面程式,失敗時退回 pixman。使用 pixman 時,遊戲仍會在 GPU 上全螢幕執行。</string>
<string name="mode_custom_res_title">自訂解析度</string>
<string name="mode_custom_res_text">取代解析度上限和螢幕比例。不符合螢幕的尺寸會顯示黑邊。</string>
<string name="mode_width">寬度</string>
@@ -886,7 +879,7 @@
<string name="content_open_desktop">開啟桌面</string>
<string name="content_install_open_desktop">安裝並開啟桌面</string>
<string name="content_linux_desktop">Linux 桌面</string>
<string name="content_linux_desktop_hint">LXQt、Firefox 和你的模擬器</string>
<string name="content_linux_desktop_hint">KDE Plasma、Firefox 和你的模擬器</string>
<string name="games_empty">在 Steam 中安裝的遊戲會在工作階段結束後顯示在這裡。</string>
<string name="games_play_steam">執行 Steam</string>
<string name="games_launch_settings">啟動設定</string>
@@ -1234,7 +1227,6 @@
<!-- %1$s is the program's name -->
<string name="session_named_paused">%1$s 已暫停</string>
<string name="session_program_paused">程式已暫停</string>
<string name="session_starting_steam_desktop">正在桌面上啟動 Steam</string>
<string name="session_starting_desktop">正在啟動桌面</string>
<!-- %1$s is the program's name -->
@@ -1260,7 +1252,6 @@
<string name="session_proton_unpacking">正在解壓縮 Proton Experimental(ARM64)</string>
<string name="session_runtime_catalog_unreachable">無法連線到執行環境目錄。請檢查網路連線,然後再按一次「執行」。</string>
<string name="session_runtime_install_failed">Linux 執行環境未能安裝。請在「設定」中檢查執行環境,然後再按一次「執行」。</string>
<string name="session_desktop_catalog_unreachable">無法連線到桌面目錄。請檢查網路連線,然後再按一次「桌面」。</string>
<!-- %1$s says what went wrong -->
<string name="session_desktop_install_failed">桌面未能安裝(%1$s)。請檢查網路連線,然後再按一次「桌面」。</string>
+8 -12
View File
@@ -326,16 +326,20 @@
<string name="wincomp_found_steam">Steam installs %1$s with this game</string>
<string name="wincomp_already_here">Already in this game</string>
<string name="wincomp_no_recommendation">Nothing in the game\'s folder points at a component.</string>
<string name="wincomp_active">Installed for this game (%1$d)</string>
<string name="wincomp_all">All components (%1$d)</string>
<string name="wincomp_installers">Need a Windows installer (%1$d)</string>
<string name="wincomp_installers_note">These run a real installer inside the prefix (.NET, PhysX, XNA, the full Visual C++ installers…). DroidDeck cannot do that yet; it is coming next.</string>
<string name="wincomp_installers_note">These are their own setup programs (codec packs, browsers, old runtimes) with no package inside to take apart. DroidDeck cannot run a Windows setup program yet; it is coming next.</string>
<string name="wincomp_show">Show</string>
<string name="wincomp_hide">Hide</string>
<string name="wincomp_needs_installer">Needs a Windows installer (coming)</string>
<string name="wincomp_needs_installer">Runs its own setup program (coming)</string>
<string name="wincomp_unsupported">Not supported here yet</string>
<string name="wincomp_loading">Loading the components…</string>
<string name="wincomp_failed">Could not install: %1$s</string>
<string name="wincomp_downloaded">Downloaded</string>
<string name="wincomp_downloading">Downloading %1$s</string>
<string name="wincomp_installing">Installing: %1$s</string>
<string name="wincomp_reverting">Turning off…</string>
<string name="wincomp_download_size">%1$s download</string>
<string name="wincomp_next_launch">Takes effect the next time the game starts.</string>
<string name="mode_stretch169">Stretch 16:9 games</string>
@@ -364,13 +368,6 @@
<string name="mode_storage_diagnostics">Storage diagnostics</string>
<string name="mode_storage_diagnostics_hint">Record allocation results and sampled storage timings in Share logs. May slow installs while enabled. Applies next session.</string>
<string name="mode_choose_folder">Choose a folder…</string>
<string name="mode_renderer">Renderer</string>
<string name="mode_desktop_renderer">Desktop renderer</string>
<string name="mode_renderer_hint">Draws the desktop.</string>
<string name="mode_renderer_vulkan">vulkan - GPU</string>
<string name="mode_renderer_gles2">gles2 - GPU (experimental)</string>
<string name="mode_renderer_pixman">pixman - software</string>
<string name="mode_renderer_note">Vulkan runs desktop programs on the GPU, falling back to pixman if it fails. On pixman, games open full screen on the GPU.</string>
<string name="mode_custom_res_title">Custom resolution</string>
<string name="mode_custom_res_text">Replaces the cap and ratio. A size that doesn\'t match the screen gets bars.</string>
<string name="mode_width">Width</string>
@@ -896,7 +893,7 @@
<string name="content_open_desktop">Open desktop</string>
<string name="content_install_open_desktop">Install &amp; open desktop</string>
<string name="content_linux_desktop">Linux desktop</string>
<string name="content_linux_desktop_hint">LXQt, Firefox and your emulators</string>
<string name="content_linux_desktop_hint">KDE Plasma, Firefox and your emulators</string>
<string name="games_empty">Games you install in Steam show up here after the session.</string>
<string name="games_play_steam">Play Steam</string>
<string name="games_launch_settings">Launch settings</string>
@@ -1226,7 +1223,6 @@
<!-- %1$s is the program's name -->
<string name="session_named_paused">%1$s is paused</string>
<string name="session_program_paused">The program is paused</string>
<string name="session_starting_steam_desktop">Starting Steam on the desktop</string>
<string name="session_starting_desktop">Starting the desktop</string>
<!-- %1$s is the program's name -->
<string name="session_starting_named">Starting %1$s</string>
@@ -1250,7 +1246,6 @@
<string name="session_proton_unpacking">unpacking Proton Experimental (ARM64)</string>
<string name="session_runtime_catalog_unreachable">Could not reach the runtime catalog. Check the connection and press Play again.</string>
<string name="session_runtime_install_failed">The Linux runtime did not install. Check the runtime in Setup and press Play again.</string>
<string name="session_desktop_catalog_unreachable">Could not reach the desktop catalog. Check the connection and press Desktop again.</string>
<!-- %1$s says what went wrong -->
<string name="session_desktop_install_failed">The desktop did not install (%1$s). Check the connection and press Desktop again.</string>
<!-- %1$s is the program's name, or Steam -->
@@ -1947,6 +1942,7 @@
<string name="display_frame_rate">Frame rate</string>
<string name="display_look_filter">%1$s Sets scaling to %2$s.</string>
<string name="display_match_screen">Match screen (%1$d×%2$d)</string>
<string name="display_follow_screen">Follow screen (resizes when folded or unfolded)</string>
<string name="mode_tab_steam">Steam</string>
<string name="device_info_show">Show device details</string>
<string name="device_info_hide">Hide device details</string>
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="shared_logs" path="shared-logs/" />
<cache-path name="shared_logs" path="share/" />
</paths>
@@ -87,4 +87,65 @@ class LogRedactorTest {
assertEquals(once, LogRedactor.redact(once))
}
}
// The Steam UI's own login line (webhelper_js.txt), as the privacy scan found it.
@Test fun loginStateLineLosesAnEmailAccount() {
val line = "[2026-10-07 21:14:03] SteamUI: INFO: Login: OnLoginStateChange someone.masked@example.com 2 1 0 0"
val out = LogRedactor.redact(line)
assertFalse(out.contains("someone.masked"))
assertFalse(out.contains("example.com"))
assertEquals("[2026-10-07 21:14:03] SteamUI: INFO: Login: OnLoginStateChange <redacted:account> 2 1 0 0", out)
assertEquals(out, LogRedactor.redactForShare(line))
}
@Test fun loginStateLineLosesAPlainAccountName() {
val line = "[2026-10-07 21:14:03] SteamUI: INFO: Login: OnLoginStateChange maskeduser42 2 1 0 0"
val out = LogRedactor.redact(line)
assertFalse(out.contains("maskeduser42"))
assertEquals("[2026-10-07 21:14:03] SteamUI: INFO: Login: OnLoginStateChange <redacted:account> 2 1 0 0", out)
assertEquals(out, LogRedactor.redactForShare(line))
}
@Test fun loginStateWithoutAnAccountIsKept() {
val line = "SteamUI: INFO: Login: OnLoginStateChange 0 1 0 0"
assertEquals(line, LogRedactor.redact(line))
}
@Test fun accountNameFieldsAreRedacted() {
val lines = listOf(
"\t\"AccountName\"\t\t\"maskeduser42\"",
"account_name=maskeduser42 remember=1",
"{\"login\":\"maskeduser42\",\"persist\":1}",
"auth: login=maskeduser42&remember=1",
"accountName: maskeduser42",
"{\"username\": \"masked user 42\"}",
)
for (line in lines) {
val out = LogRedactor.redactForShare(line)
assertFalse(out, out.contains("maskeduser42") || out.contains("masked user"))
assertTrue(out, out.contains("<redacted:account>"))
assertEquals(out, LogRedactor.redactForShare(out))
}
}
@Test fun loginAsAWordIsNotAField() {
for (line in listOf("SteamUI: INFO: Login: OnLoginStateChange 0 1 0 0", "login refresh pending", "Login: state 5")) {
assertEquals(line, LogRedactor.redact(line))
}
}
@Test fun privateAddressesLeaveTheZipPublicOnesStay() {
assertEquals("I/LinuxNetworkLink: resolver: <lan-address> <lan-address> 8.8.8.8",
LogRedactor.redactForShare("I/LinuxNetworkLink: resolver: 192.168.1.1 10.0.0.138 8.8.8.8"))
assertEquals("gateway <lan-address>:53 link <lan-address> lan <lan-address>",
LogRedactor.redactForShare("gateway 172.16.4.20:53 link 169.254.10.2 lan 172.31.255.254"))
for (line in listOf(
"connecting to CM 162.254.193.47:27017",
"public 172.32.0.1 and 11.0.0.1 and 193.168.1.1",
"Windows 10.0.19041.1 build 10.0.19045",
"Proton 10.0-3, driver 25.1.0.4",
)) assertEquals(line, LogRedactor.redactForShare(line))
val once = LogRedactor.redactForShare("resolver: 192.168.0.1")
assertEquals(once, LogRedactor.redactForShare(once))
}
}
@@ -0,0 +1,39 @@
package com.droiddeck.launcher.core
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Test
class SecretScrubTest {
private fun share(line: String) = SecretScrub.scrub(line, SecretScrub.Urls.KEEP_PATH, "<redacted:token>")
@Test fun windowsExceptionCodesAreKept() {
for (line in listOf(
"0024:trace:seh:dispatch_exception code=406d1388 flags=0 addr=00006FFFFFC0A6E8",
"0024:warn:seh:dispatch_exception code=c0000005 flags=0 addr=0000000140012345",
"0030:trace:seh:handle_syscall_fault code=80000003 flags=0",
"exception code=0xC0000005 at 0x140012345",
// An exception code stays one even on a line that also carries OAuth keys.
"client_id=abc code=c0000005",
)) assertEquals(line, share(line))
}
@Test fun anOAuthCodeIsBlanked() {
assertEquals("redirect client_id=34a02cf8 redirect_uri=x state=1 code=<redacted:token>",
share("redirect client_id=34a02cf8 redirect_uri=x state=1 code=AUTHCODE123"))
assertEquals("GET /on_login_success?code=<redacted:token>&scope=",
share("GET /on_login_success?code=AUTHCODE123&scope="))
assertEquals("exchange_code=<redacted:token>", share("exchange_code=0123456789abcdef"))
assertEquals("authorizationCode=<redacted:token>", share("authorizationCode=ABCD1234XYZ"))
}
@Test fun aCodeWithoutOAuthAroundItIsKept() {
for (line in listOf("exit code=1337", "status code=ERR_TIMEOUT", "code 403")) assertEquals(line, share(line))
}
@Test fun scrubbingTwiceChangesNothing() {
val once = share("client_id=1 code=AUTHCODE123 ?code=XYZW1234567")
assertFalse(once.contains("AUTHCODE123"))
assertEquals(once, share(once))
}
}
@@ -16,6 +16,7 @@ class RuntimeRemovalTest {
private lateinit var dir: File
@Before fun setUp() { dir = Files.createTempDirectory("runtime-removal").toFile() }
@After fun tearDown() {
RuntimeFileTree.refuseForTest = null
dir.setWritable(true)
RuntimeFileTree.delete(dir, null)
}
@@ -160,4 +161,40 @@ class RuntimeRemovalTest {
assertTrue(LinuxRuntimeInstaller.beginUninstall(null, root)!!.run(null))
assertNull(LinuxRuntimeInstaller.removalError())
}
@Test fun anEntryTheAppCannotDeleteIsSetAsideInsteadOfStrandingTheRemoval() {
val root = runtime()
File(root, "root/.steampath").writeText("made by su")
RuntimeFileTree.refuseForTest = java.util.function.Predicate { it.fileName.toString() == ".steampath" }
assertTrue(LinuxRuntimeInstaller.beginUninstall(null, root)!!.run(null))
assertNull(LinuxRuntimeInstaller.removalError())
assertFalse(root.exists())
assertFalse(File(dir, "linuxfs.removing").exists())
// Only the undeletable entry and its parents remain, out of the way.
val trash = File(dir, LinuxRuntimeInstaller.TRASH)
assertEquals(listOf(".steampath"), trash.walk().filter { it.isFile }.map { it.name }.toList())
assertEquals(setOf(LinuxRuntimeInstaller.TRASH), dir.list()!!.toSet())
// Once it can be deleted, the next removal clears the trash too.
RuntimeFileTree.refuseForTest = null
assertTrue(LinuxRuntimeInstaller.beginUninstall(null, root)!!.run(null))
assertFalse(trash.exists())
}
@Test fun aStuckQuarantineFromAnEarlierBuildClearsOnTheNextRemoval() {
val pending = File(dir, "linuxfs.removing").apply { File(this, "root").mkdirs() }
File(pending, "root/.steampid").writeText("1")
File(pending, "root/game").writeText("game")
RuntimeFileTree.refuseForTest = java.util.function.Predicate { it.fileName.toString() == ".steampid" }
assertTrue(LinuxRuntimeInstaller.beginUninstall(null, File(dir, "linuxfs"))!!.run(null))
assertFalse(pending.exists())
}
@Test fun deleteWhatCanKeepsGoingPastAnEntryItCannotDelete() {
val root = runtime()
RuntimeFileTree.refuseForTest = java.util.function.Predicate { it.fileName.toString() == "gamescope" }
assertFalse(RuntimeFileTree.deleteWhatCan(root, null))
assertEquals(listOf("gamescope"), root.walk().filter { it.isFile }.map { it.name }.toList())
assertFalse(File(root, "root").exists())
}
}
@@ -27,15 +27,24 @@ class SessionDisplayTest {
@Test fun optionsListTheHeightsThePanelCanShowThenThePanel() {
val thor = SessionDisplay.resolutionOptions(1920 to 1080)
assertEquals(listOf("720p", "900p", SessionDisplay.MATCH_SCREEN), thor)
assertEquals(listOf("720p", "900p", SessionDisplay.MATCH_SCREEN), SessionDisplay.resolutionOptions(2400 to 1080))
assertEquals(listOf("720p", "900p", "1080p", SessionDisplay.MATCH_SCREEN), SessionDisplay.resolutionOptions(3120 to 1440))
assertEquals(listOf("720p", "900p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN), thor)
assertEquals(listOf("720p", "900p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN),
SessionDisplay.resolutionOptions(2400 to 1080))
assertEquals(listOf("720p", "900p", "1080p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN),
SessionDisplay.resolutionOptions(3120 to 1440))
val small = SessionDisplay.resolutionOptions(1280 to 720)
assertEquals(listOf(SessionDisplay.MATCH_SCREEN), small)
assertEquals(listOf(SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN), small)
assertEquals(1280 to 720, SessionDisplay.resolveChoice(1280 to 720, SessionDisplay.MATCH_SCREEN))
assertEquals(2560 to 1440, SessionDisplay.resolveChoice(2560 to 1440, SessionDisplay.MATCH_SCREEN))
}
@Test fun followScreenKeepsTheWindowShapeAndSkipsTinyWindows() {
assertEquals(2520 to 1080, SessionDisplay.resolveChoice(1080 to 2520, SessionDisplay.FOLLOW_SCREEN))
assertEquals(1968 to 2184, SessionDisplay.followSize(1968, 2184))
assertEquals(2184 to 1968, SessionDisplay.followSize(2185, 1969))
assertNull(SessionDisplay.followSize(640, 360))
}
@Test fun resolutionCapsPreserveTheSelectedShapeWithoutExceedingPanelHeight() {
assertEquals(1280 to 720, SessionDisplay.resolve(1920 to 1080, 720, SessionPrefs.SHAPE_AUTO))
assertEquals(960 to 720, SessionDisplay.resolve(1440 to 1080, 720, SessionPrefs.SHAPE_EXACT))
@@ -33,12 +33,13 @@ class SessionLogShareTest {
"rules $rules\n" + files.joinToString("") { val f = File(folder, it); "${f.length()}\t${f.lastModified()}\t$it\n" })
}
@Test fun aRecordedUnchangedFileGoesInAsItIs() {
@Test fun aRecordedUnchangedFileIsScrubbedAgainOnTheWayIntoTheZip() {
val folder = tmp.newFolder("2026-10-06-01-steam")
// Stands in for a file the ending scrubbed; the share must not pass it through again.
// A file the ending recorded as scrubbed still gets the share's final pass: the record
// may predate a rule, and a zip is the one way a log leaves the device.
File(folder, "session.log").writeText("$secret\n")
record(folder, "session.log")
assertTrue(zip(folder).getValue("session.log").contains(leaked))
assertFalse(zip(folder).getValue("session.log").contains(leaked))
}
@Test fun anythingTheRecordDoesNotVouchForIsScrubbed() {
@@ -0,0 +1,107 @@
package com.droiddeck.launcher.session
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
import java.util.zip.ZipFile
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
/** A shared zip is scrubbed on the way in, whatever the files on disk still hold. */
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [33])
class SessionLogShareZipTest {
private val app get() = RuntimeEnvironment.getApplication()
@Test fun everyTextFileInTheZipIsScrubbedAndTheStoresAndToolsLogsComeAlong() {
val logs = LinuxRuntime.logDir(app)
val session = File(logs, "2026-10-08-01-steam").apply { mkdirs() }
// Written raw, as a file from before a rule existed would be.
File(session, "session.log").writeText(
"fetch https://gog-cdn-fastly.gog.com/token=nva=1791500000~dirs=/x~token=0a1b2c3d4e5f/content-system/v2/store/1/ab/cd/f\n" +
"fetch https://epicgames-download1.akamaized.net/Builds/Org/a/ChunksV4/12/ABCD.chunk?__token__=exp=1~hmac=deadbeefcafe\n" +
"login refresh_token=abcdef123456 user someone@example.com code=AUTHCODE123\n" +
"Authorization: Bearer abc.def.ghi\n" +
"kept: EResult 5, app 1086940, steamapps/common/Game\n"
)
File(logs, "stores").apply { mkdirs() }.resolve("stores-2026-10-08.log").writeText("epic: f_token=zzzzzzzz12 window 32\n")
File(logs, SessionPaths.TOOLS_DIR).apply { mkdirs() }.resolve("flatpak-install.log").writeText("== install\nCookie: steamLoginSecure=76561198000000000%7C%7Ceyabc\n")
val zip = SessionLogShare.zipFolder(app, session)!!
assertTrue(zip.path.startsWith(File(app.cacheDir, "share").path))
val text = ZipFile(zip).use { z -> z.entries().toList().associate { e -> e.name to z.getInputStream(e).bufferedReader().readText() } }
assertTrue(text.keys.containsAll(listOf("2026-10-08-01-steam/session.log", "stores/stores-2026-10-08.log", "tools/flatpak-install.log")))
val all = text.values.joinToString("\n")
for (secret in listOf("0a1b2c3d4e5f", "deadbeefcafe", "abcdef123456", "someone@example.com", "AUTHCODE123", "abc.def.ghi", "zzzzzzzz12", "eyabc")) {
assertFalse("$secret survived", all.contains(secret))
}
// What makes a log worth reading stays.
assertTrue(all.contains("kept: EResult 5, app 1086940, steamapps/common/Game"))
assertTrue(all.contains("https://gog-cdn-fastly.gog.com/"))
SessionLogShare.clear(app)
assertFalse(zip.exists())
}
@Test fun theSharePassChangesNothingInACleanLine() {
val line = "dxvk: Device 0x5 (Adreno 750) https://github.com/doitsujin/dxvk/releases code 403"
assertEquals(line, com.droiddeck.launcher.core.LogRedactor.redactForShare(line))
}
// Folders an earlier build scrubbed and marked under older rules, their copied Steam UI log
// still naming the account: one app start (the move out of Download/, then the pass over
// older folders) leaves every one scrubbed on disk under the current rules.
private fun olderFolder(parent: File, name: String, marker: String = ".scrubbed-2"): File {
val dir = File(parent, name).apply { mkdirs() }
File(dir, marker).writeText("scrubbed earlier\n")
File(dir, SessionArtifacts.SCRUBBED_TREE_MARKER).writeText("rules 2\n")
File(dir, "steam").apply { mkdirs() }.resolve("webhelper_js.txt").writeText(
"[2026-10-01 20:00:00] SteamUI: INFO: Login: OnLoginStateChange someone.masked@example.com 2 1 0 0\n" +
"[2026-10-01 20:00:01] SteamUI: INFO: Login: OnLoginStateChange maskeduser42 2 1 0 0\n" +
"[2026-10-01 20:00:02] SteamUI: INFO: Login: OnLoginStateChange 0 1 0 0\n" +
"0024:trace:seh:dispatch_exception code=c0000005 flags=0\n"
)
return dir
}
private fun assertScrubbed(dir: File) {
val text = File(dir, "steam/webhelper_js.txt").readText()
for (secret in listOf("someone.masked", "example.com", "maskeduser42")) assertFalse("$secret survived in $dir", text.contains(secret))
assertTrue(text.contains("Login: OnLoginStateChange <redacted:account> 2 1 0 0"))
assertTrue(text.contains("Login: OnLoginStateChange 0 1 0 0"))
assertTrue(text.contains("code=c0000005"))
val markers = dir.list()!!.filter { it.startsWith(".scrubbed-") && it != SessionArtifacts.SCRUBBED_TREE_MARKER }
assertEquals("$dir", listOf(".scrubbed-r${com.droiddeck.launcher.core.LogRedactor.RULES_VERSION}"), markers)
assertTrue(File(dir, SessionArtifacts.SCRUBBED_TREE_MARKER).readText()
.startsWith("rules ${com.droiddeck.launcher.core.LogRedactor.RULES_VERSION}\n"))
}
@Test fun aFolderMarkedUnderOlderRulesIsScrubbedAgainAtStart() {
val dir = olderFolder(LinuxRuntime.logDir(app), "2026-10-01-01-steam")
SessionArtifacts.scrubOlder(app)
assertScrubbed(dir)
}
@Test fun everyMigratedFolderIsScrubbedUnderTheCurrentRulesInOneStart() {
val legacy = LinuxRuntime.legacyLogDir().apply { mkdirs() }
val names = (1..9).map { "2026-10-0${it}-01-steam" }
names.forEachIndexed { i, name ->
// Old markers of every kind an earlier build left, one even claiming the current rules.
olderFolder(legacy, name, marker = listOf(".scrubbed-2", ".scrubbed-1", ".scrubbed-r${com.droiddeck.launcher.core.LogRedactor.RULES_VERSION}")[i % 3])
}
File(legacy, "Saves").apply { mkdirs() }.resolve("keep.txt").writeText("save\n")
// What MainActivity runs at start.
LogMigration.run(app)
SessionArtifacts.scrubOlder(app)
val logs = LinuxRuntime.logDir(app)
for (name in names) assertScrubbed(File(logs, name))
assertEquals(listOf("Saves"), legacy.list()!!.toList())
}
}
@@ -32,15 +32,49 @@ class WinComponentsSupportTest {
step("install_msi", "url" to "$base/ps-x86.msi"), step("install_msi", "url" to "$base/ps-x64.msi"))))
}
@Test fun otherInstallersStillWait() {
assertEquals(Support.NEEDS_INSTALLER, support(component("dotnet48", step("install_exe", "url" to "$base/ndp48.exe"))))
// An uninstall step first (wine-mono) is not something done here.
assertEquals(Support.NEEDS_INSTALLER, support(component("mono", step("uninstall"),
step("install_msi", "url" to "$base/mono.msi"))))
@Test fun installerWrappersInstallHere() {
// A WiX bundle, a self-extracting cabinet or 7-Zip archive: the packages inside are laid out.
assertEquals(Support.READY, support(component("vcredist2022",
step("install_exe", "url" to "$base/vcredist2022__VC_redist.x86.exe", "file_name" to "VC_redist.x86.exe"),
step("install_exe", "url" to "$base/vcredist2022__VC_redist.x64.exe", "file_name" to "VC_redist.x64.exe"),
step("override_dll", "dll" to "vcruntime140", "type" to "native,builtin"))))
// .NET Framework: "uninstall Wine Mono", the Windows version, the installer, a registry key.
assertEquals(Support.READY, support(component("dotnet40",
step("uninstall", "file_name" to "Wine Mono"), step("set_windows", "version" to "win7"),
step("install_exe", "url" to "https://download.microsoft.com/x/dotNetFx40_Full_x86_x64.exe", "file_name" to "dotNetFx40_Full_x86_x64.exe"),
step("set_windows", "version" to "win10"),
step("set_register_key", "key" to "HKLM\\\\Software\\\\Microsoft\\\\NET Framework Setup\\\\NDP\\\\v4\\\\Full", "value" to "Install", "data" to "0001", "type" to "REG_DWORD"),
step("override_dll", "dll" to "mscoree", "type" to "native"))))
}
@Test fun nestedCatalogKeysAreRead() {
// A few .NET entries keep url and file_name under "environment".
val nested = WinComponents.Step("install_exe", JSONObject().put("environment", JSONObject()
.put("WINEDLLOVERRIDES", "fusion=b").put("file_name", "ndp48-x86-x64-allos-enu.exe")
.put("url", "https://download.visualstudio.microsoft.com/x/ndp48-x86-x64-allos-enu.exe")))
assertEquals("ndp48-x86-x64-allos-enu.exe", nested.str("file_name"))
assertEquals(Support.READY, support(component("dotnet48", nested)))
}
@Test fun cabinetPicksInstallHere() {
assertEquals(Support.READY, support(component("xact",
step("download_archive", "url" to "$base/directx_Jun2010_redist.exe", "file_name" to "directx_Jun2010_redist.exe"),
step("get_from_cab", "source" to "directx_Jun2010_redist.exe", "file_name" to "*XACT_x86*.cab", "dest" to "temp/XACT_x86/"),
step("get_from_cab", "source" to "XACT_x86/*.cab", "file_name" to "xactengine*.dll", "dest" to "win32/"),
step("override_dll", "dll" to "xactengine3_7", "type" to "native,builtin"),
step("register_dll", "dlls" to ""))))
}
@Test fun setupProgramsStillWait() {
// NSIS / InnoSetup installers hold no package to lay out.
assertEquals(Support.NEEDS_INSTALLER, support(component("K-Lite",
step("install_exe", "url" to "$base/K-Lite.exe", "file_name" to "K-Lite_1960.exe"))))
assertEquals(Support.NEEDS_INSTALLER, support(component("plain", step("install_msi", "url" to "http://example.com/a.msi"))))
}
@Test fun whatProtonShipsIsNotOffered() {
assertEquals(Support.UNSUPPORTED, support(component("gecko", step("install_msi", "url" to "$base/gecko.msi"))))
assertEquals(Support.UNSUPPORTED, support(component("mono", step("uninstall"), step("install_msi", "url" to "$base/mono.msi"))))
assertEquals(Support.UNSUPPORTED, support(component("mono-10.4.1", step("install_msi", "url" to "$base/mono.msi"))))
}
}
@@ -0,0 +1,173 @@
package com.droiddeck.launcher.stores
import org.json.JSONObject
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
import java.io.File
import java.security.SecureRandom
import javax.crypto.SecretKey
import javax.crypto.spec.SecretKeySpec
/** The stores' sign-in files sealed at rest; a plain key stands in for the AndroidKeyStore. */
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [33])
class StoreAccountsCipherTest {
private val app get() = RuntimeEnvironment.getApplication()
private fun newKey(): SecretKey = SecretKeySpec(ByteArray(32).also { SecureRandom().nextBytes(it) }, "AES")
private val key = newKey()
private val fake = CredentialCipher.KeyProvider { key }
private val broken = CredentialCipher.KeyProvider { throw java.security.KeyStoreException("no keystore") }
private val creds = JSONObject().put("access_token", "AT-secret-123456").put("refresh_token", "RT-secret-654321")
.put("account_id", "acct-1").put("display_name", "Someone").put("expires_at", 1_900_000_000_000L)
private fun file(store: Store) = StoreAccounts.credentialsFile(app, store)
@Before fun setUp() { StoreAccounts.keys = fake; StoreAccounts.keystoreFailed = false }
@After fun tearDown() {
StoreAccounts.keys = CredentialCipher.Keystore; StoreAccounts.keystoreFailed = false
for (store in Store.entries) StoreAccounts.clear(app, store)
}
@Test fun envelopeRoundTrips() {
val envelope = CredentialCipher.seal(creds.toString(), fake)
assertEquals(1, envelope.getInt("v"))
assertEquals("AES/GCM", envelope.getString("alg"))
assertFalse(envelope.toString().contains("secret"))
assertEquals(creds.toString(), CredentialCipher.open(envelope, fake))
// A fresh IV every time.
assertFalse(envelope.getString("iv") == CredentialCipher.seal(creds.toString(), fake).getString("iv"))
}
@Test fun writtenCredentialsAreSealedOnDisk() {
StoreAccounts.write(app, Store.EPIC, creds)
val text = file(Store.EPIC).readText()
assertFalse(text.contains("AT-secret") || text.contains("RT-secret") || text.contains("Someone"))
assertTrue(CredentialCipher.isEnvelope(JSONObject(text)))
assertEquals(creds.toString(), StoreAccounts.read(app, Store.EPIC).toString())
assertEquals("Someone", StoreAccounts.signedInAs(app, Store.EPIC))
assertFalse(File(file(Store.EPIC).path + ".tmp").exists())
}
@Test fun aPlainFileFromAnEarlierBuildIsSealedAndStaysSignedIn() {
for (store in Store.entries) file(store).writeText(creds.toString())
File(file(Store.GOG).path + ".tmp").writeText(creds.toString())
StoreAccounts.encryptAll(app)
for (store in Store.entries) {
val text = file(store).readText()
assertTrue(store.id, CredentialCipher.isEnvelope(JSONObject(text)))
assertFalse(store.id, text.contains("secret"))
assertEquals(store.id, creds.toString(), StoreAccounts.read(app, store).toString())
}
assertFalse(File(file(Store.GOG).path + ".tmp").exists())
}
@Test fun aTamperedFileReadsAsSignedOutAndIsDeleted() {
StoreAccounts.write(app, Store.GOG, creds)
val envelope = JSONObject(file(Store.GOG).readText())
val ct = android.util.Base64.decode(envelope.getString("ct"), android.util.Base64.NO_WRAP)
ct[0] = (ct[0].toInt() xor 1).toByte()
file(Store.GOG).writeText(envelope.put("ct", android.util.Base64.encodeToString(ct, android.util.Base64.NO_WRAP)).toString())
assertNull(StoreAccounts.read(app, Store.GOG))
assertNull(StoreAccounts.signedInAs(app, Store.GOG))
assertFalse(file(Store.GOG).exists())
}
@Test fun aFileSealedUnderALostKeyReadsAsSignedOutAndIsDeleted() {
StoreAccounts.write(app, Store.AMAZON, creds)
// Data cleared, or a backup restored on another device: the Keystore key is a new one.
val other = newKey()
StoreAccounts.keys = CredentialCipher.KeyProvider { other }
assertNull(StoreAccounts.read(app, Store.AMAZON))
assertFalse(file(Store.AMAZON).exists())
}
@Test fun garbageReadsAsSignedOut() {
file(Store.EPIC).writeText("{\"v\":1,\"alg\":\"AES/GCM\",\"iv\":\"!!\",\"ct\":\"??\"}")
assertNull(StoreAccounts.read(app, Store.EPIC))
file(Store.EPIC).writeText("not json")
assertNull(StoreAccounts.read(app, Store.EPIC))
}
@Test fun withoutAKeystoreCredentialsStayPlainAndTheNextStartSealsThem() {
StoreAccounts.keys = broken
StoreAccounts.write(app, Store.EPIC, creds)
assertEquals(creds.toString(), file(Store.EPIC).readText())
assertEquals(creds.toString(), StoreAccounts.read(app, Store.EPIC).toString())
assertTrue(StoreAccounts.keystoreFailed)
// The next start, on a Keystore that works.
StoreAccounts.keys = fake
StoreAccounts.keystoreFailed = false
StoreAccounts.encryptAll(app)
assertTrue(CredentialCipher.isEnvelope(JSONObject(file(Store.EPIC).readText())))
assertEquals(creds.toString(), StoreAccounts.read(app, Store.EPIC).toString())
}
@Test fun signOutRemovesTheFile() {
StoreAccounts.write(app, Store.GOG, creds)
StoreAccounts.clear(app, Store.GOG)
assertFalse(file(Store.GOG).exists())
assertNull(StoreAccounts.read(app, Store.GOG))
}
/** A Keystore whose key is there but which fails to hand it over [failures] times first. */
private class Flaky(private val key: SecretKey, var failures: Int, private val error: () -> Exception) : CredentialCipher.KeyProvider {
override fun key(): SecretKey = key
override fun existing(): SecretKey { if (failures > 0) { failures--; throw error() }; return key }
}
@Test fun aTransientKeystoreFailureKeepsTheFileAndALaterReadSucceeds() {
StoreAccounts.write(app, Store.EPIC, creds)
val sealed = file(Store.EPIC).readText()
for (error in listOf<() -> Exception>(
{ java.security.ProviderException("busy") },
{ java.security.KeyStoreException("keystore down") },
{ java.security.InvalidKeyException("not now") },
{ java.io.IOException("read") },
)) {
StoreAccounts.keys = Flaky(key, 1, error)
assertNull(StoreAccounts.read(app, Store.EPIC))
assertTrue(StoreAccounts.isUnavailable(Store.EPIC))
assertEquals(sealed, file(Store.EPIC).readText())
// Still signed in for the page: no sign-in card, and an action says why it failed.
assertEquals("Epic sign-in could not be read: try again.", StoresState.notSignedInLine(Store.EPIC))
// The next access, once the Keystore answers.
assertEquals(creds.toString(), StoreAccounts.read(app, Store.EPIC).toString())
assertFalse(StoreAccounts.isUnavailable(Store.EPIC))
assertEquals("Someone", StoreAccounts.signedInAs(app, Store.EPIC))
assertEquals("Epic session expired: sign in again.", StoresState.notSignedInLine(Store.EPIC))
}
}
@Test fun signedInAsKeepsTheStoreWhileItsSignInIsUnavailable() {
StoreAccounts.write(app, Store.GOG, creds)
StoreAccounts.keys = Flaky(key, 5) { java.security.ProviderException("busy") }
assertEquals("GOG", StoreAccounts.signedInAs(app, Store.GOG))
assertTrue(file(Store.GOG).exists())
}
@Test fun aKeyGoneFromTheKeystoreReadsAsSignedOutAndIsDeleted() {
StoreAccounts.write(app, Store.AMAZON, creds)
StoreAccounts.keys = object : CredentialCipher.KeyProvider {
override fun key(): SecretKey = newKey()
override fun existing(): SecretKey = throw CredentialCipher.KeyMissing()
}
assertNull(StoreAccounts.read(app, Store.AMAZON))
assertFalse(StoreAccounts.isUnavailable(Store.AMAZON))
assertFalse(file(Store.AMAZON).exists())
}
}
+5 -5
View File
@@ -22,7 +22,7 @@ The script then unpacks them without hooks and checks what the binaries link. Li
the Desktop package normally brings (PyGObject, json-glib, fuse3 and others) are fetched too,
but only when their files are missing. Flathub is added as a per-user remote from a copy of
its `.flatpakrepo` carried in the script, so that step needs no network. Every store command
writes its output to `Download/DroidDeck/flatpak-<verb>.log`, next to the session logs. The
writes its output to `files/logs/tools/flatpak-<verb>.log`, next to the session logs. The
setup script also puts Flatpak's own error text in the failure message the app shows.
## bubblewrap without namespaces
@@ -51,8 +51,8 @@ The spawner also adds what the rootfs gives its own programs:
- **GPU.** Flathub's Mesa has Turnip only for DRM, and Adreno on Android is KGSL. The runtime's
own `libvulkan_freedreno.so` is bound in with the three libraries the Freedesktop runtime
lacks (`libdisplay-info`, SPIRV-Tools). Vulkan uses it, and Mesa's GL runs on it through Zink
(`MESA_LOADER_DRIVER_OVERRIDE=zink`). This is skipped for an app drawing into a desktop
composited by pixman, where Zink cannot present.
(`MESA_LOADER_DRIVER_OVERRIDE=zink`). This is skipped for an app drawing into a window on the
desktop, which KWin composites in software and where Zink cannot present.
- **Controllers.** The libraries in the rootfs's `/etc/ld.so.preload` (the session shim and the
fake evdev reader) go in through `LD_PRELOAD`, with the session's `dev` directory.
- **Browsers.** Firefox's child sandboxes are switched off (`MOZ_DISABLE_*_SANDBOX`), and
@@ -70,8 +70,8 @@ screen under gamescope. Under gamescope it passes `--nosocket=wayland --socket=x
opens behind gamescope. gamescope's own Wayland socket is no alternative: Chromium on Wayland
asks the render node it names for a DRM version, which KGSL cannot give, and aborts. The
launcher also starts a session bus when there is none. On the Linux desktop, the apps' exported
menu entries appear in the LXQt menu. While the desktop is composited by pixman, games are
wrapped through `droiddeck-gpu` like the rootfs's own.
menu entries appear in Plasma's launcher. Games are wrapped through `droiddeck-gpu` like the
rootfs's own, since the desktop composites in software.
## The store
+34 -2
View File
@@ -189,5 +189,37 @@ Store log lines (the engines' included) go through `StoresState.logLine`, which
(`StoreLogFiles`: one file a day, seven days kept, ~2 MB each before it rolls to `.1`). Nothing
shows them in the app; the session's Share logs zip carries them under `stores/`.
Credentials live in `filesDir/stores/<store>/credentials.json` only (`StoreAccounts`); store URLs
are logged through `StoreLog.redactUrl`, which drops the query string where the signed tokens live.
Store URLs are logged through `StoreLog.redactUrl`, which drops the query string where the signed
tokens live.
## Security
- **Sign-ins:** `filesDir/stores/<store>/credentials.json` only, read and written through
`StoreAccounts` alone (`GogAuth`, `EpicCredentialStore`, `AmazonCredentialStore`, cloud saves
all call it). The file is an envelope `{"v":1,"alg":"AES/GCM","iv":...,"ct":...}` (base64):
AES-256-GCM (`CredentialCipher`) under a key generated in the AndroidKeyStore (alias
`droiddeck-store-credentials`; encrypt/decrypt, GCM, no padding, not exportable, no user
authentication so background downloads and launch-time exchange codes work with the screen off;
StrongBox where present, else the TEE). Written through a temp file and a rename, mode 600.
- **Earlier plain files:** sealed at app start (`StoreAccounts.encryptAll`, and on any read),
verified by opening the result, the plain file replaced; the log says
`stores: credentials encrypted <store>`. A plain `.tmp` left by an older build is deleted.
- **No Keystore** (some ROMs): the file stays plain, the log says
`stores: keystore unavailable, credentials stay plain (<exception class>)` once, and the next
start tries again.
- **A file that can never open** - it does not authenticate (`AEADBadTagException`: tampered, or
another key after data was cleared or a backup restored on another device), the key is
permanently invalidated or gone from the Keystore, or it is not an envelope: deleted, and the
store reads as signed out, so its sign-in card shows.
- **A failure that may pass** (`KeyStoreException`, `ProviderException`, any other
`InvalidKeyException`, an I/O error, StrongBox busy): the file is kept, the store stays signed in
(no sign-in card) and is marked unavailable (`StoreAccounts.isUnavailable`), a store action shows
`<Store> sign-in could not be read: try again.`, the log says
`stores: credentials unreadable this start (<exception class>)` once, and the next access tries
again.
- **The Linux session:** the app's files directory is bound into every session, so the guest can
see `credentials.json` - as the envelope only; the key never leaves the Keystore. Nothing in the
guest reads the files: `droiddeck-store-launch` asks the app over `<session>/stores/req|resp`
for an Epic exchange code, which the app writes beside the game's launcher; the launcher reads
it into a variable and deletes it before the game starts (single use, expires in minutes).
Steam's own client files are outside this.
+74
View File
@@ -7,6 +7,80 @@ the timeline, then lessons and backlog. Companion to the README (what the app *d
---
## 2026-10-09 - `feat/store-credentials-keystore`: store sign-ins sealed with the Android Keystore
- **What:** `filesDir/stores/<store>/credentials.json` (GOG, Epic, Amazon: tokens, ids, names,
expiry) is now an AES-256-GCM envelope (`{"v":1,"alg":"AES/GCM","iv","ct"}`) under a
non-exportable AndroidKeyStore key (StrongBox if present, else TEE; no user authentication).
`StoreAccounts` is the one layer; `CredentialCipher` holds the envelope and the key.
- **Upgrade:** a plain file is sealed at the first start (verified, then replaced); users stay
signed in. Log: `stores: credentials encrypted <store>`.
- **Fallbacks:** no Keystore - stays plain, logged once, retried next start. A file that can never
open (bad tag, key invalidated or missing, not an envelope) - deleted, signed out (sign-in card).
Any other Keystore or I/O failure - file kept, store stays signed in but unavailable (actions show
`<Store> sign-in could not be read: try again.`), logged once, retried on the next access. Never
a crash.
- **Session:** the guest sees the envelope only; it never read the files (the Epic code comes over
the request channel, written beside the launcher and deleted by it).
- **Tests:** `StoreAccountsCipherTest` (round trip, sealed on disk, migration of all three stores,
tampered file, lost key, key missing, garbage, no-Keystore fallback then sealed next start,
transient Keystore / I/O failures keep the file and a later read succeeds, sign-out). Not yet
on a device.
## 2026-10-08 - `feat/private-logs`: every log in app-private storage, shared as one scrubbed zip
- **Where logs live:** `files/logs/` (`LinuxRuntime.logDir`), nothing under `Download/DroidDeck`
any more. Session folders (`<day>-NN-<what>/`), `tools/` (GuestCommand, Flatpak, Windows
component installers) and `stores/` (the stores' engine log, one file a day) all sit there. The
files directory is bound into every session at the same path, so the session script, gamescope
and the guest tools write there as before. Thirty sessions kept; the Logs switch off still means
a cache folder deleted at session end. Game save backups stay public in `Download/DroidDeck/Saves`.
- **Moving the old ones:** on the first start of this build, session folders, `tools/` and loose
`*.log` files move from `Download/DroidDeck/` into `files/logs/` (rename, else copy and delete;
an item that fails stays). A marker records the pass; `Saves/` and anything else there is never
touched, and the app does not read `Download/DroidDeck/` again.
- **Share logs:** one zip in `cache/share/`, made on demand: the newest session folder (or the one
the session screen shares), the last seven days of `stores/` and `tools/`. Every text file goes
through `LogRedactor.redactForShare` on the way in - the existing rules (Steam tokens, JWTs,
SteamIDs, account names, emails, own addresses, MACs, serials) plus URLs without query, fragment
or userinfo and with token-bearing path segments blanked (GOG secure links), `__token__`,
`f_token`, `hdnts`, OAuth `code=`, and Authorization / Cookie headers - so a file written before a
rule existed is clean in the zip. The zip is deleted at the next share or app start.
`SessionLogShareTest` covers it. Nothing was relaxed: the per-session scrub, `scrubOlder` and
every existing rule stay as they were.
- **File manager:** the Session logs shortcut opens `files/logs` (the app reads its own storage).
- **On main after Stores (#476) and the KDE Plasma desktop (#473):** the stores' log is already
`files/logs/stores/stores-<date>.log` and the zip carries its last seven days under `stores/`. One
set of rules scrubs both the stores' log and the zip (`SecretScrub`): `StoreLog.redactLine` keeps
URLs to their host and first plain segment, the zip pass keeps paths with token segments blanked,
both blank token values and Authorization / Cookie headers; the two test suites pass on it. The
Plasma desktop writes nothing outside the session folder (its output is the session's
`desktop.log`), so there was nothing new to move.
- **Privacy scan fixes:** the Steam login account (an email, 374 times) was still in older
folders' copied `steam/webhelper_js.txt` (`SteamUI: INFO: Login: OnLoginStateChange <account>`):
those folders carried a scrub marker from before the account rules, and the marker never
expired. The marker is now named after the redactor's rules version (`.scrubbed-r3`), so every
folder scrubbed under older rules goes through again at app start, steam/ and every subfolder
included; folders moved out of `Download/DroidDeck` lose every old marker
(`SessionArtifacts.unmarkMoved`), so the same pass takes them whatever those markers said. New rules: `OnLoginStateChange <anything>`, and
`AccountName` / `account_name` / `username` / `login` fields (`login` only as `login=`, a quoted
key or a VDF pair, so the "Login:" label stays). The `code=` rule no longer touches Proton's
exception codes (`code=c0000005`, `406d1388`, `80000003`): a bare `code=` is blanked only right
after `?`/`&` or on a line with OAuth keys (`client_id`, `redirect_uri`, `state`, tokens), and
never when it is 8 hex digits; exchange / authorization codes are always blanked. Tests:
`LogRedactorTest` (the login line with an email and with a plain name), `SecretScrubTest`,
`SessionLogShareZipTest` (older and moved folders scrubbed on disk).
- **Device check (31 migrated folders):** only 4 carried `.scrubbed-r3` a minute in. Nothing was
skipped - the pass was still running: one folder holds ~30 MB of Steam logs, ~30 s through the
redactor, one folder after another (about 15 minutes for 31). The start pass now scrubs a few
folders at a time (half the cores, at most 4, background priority), old markers go whether or
not a folder's pass succeeds, a folder the process does not finish is taken up at the next start,
and it logs one line: `logs: scrubbed N folders under r3`. Test: nine migrated folders carrying
`.scrubbed-2`, `.scrubbed-1` or a stale `.scrubbed-r3` all end up scrubbed under r3 after one
migration + start pass.
- **LAN addresses in the zip:** private IPv4 addresses (10/8, 172.16/12, 192.168/16, 169.254/16;
e.g. the router in `LinuxNetworkLink: resolver: ...`) become `<lan-address>` in the zip pass;
public server addresses and dotted version numbers stay (`LogRedactorTest`).
## 2026-10-08 - `feat/stores`: GOG, Epic Games and Amazon Games in the launcher (in progress)
A new **Stores** section - the three storefronts' libraries and public catalogs, one download
+3 -13
View File
@@ -39,9 +39,9 @@ for tool in curl tar zstd shasum unzip; do
exit 1
fi
done
if [[ -f "${repo_root}/tools/gamescope/release.env" || -f "${repo_root}/tools/wlroots/release.env" \
if [[ -f "${repo_root}/tools/gamescope/release.env" \
|| -f "${repo_root}/tools/droiddeck-esync/release.env" ]] && ! command -v gh >/dev/null 2>&1; then
echo "GitHub CLI is required to download the pinned Gamescope, wlroots and droiddeck-esync release assets." >&2
echo "GitHub CLI is required to download the pinned Gamescope and droiddeck-esync release assets." >&2
exit 1
fi
@@ -138,9 +138,7 @@ docker run --rm --platform linux/amd64 \
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop "$d/usr/local/bin/droiddeck-desktop"
install -Dm644 tools/linuxfs/desktop/droiddeck-gpu "$d/usr/local/bin/droiddeck-gpu"
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop-gpu "$d/usr/local/bin/droiddeck-desktop-gpu"
install -Dm644 tools/linuxfs/desktop/autostart "$d/etc/xdg/labwc/autostart"
install -Dm644 tools/linuxfs/desktop/rc.xml "$d/etc/xdg/labwc/rc.xml"
install -Dm644 tools/linuxfs/desktop/panel.conf "$d/etc/xdg/lxqt/panel.conf"
install -Dm644 tools/linuxfs/desktop/kwin_wayland_wrapper "$d/usr/local/bin/kwin_wayland_wrapper"
install -Dm644 tools/linuxfs/desktop/firefox-droiddeck.js \
"$d/usr/lib/firefox/defaults/pref/droiddeck.js"
@@ -225,14 +223,6 @@ if [[ -f "${repo_root}/tools/gamescope/release.env" ]]; then
test -f "${linuxfs_dir}/usr/local/bin/gamescope"
fi
if [[ -f "${repo_root}/tools/wlroots/release.env" ]]; then
. "${repo_root}/tools/wlroots/release.env"
wlroots_archive=$(cached "${WLROOTS_SHA256}" wlroots.tzst \
bash -c 'gh release download "$0" -R "$1" -p wlroots.tzst -O "$out"' "${WLROOTS_TAG}" "${github_repo}")
zstd -dc "${wlroots_archive}" | tar -xf - -C "${linuxfs_dir}"
test -f "${linuxfs_dir}/usr/local/lib/droiddeck-wlroots/libwlroots-0.20.so"
fi
. "${repo_root}/tools/linuxfs/uruntime.env"
uruntime_binary=$(cached "${URUNTIME_SHA256}" "${URUNTIME_ASSET}" \
bash -c 'curl -fsSL --retry 3 -o "$out" "$0"' "https://github.com/VHSgunzo/uruntime/releases/download/${URUNTIME_VERSION}/${URUNTIME_ASSET}")
+23
View File
@@ -0,0 +1,23 @@
# The desktop package (KDE Plasma)
The desktop the app installs into its Linux runtime the first time the desktop is opened: KDE Plasma
set up as SteamOS's desktop mode, with Valve's Vapor theme, the Steam Deck wallpaper and launcher
icon, Plasma's default bottom panel, and "Return to Gaming Mode" and Steam on the desktop.
- `seeds.txt`: the packages asked for. `build.sh` takes their closure over Arch Linux ARM's
repositories (`closure.py`) and drops what the runtime already has.
- `runtime-packages.txt`: the runtime's own packages, `name version` from its pacman database
(`ls /var/lib/pacman/local` in the rootfs). Refresh it when the runtime is rebuilt.
- `overlay/`: our files on top - system-wide KDE defaults in `/etc/xdg`, the Vapor theme and its
layout script, the menu entries Steam and Return to Gaming Mode use.
`.github/workflows/build-desktop-kde.yml` builds it and, run with a new tag, publishes it as a
release in Droid-Deck/DroidDeck-Components. `release.env` pins the tag, sha256 and size the apk
installs (`DesktopCatalog.desktopEntry`); a published tag is never replaced, so a changed package
is a new tag and a `release.env` update.
At run time the desktop is started by `tools/linuxfs/desktop/droiddeck-desktop` (the app stages it
at every session): Plasma's own `startplasma-wayland`, with KWin nested in the app's compositor
through `kwin_wayland_wrapper`. KWin composites in software (QPainter) - the Adreno node is not a
DRM device - so games and emulators from the menu go through `droiddeck-gpu`, and Steam goes back
to the app as a Steam session.
Binary file not shown.
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
# Builds the KDE Plasma desktop package for the Linux runtime: the closure of seeds.txt over Arch
# Linux ARM's aarch64 repositories, minus what the runtime image already carries, plus overlay/,
# as a zstd tarball that extracts over the rootfs (DesktopCatalog's "tar" kind).
#
# tools/desktop-kde/build.sh <out dir>
#
# The runtime's own packages (runtime-packages.txt, "name version" from its pacman db) are not
# shipped again, except where something in the closure asks for a version of one the runtime does
# not have (a versioned dependency on it, or on a library it provides): then the repository's
# build comes along and replaces it. Nothing is deleted on extraction, so a library whose soname
# moved keeps its old file for what the runtime linked against it.
#
# Every package is fetched over HTTPS and must carry a valid signature by the Arch Linux ARM Build
# System key (archlinuxarm-builder.gpg; primary fingerprint pinned below, as archlinuxarm.org
# publishes it and archlinuxarm-keyring trusts it) and match the sha256 the repository database
# gives for it; anything else stops the build. The repository databases themselves are not signed
# by Arch Linux ARM, so they decide only which signed packages are taken. desktop-kde.packages.txt
# lists every package taken, with its sha256: what a release was built from.
#
# Needs curl, gpgv, tar, xz, zstd, python3.
set -euo pipefail
out=${1:?out dir}
here=$(cd "$(dirname "$0")" && pwd)
mirror=${ALARM_MIRROR:-https://fl.us.mirror.archlinuxarm.org/aarch64}
case $mirror in https://*) ;; *) echo "ALARM_MIRROR must be https" >&2; exit 1 ;; esac
builder=68B3537F39A313B3E574D06777193F152BDBE6A6
fetch() { curl -fsSL --proto '=https' --proto-redir '=https' --retry 6 --retry-delay 5 --retry-all-errors -o "$1" "$2"; }
work=$(mktemp -d); mkdir -p "$out" "$work/db" "$work/root"
# PKG_CACHE keeps the downloaded packages between builds (a local rebuild after an overlay change).
pkgs=${PKG_CACHE:-$work/pkgs}; mkdir -p "$pkgs"
trap 'rm -rf "$work"' EXIT
for repo in core extra alarm; do
fetch "$work/db/$repo.db" "$mirror/$repo/$repo.db"
mkdir -p "$work/db/x_$repo" && tar -xzf "$work/db/$repo.db" -C "$work/db/x_$repo"
done
python3 "$here/closure.py" "$work/db" "$here/runtime-packages.txt" "$here/seeds.txt" > "$work/pkglist.txt"
echo "kde: $(wc -l < "$work/pkglist.txt") packages beyond the runtime's own"
while read -r entry sum; do
file=${entry#*/}
[ -s "$pkgs/$file" ] || fetch "$pkgs/$file" "$mirror/$entry"
fetch "$work/pkg.sig" "$mirror/$entry.sig"
if ! gpgv --status-fd 1 --keyring "$here/archlinuxarm-builder.gpg" "$work/pkg.sig" "$pkgs/$file" 2>/dev/null \
| grep -Eq "^\[GNUPG:\] VALIDSIG .* $builder\$"; then
echo "$file: no valid Arch Linux ARM Build System signature" >&2; rm -f "$pkgs/$file"; exit 1
fi
if [ "$(sha256sum "$pkgs/$file" | cut -d' ' -f1)" != "$sum" ]; then
echo "$file: sha256 differs from the repository database's" >&2; rm -f "$pkgs/$file"; exit 1
fi
tar -xf "$pkgs/$file" -C "$work/root" --no-same-owner --no-same-permissions \
--exclude=.PKGINFO --exclude=.MTREE --exclude=.INSTALL --exclude=.BUILDINFO --exclude=.CHANGELOG
done < "$work/pkglist.txt"
cp -a "$here/overlay/." "$work/root/"
# Weight that no desktop on a phone reads.
rm -rf "$work/root/usr/share/doc" "$work/root/usr/share/man" "$work/root/usr/share/info" \
"$work/root/usr/share/gtk-doc" "$work/root/usr/include" "$work/root/usr/lib/pkgconfig" \
"$work/root/usr/lib/cmake" "$work/root/usr/share/help"
# English only, on purpose: the desktop session runs in C.UTF-8 and nothing hands the app's language
# to KDE, so other translations would be weight no one sees. They come back with localizing the
# desktop itself (LANGUAGE from the app's language at session start).
find "$work/root/usr/share/locale" -mindepth 1 -maxdepth 1 -type d ! -name 'en*' -exec rm -rf {} + 2>/dev/null || true
find "$work/root/usr/lib" -name '*.a' -delete
chmod -R u+rwX "$work/root"
sed 's#^[a-z]*/##' "$work/pkglist.txt" > "$out/desktop-kde.packages.txt" # "file sha256", each verified above
tar -C "$work/root" --zstd -cf "$out/desktop-kde.tar.zst" .
sha256sum "$out/desktop-kde.tar.zst" | awk '{print $1}' > "$out/desktop-kde.sha256"
ls -l "$out/desktop-kde.tar.zst"
+153
View File
@@ -0,0 +1,153 @@
#!/usr/bin/env python3
"""The packages the KDE desktop package ships: the dependency closure of the seeds over Arch Linux
ARM's extracted repository databases, minus what the runtime already has at a version that serves.
closure.py <db dir with x_core, x_extra, x_alarm> <runtime-packages.txt> <seeds.txt>
Prints one "repo/filename sha256" per package to ship (the sha256 the repository database gives).
"""
import collections
import os
import re
import sys
REPOS = ("core", "extra", "alarm")
def vercmp_part(a, b):
# rpmvercmp, as pacman compares version strings.
if a == b:
return 0
sa = re.findall(r"\d+|[a-zA-Z]+", a)
sb = re.findall(r"\d+|[a-zA-Z]+", b)
for x, y in zip(sa, sb):
if x.isdigit() and y.isdigit():
x, y = int(x), int(y)
if x != y:
return 1 if x > y else -1
elif x.isdigit():
return 1
elif y.isdigit():
return -1
elif x != y:
return 1 if x > y else -1
if len(sa) == len(sb):
return 0
return 1 if len(sa) > len(sb) else -1
def vercmp(a, b):
def split(v):
epoch, _, rest = v.rpartition(":") if ":" in v else ("0", "", v)
ver, _, rel = rest.partition("-")
return int(epoch or 0), ver, rel
ea, va, ra = split(a)
eb, vb, rb = split(b)
if ea != eb:
return 1 if ea > eb else -1
c = vercmp_part(va, vb)
if c or not ra or not rb:
return c
return vercmp_part(ra, rb)
def parse_dep(d):
m = re.match(r"^([^<>=]+)(>=|<=|=|>|<)?(.*)$", d)
return m.group(1), m.group(2), m.group(3)
def satisfies(version, op, want):
if not op:
return True
c = vercmp(version, want)
return {"=": c == 0, ">=": c >= 0, "<=": c <= 0, ">": c > 0, "<": c < 0}[op]
def main():
dbdir, runtime_file, seeds_file = sys.argv[1:4]
runtime = {}
for line in open(runtime_file):
parts = line.split()
if len(parts) == 2:
runtime[parts[0]] = parts[1]
seeds = [l.strip() for l in open(seeds_file) if l.strip() and not l.lstrip().startswith("#")]
pkgs, providers = {}, collections.defaultdict(list)
for repo in REPOS:
root = os.path.join(dbdir, "x_" + repo)
for entry in sorted(os.listdir(root)):
fields, key = {}, None
for fname in ("desc", "depends"):
path = os.path.join(root, entry, fname)
if not os.path.exists(path):
continue
for line in open(path, encoding="utf-8", errors="replace"):
line = line.rstrip("\n")
if line.startswith("%") and line.endswith("%"):
key = line.strip("%")
fields[key] = []
elif line == "":
key = None
elif key:
fields[key].append(line)
name = fields.get("NAME", [None])[0]
if not name or name in pkgs:
continue
provides = [parse_dep(p) for p in fields.get("PROVIDES", [])]
pkgs[name] = {"repo": repo, "file": fields["FILENAME"][0], "version": fields["VERSION"][0],
"sha256": fields.get("SHA256SUM", [""])[0],
"depends": fields.get("DEPENDS", []), "provides": provides}
providers[name].append((name, pkgs[name]["version"]))
for pname, _, pver in provides:
providers[pname].append((name, pver or pkgs[name]["version"]))
def resolve(dep):
"""The package to take for a dependency string, and whether the runtime's copy serves."""
name, op, want = parse_dep(dep)
# A runtime package that is the dependency or provides it, at a version that serves.
if name in runtime and satisfies(runtime[name], op, want):
return name, True
candidates = providers.get(name, [])
for real, _ in candidates:
if real in runtime:
# A provided name (a soname, mostly): the runtime's build serves as long as it is
# the repository's own, or nothing asks for a particular version.
if not op or runtime[real] == pkgs[real]["version"]:
return real, True
if satisfies_provider(real, name, op, want):
return real, False
for real, pver in candidates:
if satisfies(pver, op, want):
return real, False
return None, False
def satisfies_provider(real, name, op, want):
if real == name:
return satisfies(pkgs[real]["version"], op, want)
return any(p == name and satisfies(v or pkgs[real]["version"], op, want) for p, _, v in pkgs[real]["provides"])
ship, seen, missing = [], set(), []
queue = list(seeds)
while queue:
dep = queue.pop()
real, served = resolve(dep)
if real is None:
missing.append(dep)
continue
if served or real in seen:
continue
seen.add(real)
ship.append(real)
queue.extend(pkgs[real]["depends"])
if missing:
sys.exit("unresolved: " + " ".join(sorted(set(missing))))
upgraded = sorted(n for n in ship if n in runtime)
if upgraded:
print("replacing runtime packages: " + " ".join(f"{n} {runtime[n]} -> {pkgs[n]['version']}" for n in upgraded),
file=sys.stderr)
for name in sorted(ship):
print(pkgs[name]["repo"] + "/" + pkgs[name]["file"], pkgs[name]["sha256"])
if __name__ == "__main__":
main()
@@ -0,0 +1,2 @@
[Basic Settings]
Indexing-Enabled=false
@@ -0,0 +1,5 @@
[Settings]
gtk-theme-name=Breeze-Dark
gtk-icon-theme-name=breeze-dark
gtk-font-name=Noto Sans 11
gtk-application-prefer-dark-theme=true
@@ -0,0 +1,5 @@
[Mouse]
cursorTheme=breeze_cursors
[Libinput][Defaults]
PointerAccelerationProfile=1
@@ -0,0 +1,24 @@
[KDE]
LookAndFeelPackage=com.valve.vapor.desktop
SingleClick=false
widgetStyle=Breeze
[General]
ColorScheme=Vapor
font=Noto Sans,11,-1,5,50,0,0,0,0,0
menuFont=Noto Sans,11,-1,5,50,0,0,0,0,0
smallestReadableFont=Noto Sans,9,-1,5,50,0,0,0,0,0
toolBarFont=Noto Sans,11,-1,5,50,0,0,0,0,0
fixed=Noto Sans Mono,11,-1,5,50,0,0,0,0,0
[Icons]
Theme=breeze-dark
[KDE Action Restrictions][$i]
action/switch_user=false
action/start_new_session=false
action/lock_screen=false
[KDE Control Module Restrictions][$i]
kcm_sddm.desktop=false
kcm_plymouth.desktop=false
@@ -0,0 +1,2 @@
[Desktop Entry]
DefaultProfile=Vapor.profile
@@ -0,0 +1,3 @@
[Daemon]
Autolock=false
LockOnResume=false
@@ -0,0 +1,2 @@
[General]
loginMode=emptySession
@@ -0,0 +1,3 @@
[KSplash]
Engine=none
Theme=None
@@ -0,0 +1,3 @@
[Wallet]
Enabled=false
First Use=false
+12
View File
@@ -0,0 +1,12 @@
[org.kde.kdecoration2]
library=org.kde.breeze
[WindowSwitcher]
LayoutName=org.kde.breeze.desktop
[DesktopSwitcher]
LayoutName=org.kde.breeze.desktop
[Plugins]
blurEnabled=false
contrastEnabled=false
@@ -0,0 +1,32 @@
[$Version]
update_info=kwinrules.upd:replace-placement-string-to-enum,kwinrules.upd:use-virtual-desktop-ids
[1]
Description=Window settings for Steam Keyboard
above=true
aboverule=2
skiptaskbar=true
skiptaskbarrule=2
title=Steam Keyboard
titlematch=2
type=16
typerule=2
wmclass=steam
wmclasscomplete=true
wmclassmatch=2
[9bd6e503-ac60-4e7b-9131-0b10c84b37eb]
Description=Window settings for Steam Keyboard
above=true
aboverule=2
title=Steam Keyboard
titlematch=2
type=16
typerule=2
wmclass=steam
wmclasscomplete=true
wmclassmatch=2
[General]
count=1
rules=1
@@ -0,0 +1,2 @@
[Theme]
name=Vapor
@@ -0,0 +1,2 @@
[General]
systemdBoot=false
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Return to Gaming Mode
Comment=Log out of the desktop and go back to Steam
Exec=dbus-send --session --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
Icon=steamdeck-gaming-return
Terminal=false
Type=Application
StartupNotify=false
NoDisplay=true
@@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=Steam Big Picture
Comment=The Steam client, full screen with a controller
Exec=/usr/local/bin/steamdeck-steam bigpicture
Icon=steam
Terminal=false
Categories=Game;
@@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=Steam
Comment=The Steam client, in a window
Exec=/usr/local/bin/steamdeck-steam desktop
Icon=steam
Terminal=false
Categories=Game;
@@ -0,0 +1,119 @@
[ColorEffects:Disabled]
Color=56,56,56
ColorAmount=0
ColorEffect=0
ContrastAmount=0.65
ContrastEffect=1
IntensityAmount=0.1
IntensityEffect=2
[ColorEffects:Inactive]
ChangeSelectionColor=true
Color=112,111,110
ColorAmount=0.025
ColorEffect=2
ContrastAmount=0.1
ContrastEffect=2
Enable=false
IntensityAmount=0
IntensityEffect=0
[Colors:Button]
BackgroundAlternate=77,77,77
BackgroundNormal=36,39,44
DecorationFocus=52,108,146
DecorationHover=85,161,205
ForegroundActive=61,174,233
ForegroundInactive=189,195,199
ForegroundLink=41,128,185
ForegroundNegative=218,68,83
ForegroundNeutral=199,130,61
ForegroundNormal=239,240,241
ForegroundPositive=126,166,75
ForegroundVisited=127,140,141
[Colors:Complementary]
BackgroundAlternate=59,64,69
BackgroundNormal=49,54,59
DecorationFocus=30,146,255
DecorationHover=61,174,230
ForegroundActive=246,116,0
ForegroundInactive=175,176,179
ForegroundLink=61,174,230
ForegroundNegative=237,21,21
ForegroundNeutral=201,206,59
ForegroundNormal=239,240,241
ForegroundPositive=17,209,22
ForegroundVisited=61,174,230
[Colors:Selection]
BackgroundAlternate=29,153,243
BackgroundNormal=86,159,204
DecorationFocus=52,108,146
DecorationHover=85,161,205
ForegroundActive=252,252,252
ForegroundInactive=239,240,241
ForegroundLink=253,188,75
ForegroundNegative=218,68,83
ForegroundNeutral=199,130,61
ForegroundNormal=31,31,38
ForegroundPositive=126,166,75
ForegroundVisited=189,195,199
[Colors:Tooltip]
BackgroundAlternate=77,77,77
BackgroundNormal=36,39,44
DecorationFocus=52,108,146
DecorationHover=85,161,205
ForegroundActive=61,174,233
ForegroundInactive=189,195,199
ForegroundLink=41,128,185
ForegroundNegative=218,68,83
ForegroundNeutral=199,130,61
ForegroundNormal=239,240,241
ForegroundPositive=126,166,75
ForegroundVisited=127,140,141
[Colors:View]
BackgroundAlternate=26,33,42
BackgroundNormal=21,28,35
DecorationFocus=52,108,146
DecorationHover=85,161,205
ForegroundActive=61,174,233
ForegroundInactive=189,195,199
ForegroundLink=41,128,185
ForegroundNegative=218,68,83
ForegroundNeutral=199,130,61
ForegroundNormal=239,240,241
ForegroundPositive=126,166,75
ForegroundVisited=127,140,141
[Colors:Window]
BackgroundAlternate=77,77,77
BackgroundNormal=36,39,44
DecorationFocus=52,108,146
DecorationHover=85,161,205
ForegroundActive=61,174,233
ForegroundInactive=189,195,199
ForegroundLink=41,128,185
ForegroundNegative=218,68,83
ForegroundNeutral=199,130,61
ForegroundNormal=241,241,242
ForegroundPositive=126,166,75
ForegroundVisited=127,140,141
[General]
ColorScheme=Breeze Dark
Name=Vapor
shadeSortColumn=true
[KDE]
contrast=4
[WM]
activeBackground=36,39,47
activeBlend=255,255,255
activeForeground=239,240,241
inactiveBackground=36,39,44
inactiveBlend=74,83,101
inactiveForeground=127,140,141
@@ -0,0 +1,7 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg id="svg2" height="64" style="" viewBox="0 0 64 64" width="64" xmlns="http://www.w3.org/2000/svg" sodipodi:docname="deck_icon.svg" inkscape:version="1.2-dev (d2dd25d878, 2022-02-01, custom)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
<path id="path42220" d="m 32 4 v 10 a 18 18 0 0 1 18 18 a 18 18 0 0 1 -18 18 v 10 a 28 28 0 0 0 28 -28 a 28 28 0 0 0 -28 -28 z" style="fill:#fff;fill-rule:evenodd"/>
<circle id="path43518" cx="32" cy="32" r="14" style="fill:#1a9fff;fill-rule:evenodd"/>
<path id="path52048" d="m 32 22 a 2 2 0 0 0 -1.4140625 .5859375 l -8 8 a 2.0002 2.0002 0 0 0 0 2.828125 l 8 8 a 2 2 0 0 0 2.828125 0 a 2 2 0 0 0 0 -2.828125 l -4.5859375 -4.5859375 h 11.171875 a 2 2 0 0 0 2 -2 a 2 2 0 0 0 -2 -2 h -11.171875 l 4.5859375 -4.5859375 a 2 2 0 0 0 0 -2.828125 a 2 2 0 0 0 -1.4140625 -.5859375 z" style="fill:#fff;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0"/>
<g id="path89696" style=""/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" version="1.1">
<circle style="opacity:0.2" cx="32" cy="33" r="28"/>
<path style="fill:#1955aa" d="M 60,32 C 60,47.463973 47.463973,60 32,60 18.913155,60 7.9232734,51.021833 4.853777,38.888922 4.2962258,36.685069 6.0625889,38.217811 6.0625889,35.840683 6.0625889,35.576732 4.0036523,31.472952 4.010909,31.210755 4.4288017,16.111731 16.799978,4 32,4 47.463973,4 60,16.536027 60,32 Z"/>
<path style="opacity:0.2" d="M 40,16 A 11,11 0 0 0 29,27 11,11 0 0 0 29.011719,27.246094 L 23.753906,36.009766 A 8.5,8.5 0 0 0 23.5,36 8.5,8.5 0 0 0 17.837891,38.171875 L 4.046875,32.078125 A 28,28 0 0 0 4,33 28,28 0 0 0 4.9375,40.123047 L 15.003906,44.572266 A 8.5,8.5 0 0 0 23.5,53 8.5,8.5 0 0 0 32,44.5 8.5,8.5 0 0 0 31.966797,43.849609 L 41.373047,37.904297 A 11,11 0 0 0 51,27 11,11 0 0 0 40,16 Z M 40,20 A 7,7 0 0 1 47,27 7,7 0 0 1 40,34 7,7 0 0 1 33,27 7,7 0 0 1 40,20 Z M 40,22 A 5,5 0 0 0 35,27 5,5 0 0 0 40,32 5,5 0 0 0 45,27 5,5 0 0 0 40,22 Z M 23.5,39 A 5.5,5.5 0 0 1 29,44.5 5.5,5.5 0 0 1 23.5,50 5.5,5.5 0 0 1 18.207031,45.986328 L 22.085938,47.701172 A 3.50035,3.50035 0 1 0 24.914062,41.298828 L 21.035156,39.583984 A 5.5,5.5 0 0 1 23.5,39 Z"/>
<path style="fill:#ffffff" d="M 30.6,23.6 34.8,33.4 44.7,34.8 29.2,44.6 V 37.6 H 22.2 Z"/>
<path style="fill:#ffffff" d="M 40 15 A 11 11 0 0 0 29 26 A 11 11 0 0 0 40 37 A 11 11 0 0 0 51 26 A 11 11 0 0 0 40 15 z M 40 19 A 7 7 0 0 1 47 26 A 7 7 0 0 1 40 33 A 7 7 0 0 1 33 26 A 7 7 0 0 1 40 19 z"/>
<path style="fill:#ffffff" d="M 23.5 35 A 8.5 8.5 0 0 0 15 43.5 A 8.5 8.5 0 0 0 23.5 52 A 8.5 8.5 0 0 0 32 43.5 A 8.5 8.5 0 0 0 23.5 35 z M 23.5 38 A 5.5 5.5 0 0 1 29 43.5 A 5.5 5.5 0 0 1 23.5 49 A 5.5 5.5 0 0 1 18 43.5 A 5.5 5.5 0 0 1 23.5 38 z"/>
<circle style="fill:#ffffff" cx="40" cy="26" r="5"/>
<path style="fill:#ffffff" d="M 4.046875 31.078125 A 28 28 0 0 0 4 32 A 28 28 0 0 0 4.9375 39.123047 L 22.085938 46.701172 A 3.50035 3.50035 0 1 0 24.914062 40.298828 L 4.046875 31.078125 z"/>
<path style="opacity:0.1;fill:#ffffff" d="M 32,4 C 17.100366,4 4.9180811,15.636956 4.0488281,30.318359 4.0459379,30.367175 4.08106,30.473412 4.1113281,30.572266 5.3425337,16.245714 17.354447,5 32,5 47.296335,5 59.718596,17.267575 59.986328,32.5 59.989262,32.333062 60,32.167638 60,32 60,16.536027 47.463973,4 32,4 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -0,0 +1,13 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg id="svg2" height="64" style="" viewBox="0 0 64 64" width="64" xmlns="http://www.w3.org/2000/svg" sodipodi:docname="start.svg" inkscape:version="1.2-dev (d2dd25d878, 2022-02-01, custom)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#ffffff;
}
</style>
<g id="start-here-kde">
<rect style="fill:#808080;fill-rule:evenodd;opacity:0.000001" id="rect1101" width="64" height="64" x="0" y="0" />
<path id="path42220" d="m 32 4 v 10 a 18 18 0 0 1 18 18 a 18 18 0 0 1 -18 18 v 10 a 28 28 0 0 0 28 -28 a 28 28 0 0 0 -28 -28 z" style="fill:currentColor;fill-rule:evenodd" class="ColorScheme-Text" />
<circle id="path43518" cx="32" cy="32" r="14" style="fill:#1a9fff;fill-rule:evenodd" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1020 B

Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff. Show more