m7c: brand splash instead of the white startup screen

- LaunchTheme/NormalTheme on #05070A (was the stock light theme + white
  windowBackground) and the Android 12 splash API in values-v31
- splash icon is a padded 512x512 canvas: Android masks everything outside the
  inner 192dp of the 288dp icon area, which clipped the wordmark at the top;
  the icon plate is set to the icon navy
- Flutter splash (lib/src/ui/splash_screen.dart): logo pulses (scale 0.96-1.04,
  opacity 0.72-1.0, 1100 ms) plus a thin progress line, min 700 ms measured
  from the first Flutter frame
- boot work (session, FFI library, ad SDK) now runs after the first frame and
  the game fades in over the splash: no blocking work before the first frame
- numbers (Redmi Note 10, API 31): debug 3053 ms, profile/AOT 2040 ms on the
  first start, 850-960 ms on later cold starts, ready log ~1030 ms
- fixed: top-level Stopwatch only started on first access (Dart lazily
  initialises top-level finals), so the boot log always showed 0 ms
- tools/device/startup.sh measures cold start + boot log; testing.md documents
  the splash chain and the MIUI release-install trap
This commit is contained in:
2026-10-25 02:34:09 +02:00
parent 94c3ef0f63
commit 92b5ef16cb
17 changed files with 362 additions and 89 deletions
+5
View File
@@ -14,11 +14,16 @@ Alle nennenswerten Änderungen an diesem Projekt. Format nach
### Fixed
- (app) HUD blieb auf dem Initialwert (100 HP), weil `onLoad` waehrend des ersten Builds publizierte
- (app) Top-Level-`Stopwatch` startete erst beim ersten Zugriff (Dart initialisiert Top-Level-Finals lazy) - das Bootlog zeigte 0 ms
### Changed
- (build) Version 0.7.0 (7); signiertes App Bundle mit Upload-Keystore
### Added
- (app) Splash-Kette ohne weissen Bildschirm: Markenfarbe `#05070A` als Launch- und Normal-Theme,
Android-12-Splash-API (`values-v31`), pulsierendes Logo inkl. Fortschrittslinie bis die native
Bibliothek, die Session und das Ad-SDK bereit sind, danach Fade in die Partie
- (app) Startlog `iron_arc: ready after N ms` (Debug + Release), nutzbar als Regressionswaechter
- (legal) Datenschutzerklaerung DE/EN als Markdown und als hostbare HTML-Seite
- (app) Geraete-ID im Einstellungen-Sheet sichtbar und kopierbar (fuer Loeschantraege)
- (ads) UMP-Consent-Flow vor SDK-Init, Fail-Safe ohne Zustimmung, Einstellungen-Sheet mit „Datenschutz-Optionen“
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<!-- v21 variant of the launch screen (identical content, kept in sync). -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<item android:drawable="@color/launch_bg" />
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
android:src="@drawable/launch_logo" />
</item>
</layer-list>
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<!-- Launch screen shown from process start until Flutter draws its first frame.
Brand background + the same logo the in-app splash pulses, so the handover
from native window to Flutter is invisible. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<item android:drawable="@color/launch_bg" />
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
android:src="@drawable/launch_logo" />
</item>
</layer-list>
@@ -2,9 +2,9 @@
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:statusBarColor">@color/launch_bg</item>
<item name="android:navigationBarColor">@color/launch_bg</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
@@ -13,6 +13,8 @@
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<item name="android:windowBackground">@color/launch_bg</item>
<item name="android:statusBarColor">@color/launch_bg</item>
<item name="android:navigationBarColor">@color/launch_bg</item>
</style>
</resources>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Android 12+ draws its own splash screen; configure it to look like ours
instead of the default (which would flash the launcher icon on white). -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowSplashScreenBackground">@color/launch_bg</item>
<!-- Padded 512x512 canvas: Android masks everything outside the inner
192dp of the 288dp icon area, so the mark must sit inside it. -->
<item name="android:windowSplashScreenAnimatedIcon">@drawable/launch_logo_splash</item>
<item name="android:windowSplashScreenIconBackgroundColor">@color/launch_plate</item>
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:statusBarColor">@color/launch_bg</item>
<item name="android:navigationBarColor">@color/launch_bg</item>
</style>
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@color/launch_bg</item>
<item name="android:statusBarColor">@color/launch_bg</item>
<item name="android:navigationBarColor">@color/launch_bg</item>
</style>
</resources>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Same near-black the game canvas uses, so launch -> splash -> game never flashes. -->
<color name="launch_bg">#FF05070A</color>
<!-- Plate behind the Android 12+ splash icon: the icon navy, so the mark
reads as a deliberate tile instead of a floating sticker. -->
<color name="launch_plate">#FF0B1220</color>
</resources>
+10 -6
View File
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<!-- Theme applied to the Android Window while the process is starting.
Dark parent + dark background: the white flash of the stock template is gone.
The Flutter splash takes over with the same logo and the same colour. -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:statusBarColor">@color/launch_bg</item>
<item name="android:navigationBarColor">@color/launch_bg</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
@@ -12,7 +14,9 @@
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@color/launch_bg</item>
<item name="android:statusBarColor">@color/launch_bg</item>
<item name="android:navigationBarColor">@color/launch_bg</item>
</style>
</resources>
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+80 -13
View File
@@ -10,9 +10,18 @@ import 'src/native/native_match.dart';
import 'src/net/api_client.dart';
import 'src/net/match_session.dart';
import 'src/net/offline_queue.dart';
import 'src/ui/splash_screen.dart';
import 'src/ui/widgets.dart';
void main() => runApp(const IronArcApp());
/// Started in `main()`, so the boot log line covers the whole cold start
/// (engine, Dart isolate and native match load). Must be initialised eagerly -
/// a top-level `final` would only start on first access.
final Stopwatch _bootWatch = Stopwatch();
void main() {
_bootWatch.start();
runApp(const IronArcApp());
}
class IronArcApp extends StatelessWidget {
const IronArcApp({super.key});
@@ -39,18 +48,52 @@ class MatchScreen extends StatefulWidget {
class _MatchScreenState extends State<MatchScreen> {
static const _baseUrl = 'http://127.0.0.1:8080';
/// Minimum time the splash stays up, so even a warm start shows the brand
/// instead of a single-frame flicker.
static const _minSplash = Duration(milliseconds: 700);
int _seed = 42;
late final ApiClient _api = ApiClient(baseUrl: _baseUrl);
late final OfflineQueue _queue = OfflineQueue();
late final AdsService _ads = AdsService();
late final MatchSession _session =
MatchSession(client: _api, queue: _queue, deviceId: 'pending');
late IronArcGame _game = _buildGame();
/// Null while booting. Constructing a game loads the native match library,
/// which must not block the first frame - that used to be the white screen.
IronArcGame? _game;
bool _splashGone = false;
@override
void initState() {
super.initState();
_initSession();
// Boot after the first frame so the splash is painted before any blocking
// work (FFI library load, shared preferences, ad SDK).
WidgetsBinding.instance.addPostFrameCallback((_) => _bootstrap());
}
/// Session, native match and ad SDK - all while the splash is on screen.
Future<void> _bootstrap() async {
// Measured from the first Flutter frame, so the pulse is always visible
// even when the engine took seconds to start (debug builds, cold JIT).
final splashStart = Stopwatch()..start();
await _initSession();
final game = _buildGame();
if (!mounted) return;
// Keep the brand moment on screen even when everything loads instantly.
final left = _minSplash - splashStart.elapsed;
if (left > Duration.zero) await Future<void>.delayed(left);
if (!mounted) return;
setState(() => _game = game);
// Fade out over the already-built match, then drop the splash from the tree.
await Future<void>.delayed(const Duration(milliseconds: 320));
if (!mounted) return;
setState(() => _splashGone = true);
debugPrint('iron_arc: ready after ${_bootWatch.elapsedMilliseconds} ms');
_ads.initialize();
}
@@ -109,7 +152,9 @@ class _MatchScreenState extends State<MatchScreen> {
}
void _playReplay() {
final json = _game.replayJson();
final game = _game;
if (game == null) return;
final json = game.replayJson();
debugPrint('iron_arc: replay tapped, ${json.length} bytes');
if (json.isEmpty) {
_toast('Kein Replay vorhanden');
@@ -208,9 +253,31 @@ class _MatchScreenState extends State<MatchScreen> {
@override
Widget build(BuildContext context) {
final game = _game;
return Scaffold(
backgroundColor: const Color(0xFF05070A),
body: SafeArea(
backgroundColor: SplashScreen.background,
body: Stack(
children: [
// The match only exists once the native library and session are up;
// until then the pulsing splash covers the whole window.
if (game != null) _buildMatch(game),
if (!_splashGone)
Positioned.fill(
child: AnimatedOpacity(
opacity: game == null ? 1 : 0,
duration: const Duration(milliseconds: 280),
curve: Curves.easeOut,
child: const SplashScreen(),
),
),
],
),
);
}
/// HUD, canvas and controls of a running match.
Widget _buildMatch(IronArcGame game) {
return SafeArea(
child: Column(
children: [
Padding(
@@ -218,7 +285,7 @@ class _MatchScreenState extends State<MatchScreen> {
child: Column(
children: [
ValueListenableBuilder<HudState>(
valueListenable: _game.hud,
valueListenable: game.hud,
builder: (context, hud, _) => Hud(hud: hud),
),
const SizedBox(height: 6),
@@ -234,13 +301,14 @@ class _MatchScreenState extends State<MatchScreen> {
Expanded(
child: Stack(
children: [
Positioned.fill(child: GameWidget(key: ValueKey(_game), game: _game)),
Positioned.fill(
child: GameWidget(key: ValueKey(game), game: game)),
Positioned.fill(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onPanStart: (d) => _game.beginAim(d.localPosition),
onPanUpdate: (d) => _game.updateAim(d.localPosition),
onPanEnd: (_) => _game.releaseAim(),
onPanStart: (d) => game.beginAim(d.localPosition),
onPanUpdate: (d) => game.updateAim(d.localPosition),
onPanEnd: (_) => game.releaseAim(),
),
),
Positioned(
@@ -248,7 +316,7 @@ class _MatchScreenState extends State<MatchScreen> {
right: 16,
bottom: 8,
child: ValueListenableBuilder<HudState>(
valueListenable: _game.hud,
valueListenable: game.hud,
builder: (context, hud, _) => hud.isFinished
? GameOver(hud: hud, onRestart: _restart)
: HintBubble(hud: hud),
@@ -272,7 +340,6 @@ class _MatchScreenState extends State<MatchScreen> {
),
],
),
),
);
}
}
+75
View File
@@ -0,0 +1,75 @@
import 'package:flutter/material.dart';
/// Brand splash shown while the native match library, the session and the
/// ad SDK boot. The logo pulses so a cold start reads as "loading" instead of
/// a frozen screen - the native launch theme uses the same colour and image,
/// so the handover from the Android window to Flutter is invisible.
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
/// Canvas colour of the game; the Android launch theme uses the same value.
static const background = Color(0xFF05070A);
static const accent = Color(0xFFFF8A3D);
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen>
with SingleTickerProviderStateMixin {
late final AnimationController _pulse = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 1100),
)..repeat(reverse: true);
late final Animation<double> _scale = Tween<double>(begin: 0.96, end: 1.04)
.animate(CurvedAnimation(parent: _pulse, curve: Curves.easeInOut));
late final Animation<double> _opacity = Tween<double>(begin: 0.72, end: 1.0)
.animate(CurvedAnimation(parent: _pulse, curve: Curves.easeInOut));
@override
void dispose() {
_pulse.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return ColoredBox(
color: SplashScreen.background,
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FadeTransition(
opacity: _opacity,
child: ScaleTransition(
scale: _scale,
child: Image.asset(
'assets/logo_mark.png',
width: 220,
filterQuality: FilterQuality.medium,
semanticLabel: 'Iron Arc',
),
),
),
const SizedBox(height: 28),
// Thin indeterminate bar: tells the player the app is working,
// not hung. Kept subtle so the logo stays the focus.
SizedBox(
width: 140,
child: ClipRRect(
borderRadius: BorderRadius.circular(2),
child: LinearProgressIndicator(
minHeight: 2,
color: SplashScreen.accent,
backgroundColor: const Color(0xFF16202E),
),
),
),
],
),
),
);
}
}
+4 -4
View File
@@ -62,10 +62,10 @@ flutter:
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# Brand mark used by the in-app splash (the Android launch theme ships the
# same image as res/drawable-xxxhdpi/launch_logo.png).
assets:
- assets/logo_mark.png
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
+28
View File
@@ -138,6 +138,34 @@ Startspieler hatte Spieler 0 einen 59/40-Vorteil.
| Reihenfolge | `consent=ConsentStatus.obtained` **vor** `SDK initialised` → keine Ad-Anfrage ohne Einwilligung |
| Einstiegspunkt | Zahnrad → Datenschutz-Optionen öffnet das Formular erneut |
## M7c — Startzeit & Splash (erledigt 2026-10-25)
**Problem:** 5 s weisser Bildschirm vor dem ersten Frame (Stock-`launch_background` mit
`@android:color/white`, dazu die gesamte Bootarbeit vor dem ersten Frame).
| Massnahme | Datei |
|---|---|
| Launch- und Normal-Theme dunkel (`#05070A`), Status-/Nav-Bar gleich | `res/values/styles.xml`, `values-night`, `values/colors.xml` |
| Androids Splash-API ab 31: Markenfarbe, beschnitt-sicheres Icon, Icon-Platte in Icon-Navy | `res/values-v31/styles.xml`, `res/drawable-xxxhdpi/launch_logo{,_splash}.png` |
| Pulsierendes Logo + Fortschrittslinie waehrend der Bootarbeit | `lib/src/ui/splash_screen.dart` |
| Boot (Session, native Lib, Ad-SDK) erst **nach** dem ersten Frame, Splash mit Mindeststandzeit | `lib/main.dart` (`_bootstrap`) |
| Logo-Mark aus dem Store-Icon freigestellt (Alpha-Ramp + Un-Premultiply, kein Navy-Saum) | `store/assets/logo_mark.png` → `app/assets/logo_mark.png` |
**Messung** (Redmi Note 10, API 31, Consent erteilt): Debug 3053 ms, Profile/AOT **2040 ms**,
`iron_arc: ready after` 1740 / **1037 ms**. Neues Skript `tools/device/startup.sh`.
**Erkenntnisse**
- Android 12 maskiert beim Splash-Icon alles ausserhalb der inneren 192 dp eines 288-dp-Bereichs →
ein breites Wortmarken-Logo wird oben/unten abgeschnitten; Loesung ist eine 512×512-Vorlage mit
Motiv auf 59 % Breite.
- Die Icon-Platte ist ueber `windowSplashScreenIconBackgroundColor` steuerbar (mit Testfarbe Rot
verifiziert), Groesse ~153 dp.
- `am start -W` zaehlt den UMP-Dialog mit (7863 ms statt 3076 ms) → nur nach erteiltem Consent messen.
- Dart initialisiert Top-Level-`final`s **lazy**: `final Stopwatch _bootWatch = Stopwatch()..start();`
startete erst beim ersten Zugriff (Bootlog 0 ms). Jetzt Start in `main()`.
- MIUI verweigert `adb install` von release-signierten APKs (`INSTALL_FAILED_USER_RESTRICTED`) →
fuer Messungen `--profile` (AOT, debug-signiert).
## Nächste Schritte (aktualisiert)
1. `bundletool build-apks --connected-device` aus `~/exports/iron-arc-0.7.0.aab` → Install → Smoke.
+36
View File
@@ -73,11 +73,47 @@ flutter test --update-goldens # nur nach bewusster UI-Änderung, im PR begr
| `install.sh` | Deinstallieren, installieren, starten, PID prüfen |
| `smoke.sh` | Start → Menü → Match → 3 Schüsse → Ergebnis; 20 Screenshots nach `/tmp/shots` |
| `perf.sh` | **SurfaceFlinger-Frame-Timestamps** (Flutter rendert nicht über HWUI, `gfxinfo` liefert 0 Frames): p50/p90/p99 + Jank gegen 1,2 × Vsync |
| `startup.sh` | Kaltstart: `am start -W` (`TotalTime`) plus `iron_arc: ready after N ms` aus dem Log – läuft nur sinnvoll, **nachdem** der Consent einmal erteilt wurde (sonst zählt der UMP-Dialog mit) |
| `logs.sh` | Filter: Rust-Panic, `wgpu`/`Vulkan`, JNI, Billing, Consent |
**Wichtig:** Screenshots werden als PNG abgelegt und im Review **angesehen**; `perf.sh`-Report
landet in `docs/perf/<datum>-<gerät>.md` und ist Release-Voraussetzung.
### Startzeit & Splash-Kette
Gemessen auf dem Redmi Note 10 (Android 12, API 31), Consent bereits erteilt:
| Build | `TotalTime` (erster Frame) | `iron_arc: ready after` |
|---|---|---|
| Debug (JIT) | 3053 ms | ~1740 ms |
| Profile/AOT, erster Start nach Installation | 2040 ms | ~1040 ms |
| Profile/AOT, weitere Kaltstarts (Caches warm) | **850–960 ms** | ~1030 ms |
`TotalTime` ist der Zeitpunkt, ab dem der Splash steht – die Partie erscheint gut 1 s später
(700 ms Mindeststandzeit + 280 ms Fade).
Die Startstrecke ist bewusst dreiteilig, damit zu keinem Zeitpunkt ein weißer Screen zu sehen ist:
1. **Nativer Splash** (ab Prozessstart): `LaunchTheme` mit `windowBackground` = `@color/launch_bg`
(`#05070A`), darunter zentriert das Logo. Ab API 31 übernimmt die System-Splash-API
(`values-v31`): Markenfarbe + `launch_logo_splash` auf einer Icon-Platte in Icon-Navy.
Die 512×512-Vorlage hat das Motiv nur auf 59 % Breite, weil Android alles außerhalb der
inneren 192 dp des 288-dp-Icon-Bereichs **wegmaskiert** (sonst wird „IRON“ abgeschnitten).
2. **Flutter-Splash** (`lib/src/ui/splash_screen.dart`): pulsierendes Logo (Scale 0,96→1,04,
Deckkraft 0,72→1,0, 1100 ms) plus dünne Fortschrittslinie. Mindeststandzeit 700 ms,
gemessen ab dem ersten Flutter-Frame – nicht ab Prozessstart, sonst überspringt ein langsamer
Enginestart die Animation komplett.
3. **Fade** (280 ms) über die bereits gebaute Partie, danach wird der Splash aus dem Baum entfernt.
Erst danach startet das Ad-SDK (`_ads.initialize()`), damit UMP-Dialog und SDK-Init niemals
vor dem ersten Frame liegen. Video-Nachweis: 6-fps-Aufnahme des Kaltstarts, Frames bei
0,4 s (nativer Splash), 1,5–1,8 s (pulsierendes Logo), ab 2,1 s Partie.
**MIUI-Falle:** `adb install` eines **release**-signierten APKs scheitert mit
`INSTALL_FAILED_USER_RESTRICTED`. Für Messungen auf dem Gerät daher `flutter build apk --profile`
(AOT wie Release, aber debug-signiert); die echte Release-Prüfung läuft über die Split-APKs aus
dem AAB.
## 6. CI-Gates (Definition of Done für jeden PR)
1. `cargo fmt --check`
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Cold-start measurement: time to first frame plus the in-app boot log.
#
# `am start -W` measures until the activity is idle. That number is polluted by
# the Google UMP consent form (a second window), so run this only *after*
# consent has been given once - otherwise TotalTime includes the dialog.
#
# Usage: tools/device/startup.sh [runs] (default 3)
set -euo pipefail
ADB=${ADB:-adb}
PKG=${PKG:-de.softwareapp_hb.ironarc}
ACT=${ACT:-.MainActivity}
RUNS=${1:-3}
echo "## Kaltstart ($RUNS Laeufe, $PKG)"
for i in $(seq 1 "$RUNS"); do
$ADB shell am force-stop "$PKG"
sleep 2
$ADB logcat -c
total=$($ADB shell am start -W -n "$PKG/$ACT" 2>/dev/null \
| tr -d '\r' | awk '/TotalTime/ {print $2}')
sleep 2
ready=$($ADB logcat -d 2>/dev/null | tr -d '\r' \
| grep -oE 'iron_arc: ready after [0-9]+ ms' | tail -1)
echo " Lauf $i: TotalTime ${total:-?} ms | ${ready:-kein Bootlog (Release ohne Log?)}"
done
echo
echo "Richtwerte (Redmi Note 10, Android 12): Debug ~3050 ms, Profile/AOT ~2040 ms."
echo "Splash-Kette: nativer Splash -> Flutter-Splash (Puls, min. 700 ms) -> Fade in die Partie."