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

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

data_extraction_rules.xml71 lines · 3.8 KiBRaw
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 Games Hub. Audited state:
4 * databases/games-hub-db — Room DB (GamesHubDatabase) with achievement
5 definitions/progress, XP/level stats, play sessions, daily streaks,
6 player profile, Yuu avatars and a cross-app activity feed.
7 * secure_prefs.xml — the SQLCipher passphrase for that DB, wrapped by a
8 non-exportable AndroidKeyStore key.
9 * filesDir/datastore_default.preferences_pb — shared DataStoreUtils file.
10 * filesDir/datastore/hub_controller.preferences_pb — Play-on-TV pairing
11 keys; device-bound, never backed up or transferred.
12
13 games-hub-db is excluded from BOTH sections below, for a correctness reason
14 before a privacy one. It is SQLCipher-encrypted with a random passphrase
15 that DatabaseHelper wraps using an AndroidKeystore key (alias
16 db_no_auth_key). Keystore keys are hardware-bound and are never backed up
17 or transferred. On a restored device the alias is gone, so a raw copy of
18 the file would be opened with a fresh passphrase and Room would throw
19 SQLiteNotADatabaseException. Shipping the raw file doesn't restore the
20 user's data, it bricks first launch.
21
22 Achievements and level stats survive a platform restore through the app's
23 own key/value BackupAgent instead (platform/AppBackupAgent, declared in
24 the manifest): SqlCipherDbCodec sqlcipher_export()s the DB to plaintext
25 inside the backup payload at backup time and re-encrypts it under the new
26 device's key at restore time (hubDbConfigs mints that device's passphrase
27 when the restore runs before first launch). The agent also carries
28 datastore_default. It never carries secure_prefs or hub_controller.
29
30 secure_prefs.xml is excluded for the same reason — it holds only the
31 Keystore-wrapped ciphertext of the passphrase, which is undecryptable
32 off-device and is regenerated on first launch anyway.
33
34 SCOPE: hub declares android:backupAgent=".platform.AppBackupAgent" and
35 does NOT set android:fullBackupOnly, so Android uses key/value backup and
36 the <cloud-backup> section below is NOT consulted. Cloud content is
37 exactly AppBackupAgent's payload. <device-transfer> IS governed here, and
38 these rules become the cloud control too if the backupAgent is ever
39 removed.
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 <exclude domain="file" path="datastore/hub_controller.preferences_pb" />
47 <include domain="database" path="." />
48 <exclude domain="database" path="games-hub-db" />
49 <exclude domain="database" path="games-hub-db-wal" />
50 <exclude domain="database" path="games-hub-db-shm" />
51 <exclude domain="database" path="games-hub-db-journal" />
52 <include domain="sharedpref" path="." />
53 <exclude domain="sharedpref" path="secure_prefs.xml" />
54 <include domain="external" path="." />
55 </cloud-backup>
56 <device-transfer>
57 <include domain="root" path="." />
58 <include domain="file" path="." />
59 <exclude domain="file" path="datastore/hub_controller.preferences_pb" />
60 <include domain="database" path="." />
61 <!-- Same Keystore problem applies to D2D: the wrapping key does not
62 leave the source device either. -->
63 <exclude domain="database" path="games-hub-db" />
64 <exclude domain="database" path="games-hub-db-wal" />
65 <exclude domain="database" path="games-hub-db-shm" />
66 <exclude domain="database" path="games-hub-db-journal" />
67 <include domain="sharedpref" path="." />
68 <exclude domain="sharedpref" path="secure_prefs.xml" />
69 <include domain="external" path="." />
70 </device-transfer>
71</data-extraction-rules>