Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / games / voxels / src / main / res / xml / data_extraction_rules.xml

data_extraction_rules.xml62 lines · 3.2 KiBRaw
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 Voxels. Audited state:
4 * "voxels_prefs" SharedPreferences (AppBackupAgent.prefNames) - settings.
5 * filesDir/datastore_default.preferences_pb (AppBackupAgent.datastoreNames) -
6 the shared DataStoreUtils file, holding AchievementsManager unlocks and
7 VoxelsSync state.
8 * filesDir/worlds/<world-id>/ - one directory per world, containing
9 world.json (name, seed, timestamps), player.json (position/inventory) and
10 regions/c_<x>_<z>.dat, the saved chunks written by the Rust save layer
11 (src/main/rust/src/world/save.rs).
12 * cacheDir/*.wav — SoundFx generates its sound effects at runtime. The
13 platform already excludes cacheDir from every backup, so no rule needed.
14
15 Why regions/ is a problem for cloud backup: each chunk file is up to
16 SECTIONS_PER_CHUNK * ~12 KB, and chunk_map.rs keeps a render distance of 12,
17 so an explored world is easily hundreds of megabytes. Android Auto Backup has
18 a ~25 MB per-app quota, and blowing it doesn't just drop the big files — it
19 fails the backup for the entire app, silently taking voxels_prefs down with
20 it.
21
22 The rules format has no wildcards, so there is no way to keep
23 worlds/<id>/world.json while dropping worlds/<id>/regions. Excluding the whole
24 worlds tree from cloud-backup is the deliberate choice: a truncated world is
25 actively worse than no world, because decode_chunk() treats an unreadable
26 chunk as ungenerated and regenerates it from the seed, silently erasing
27 whatever the player built there.
28
29 Device transfer has no quota and runs over a direct local link, so worlds go
30 across intact — that is the path that actually preserves builds.
31
32 SCOPE: voxels declares android:backupAgent=".platform.AppBackupAgent" and does
33 NOT set android:fullBackupOnly, so Android uses key/value backup here and the
34 <cloud-backup> section below is NOT consulted today. In practice the outcome
35 matches the intent anyway: AppBackupAgent lists prefNames = ["voxels_prefs"]
36 and datastoreNames = ["datastore_default"], so settings and achievements reach
37 the cloud and saved worlds do not. The exclusion below is kept so that stays
38 true if the backupAgent is ever removed and Auto Backup takes over.
39 <device-transfer> IS governed by this file.
40-->
41<data-extraction-rules>
42 <!-- Not consulted while android:backupAgent is declared; see SCOPE above. -->
43 <cloud-backup>
44 <include domain="root" path="." />
45 <include domain="file" path="." />
46 <!-- Saved worlds: far over the 25 MB cloud quota, and a partial restore
47 regenerates terrain from the seed and destroys player builds. -->
48 <exclude domain="file" path="worlds" />
49 <include domain="database" path="." />
50 <include domain="sharedpref" path="." />
51 <include domain="external" path="." />
52 </cloud-backup>
53 <device-transfer>
54 <include domain="root" path="." />
55 <!-- Worlds included: no quota on D2D, and this is the only path that
56 migrates a player's builds. -->
57 <include domain="file" path="." />
58 <include domain="database" path="." />
59 <include domain="sharedpref" path="." />
60 <include domain="external" path="." />
61 </device-transfer>
62</data-extraction-rules>