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

Modern-Apps.git / education / 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 Education. Audited state:
4 * databases/education-db — Room DB with Learner, SkillProgress and Deadline
5 entities (learner progress, stars, streaks, deadlines).
6 * files/datastore/datastore_default.preferences_pb — shared DataStoreUtils
7 file where AchievementsManager keeps badge unlocks/progress.
8 * secure_prefs.xml — SQLCipher passphrase for that DB.
9
10 education-db is excluded from both sections because it is SQLCipher-encrypted
11 via library:room, and the passphrase is wrapped by an AndroidKeystore key
12 (DatabaseHelper alias db_no_auth_key) that is hardware-bound and never leaves
13 the device. A restored raw copy cannot be decrypted: isKeyGenerated() returns
14 false on the new device, a fresh key and passphrase are minted,
15 encryptExistingDatabase() skips the file because its header is not
16 "SQLite format 3", and Room then fails to open it. Including the raw file
17 would turn a clean install into a crash on launch.
18
19 secure_prefs.xml is excluded with it — it stores only the Keystore-wrapped
20 ciphertext of the passphrase, which is meaningless without the key.
21
22 Learner progress still migrates: education declares its own BackupAgent,
23 which uses SqlCipherDbCodec to export the DB to plaintext inside the backup
24 payload and re-encrypt it under the new device's key on restore. That path
25 is the one that works; the raw file copy would only get in its way.
26
27 SCOPE: education declares android:backupAgent=".platform.AppBackupAgent" and
28 does NOT set android:fullBackupOnly, so Android uses key/value backup here
29 and the <cloud-backup> section below is NOT consulted. Cloud content is
30 exactly AppBackupAgent's educationDbConfigs(this) — education-db, exported
31 to plaintext by SqlCipherDbCodec and re-encrypted on restore — plus its
32 datastoreNames = ["datastore_default"]. The rules below govern
33 <device-transfer>, and are the correct cloud control if the backupAgent is
34 ever removed.
35-->
36<data-extraction-rules>
37 <!-- Not consulted while android:backupAgent is declared; see SCOPE above. -->
38 <cloud-backup>
39 <include domain="root" path="." />
40 <include domain="file" path="." />
41 <include domain="database" path="." />
42 <exclude domain="database" path="education-db" />
43 <exclude domain="database" path="education-db-wal" />
44 <exclude domain="database" path="education-db-shm" />
45 <exclude domain="database" path="education-db-journal" />
46 <include domain="sharedpref" path="." />
47 <exclude domain="sharedpref" path="secure_prefs.xml" />
48 <include domain="external" path="." />
49 </cloud-backup>
50 <device-transfer>
51 <include domain="root" path="." />
52 <include domain="file" path="." />
53 <include domain="database" path="." />
54 <exclude domain="database" path="education-db" />
55 <exclude domain="database" path="education-db-wal" />
56 <exclude domain="database" path="education-db-shm" />
57 <exclude domain="database" path="education-db-journal" />
58 <include domain="sharedpref" path="." />
59 <exclude domain="sharedpref" path="secure_prefs.xml" />
60 <include domain="external" path="." />
61 </device-transfer>
62</data-extraction-rules>